8000 Merge remote-tracking branch 'upstream/main' into asyncio_clear_watch… · python/cpython@0d802c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d802c2

Browse files
committed
Merge remote-tracking branch 'upstream/main' into asyncio_clear_watcher_threads
2 parents 85b79b2 + 84b7e9e commit 0d802c2

File tree

711 files changed

+10774
-3789
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

711 files changed

+10774
-3789
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ repos:
2424
types_or: [c, inc, python, rst]
2525

2626
- repo: https://github.com/sphinx-contrib/sphinx-lint
27-
rev: v0.6.8
27+
rev: v0.7.0
2828
hooks:
2929
- id: sphinx-lint
30-
args: [--enable=default-role]
30+
args: [--enable=default-role, -j1]
3131
files: ^Doc/|^Misc/NEWS.d/next/
3232
types: [rst]
33-
require_serial: true
3433

3534
- repo: meta
3635
hooks:

Doc/c-api/arg.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,10 @@ API Functions
416416
.. c:function:: int PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], ...)
417417
418418
Parse the parameters of a function that takes both positional and keyword
419-
parameters into local variables. The *keywords* argument is a
420-
``NULL``-terminated array of keyword parameter names. Empty names denote
419+
parameters into local variables.
420+
The *keywords* argument is a ``NULL``-terminated array of keyword parameter
421+
names specified as null-terminated ASCII or UTF-8 encoded C strings.
422+
Empty names denote
421423
:ref:`positional-only parameters <positional-only_parameter>`.
422424
Returns true on success; on failure, it returns false and raises the
423425
appropriate exception.
@@ -426,6 +428,9 @@ API Functions
426428
Added support for :ref:`positional-only parameters
427429
<positional-only_parameter>`.
428430
431+
.. versionchanged:: 3.13
432+
Added support for non-ASCII keyword parameter names.
433+
429434
430435
.. c:function:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs)
431436

Doc/c-api/init_config.rst

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ PyConfig
716716
717717
Set to ``1`` by the :envvar:`PYTHONDUMPREFS` environment variable.
718718
719-
Need a special build of Python with the ``Py_TRACE_REFS`` macro defined:
719+
Needs a special build of Python with the ``Py_TRACE_REFS`` macro defined:
720720
see the :option:`configure --with-trace-refs option <--with-trace-refs>`.
721721
722722
Default: ``0``.
@@ -1048,7 +1048,7 @@ PyConfig
10481048
Incremented by the :option:`-d` command line option. Set to the
10491049
:envvar:`PYTHONDEBUG` environment variable value.
10501050
1051-
Need a :ref:`debug build of Python <debug-build>` (the ``Py_DEBUG`` macro
1051+
Needs a :ref:`debug build of Python <debug-build>` (the ``Py_DEBUG`` macro
10521052
must be defined).
10531053
10541054
Default: ``0``.
@@ -1100,6 +1100,7 @@ PyConfig
11001100
11011101
Set by the :option:`-X pycache_prefix=PATH <-X>` command line option and
11021102
the :envvar:`PYTHONPYCACHEPREFIX` environment variable.
1103+
The command-line option takes precedence.
11031104
11041105
If ``NULL``, :data:`sys.pycache_prefix` is set to ``None``.
11051106
@@ -1143,13 +1144,27 @@ PyConfig
11431144
11441145
Default: ``NULL``.
11451146
1147+
.. c:member:: wchar_t* run_presite
1148+
1149+
``package.module`` path to module that should be imported before
1150+
``site.py`` is run.
1151+
1152+
Set by the :option:`-X presite=package.module <-X>` command-line
1153+
option and the :envvar:`PYTHON_PRESITE` environment variable.
1154+
The command-line option takes precedence.
1155+
1156+
Needs a :ref:`debug build of Python <debug-build>` (the ``Py_DEBUG`` macro
1157+
must be defined).
1158+
1159+
Default: ``NULL``.
1160+
11461161
.. c:member:: int show_ref_count
11471162
11481163
Show total reference count at exit (excluding immortal objects)?
11491164
11501165
Set to ``1`` by :option:`-X showrefcount <-X>` command line option.
11511166
1152-
Need a :ref:`debug build of Python <debug-build>` (the ``Py_REF_DEBUG``
1167+
Needs a :ref:`debug build of Python <debug-build>` (the ``Py_REF_DEBUG``
11531168
macro must be defined).
11541169
11551170
Default: ``0``.

Doc/c-api/structures.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,11 @@ Accessing attributes of extension types
406406
.. c:type:: PyMemberDef
407407
408408
Structure which describes an attribute of a type which corresponds to a C
409-
struct member. Its fields are, in order:
409+
struct member.
410+
When defining a class, put a NULL-terminated array of these
411+
structures in the :c:member:`~PyTypeObject.tp_members` slot.
412+
413+
Its fields are, in order:
410414
411415
.. c:member:: const char* name
412416

Doc/c-api/type.rst

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -461,21 +461,34 @@ The following functions and structs are used to create
461461
* ``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`
462462
* ``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`
463463
464-
The following fields cannot be set at all using :c:type:`PyType_Spec` and
465-
:c:type:`PyType_Slot`:
466-
467-
* :c:member:`~PyTypeObject.tp_dict`
468-
* :c:member:`~PyTypeObject.tp_mro`
469-
* :c:member:`~PyTypeObject.tp_cache`
470-
* :c:member:`~PyTypeObject.tp_subclasses`
471-
* :c:member:`~PyTypeObject.tp_weaklist`
464+
The following “offset” fields cannot be set using :c:type:`PyType_Slot`:
465+
466+
* :c:member:`~PyTypeObject.tp_weaklistoffset`
467+
(use :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)
468+
* :c:member:`~PyTypeObject.tp_dictoffset`
469+
(use :c:macro:`Py_TPFLAGS_MANAGED_DICT` instead if possible)
470+
* :c:member:`~PyTypeObject.tp_vectorcall_offset`
471+
(use ``"__vectorcalloffset__"`` in
472+
:ref:`PyMemberDef <pymemberdef-offsets>`)
473+
474+
If it is not possible to switch to a ``MANAGED`` flag (for example,
475+
for vectorcall or to support Python older than 3.12), specify the
476+
offset in :c:member:`Py_tp_members <PyTypeObject.tp_members>`.
477+
See :ref:`PyMemberDef documentation <pymemberdef-offsets>`
478+
for details.
479+
480+
The following fields cannot be set at all when creating a heap type:
481+
472482
* :c:member:`~PyTypeObject.tp_vectorcall`
473-
* :c:member:`~PyTypeObject.tp_weaklistoffset`
474-
(use :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead)
475-
* :c:member:`~PyTypeObject.tp_dictoffset`
476-
(use :c:macro:`Py_TPFLAGS_MANAGED_DICT` instead)
477-
* :c:member:` F438 ~PyTypeObject.tp_vectorcall_offset`
478-
(see :ref:`PyMemberDef <pymemberdef-offsets>`)
483+
(use :c:member:`~PyTypeObject.tp_new` and/or
484+
:c:member:`~PyTypeObject.tp_init`)
485+
486+
* Internal fields:
487+
:c:member:`~PyTypeObject.tp_dict`,
488+
:c:member:`~PyTypeObject.tp_mro`,
489+
:c:member:`~PyTypeObject.tp_cache`,
490+
:c:member:`~PyTypeObject.tp_subclasses`, and
491+
:c:member:`~PyTypeObject.tp_weaklist`.
479492
480493
Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be
481494
problematic on some platforms.

Doc/library/asyncio-task.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -767,9 +767,6 @@ Timeouts
767767

768768
If the wait is cancelled, the future *aw* is also cancelled.
769769

770-
.. versionchanged:: 3.10
771-
Removed the *loop* parameter.
772-
773770
.. _asyncio_example_waitfor:
774771

775772
Example::
@@ -800,6 +797,9 @@ Timeouts
800797
.. versionchanged:: 3.10
801798
Removed the *loop* parameter.
802799

800+
.. versionchanged:: 3.11
801+
Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`.
802+
803803

804804
Waiting Primitives
805805
==================

Doc/library/time.rst

Lines changed: 60 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ An explanation of some terminology and conventions is in order.
7171
* On the other hand, the precision of :func:`.time` and :func:`sleep` is better
7272
than their Unix equivalents: times are expressed as floating point numbers,
7373
:func:`.time` returns the most accurate time available (using Unix
74-
:c:func:`gettimeofday` where available), and :func:`sleep` will accept a time
75-
with a nonzero fraction (Unix :c:func:`select` is used to implement this, where
74+
:c:func:`!gettimeofday` where available), and :func:`sleep` will accept a time
75+
with a nonzero fraction (Unix :c:func:`!select` is used to implement this, where
7676
available).
7777

7878
* The time value as returned by :func:`gmtime`, :func:`localtime`, and
@@ -84,12 +84,14 @@ An explanation of some terminology and conventions is in order.
8484
See :class:`struct_time` for a description of these objects.
8585

8686
.. versionchanged:: 3.3
87-
The :class:`struct_time` type was extended to provide the :attr:`tm_gmtoff`
88-
and :attr:`tm_zone` attributes when platform supports corresponding
87+
The :class:`struct_time` type was extended to provide
88+
the :attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone`
89+
attributes when platform supports corresponding
8990
``struct tm`` members.
9091

9192
.. versionchanged:: 3.6
92-
The :class:`struct_time` attributes :attr:`tm_gmtoff` and :attr:`tm_zone`
93+
The :class:`struct_time` attributes
94+
:attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone`
9395
are now available on all platforms.
9496

9597
* Use the following functions to convert between time representations:
@@ -501,6 +503,8 @@ Functions
501503
When used with the :func:`strptime` function, the ``%p`` directive only affects
502504
the output hour field if the ``%I`` directive is used to parse the hour.
503505

506+
.. _leap-second:
507+
504508
(2)
505509
The range really is ``0`` to ``61``; value ``60`` is valid in
506510
timestamps representing `leap seconds`_ and value ``61`` is supported
@@ -571,32 +575,55 @@ Functions
571575
tuple` interface: values can be accessed by index and by attribute name. The
572576
following values are present:
573577

574-
+-------+-------------------+---------------------------------+
575-
| Index | Attribute | Values |
576-
+=======+===================+=================================+
577-
| 0 | :attr:`tm_year` | (for example, 1993) |
578-
+-------+-------------------+---------------------------------+
579-
| 1 | :attr:`tm_mon` | range [1, 12] |
580-
+-------+-------------------+---------------------------------+
581-
| 2 | :attr:`tm_mday` | range [1, 31] |
582-
+-------+-------------------+---------------------------------+
583-
| 3 | :attr:`tm_hour` | range [0, 23] |
584-
+-------+-------------------+---------------------------------+
585-
| 4 | :attr:`tm_min` | range [0, 59] |
586-
+-------+-------------------+---------------------------------+
587-
| 5 | :attr:`tm_sec` | range [0, 61]; see **(2)** in |
588-
| | | :func:`strftime` description |
589-
+-------+-------------------+---------------------------------+
590-
| 6 | :attr:`tm_wday` | range [0, 6], Monday is 0 |
591-
+-------+-------------------+---------------------------------+
592-
| 7 | :attr:`tm_yday` | range [1, 366] |
593-
+-------+-------------------+---------------------------------+
594-
| 8 | :attr:`tm_isdst` | 0, 1 or -1; see below |
595-
+-------+-------------------+---------------------------------+
596-
| N/A | :attr:`tm_zone` | abbreviation of timezone name |
597-
+-------+-------------------+---------------------------------+
598-
| N/A | :attr:`tm_gmtoff` | offset east of UTC in seconds |
599-
+-------+-------------------+---------------------------------+
578+
.. list-table::
579+
580+
* - Index
581+
- Attribute
582+
- Values
583+
584+
* - 0
585+
- .. attribute:: tm_year
586+
- (for example, 1993)
587+
588+
* - 1
589+
- .. attribute:: tm_mon
590+
- range [1, 12]
591+
592+
* - 2
593+
- .. attribute:: tm_day
594+
- range [1, 31]
595+
596+
* - 3
597+
- .. attribute:: tm_hour
598+
- range [0, 23]
599+
600+
* - 4
601+
- .. attribute:: tm_min
602+
- range [0, 59]
603+
604+
* - 5
605+
- .. attribute:: tm_sec
606+
- range [0, 61]; see :ref:`Note (2) <leap-second>` in :func:`strftime`
607+
608+
* - 6
609+
- .. attribute:: tm_wday
610+
- range [0, 6]; Monday is 0
611+
612+
* - 7
613+
- .. attribute:: tm_yday
614+
- range [1, 366]
615+
616+
* - 8
617+
- .. attribute:: tm_isdst
618+
- 0, 1 or -1; see below
619+
620+
* - N/A
621+
- .. attribute:: tm_zone
622+
- abbreviation of timezone name
623+
624+
* - N/A
625+
- .. attribute:: tm_gmtoff
626+
- offset east of UTC in seconds
600627

601628
Note that unlike the C structure, the month value is a range of [1, 12], not
602629
[0, 11].
@@ -917,8 +944,8 @@ Timezone Constants
917944
For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:`timezone`,
918945
and :data:`tzname`), the value is determined by the timezone rules in effect
919946
at module load time or the last time :func:`tzset` is called and may be incorrect
920-
for times in the past. It is recommended to use the :attr:`tm_gmtoff` and
921-
:attr:`tm_zone` results from :func:`localtime` to obtain timezone information.
947+
for times in the past. It is recommended to use the :attr:`~struct_time.tm_gmtoff` and
948+
:attr:`~struct_time.tm_zone` results from :func:`localtime` to obtain timezone information.
922949

923950

924951
.. seealso::

Doc/tools/.nitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ Doc/library/tarfile.rst
117117
Doc/library/tempfile.rst
118118
Doc/library/termios.rst
119119
Doc/library/test.rst
120-
Doc/library/time.rst
121120
Doc/library/tkinter.rst
122121
Doc/library/tkinter.scrolledtext.rst
123122
Doc/library/tkinter.ttk.rst
@@ -145,7 +144,6 @@ Doc/reference/import.rst
145144
Doc/reference/simple_stmts.rst
146145
Doc/tutorial/datastructures.rst
147146
Doc/tutorial/introduction.rst
148-
Doc/using/cmdline.rst
149147
Doc/using/windows.rst
150148
Doc/whatsnew/2.0.rst
151149
Doc/whatsnew/2.1.rst

Doc/tools/extensions/pyspecific.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
ISSUE_URI = 'https://bugs.python.org/issue?@action=redirect&bpo=%s'
4141
GH_ISSUE_URI = 'https://github.com/python/cpython/issues/%s'
42-
SOURCE_URI = 'https://github.com/python/cpython/tree/3.12/%s'
42+
SOURCE_URI = 'https://github.com/python/cpython/tree/main/%s'
4343

4444
# monkey-patch reST parser to disable alphabetic and roman enumerated lists
4545
from docutils.parsers.rst.states import Body

0 commit comments

Comments
 (0)
0