8000 merge upstream · python/cpython@5485255 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5485255

Browse files
committed
merge upstream
2 parents 9bcea95 + 61e008a commit 5485255

File tree

125 files changed

+1159
-873
lines changed

Some content is hidden

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

125 files changed

+1159
-873
lines changed

Doc/c-api/type.rst

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,16 @@ Creating Heap-Allocated Types
190190
The following functions and structs are used to create
191191
:ref:`heap types <heap-types>`.
192192
193-
.. c:function:: PyObject* PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases)
193+
.. c:function:: PyObject* PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases)
194194
195-
Creates and returns a :ref:`heap type <heap-types>` from the *spec*
195+
Create and return a :ref:`heap type <heap-types>` from the *spec*
196196
(:const:`Py_TPFLAGS_HEAPTYPE`).
197197
198+
The metaclass *metaclass* is used to construct the resulting type object.
199+
When *metaclass* is ``NULL``, the default :c:type:`PyType_Type` is used
200+
instead. Note that metaclasses that override
201+
:c:member:`~PyTypeObject.tp_new` are not supported.
202+
198203
The *bases* argument can be used to specify base classes; it can either
199204
be only one class or a tuple of classes.
200205
If *bases* is ``NULL``, the *Py_tp_bases* slot is used instead.
@@ -210,22 +215,29 @@ The following functions and structs are used to create
210215
211216
This function calls :c:func:`PyType_Ready` on the new type.
212217
218+
.. versionadded:: 3.12
219+
220+
.. c:function:: PyObject* PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases)
221+
222+
Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``.
223+
213224
.. versionadded:: 3.9
214225
215226
.. versionchanged:: 3.10
216227
217228
The function now accepts a single class as the *bases* argument and
218229
``NULL`` as the ``tp_doc`` slot.
219230
231+
220232
.. c:function:: PyObject* PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
221233
222-
Equivalent to ``PyType_FromModuleAndSpec(NULL, spec, bases)``.
234+
Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``.
223235
224236
.. versionadded:: 3.3
225237
226238
.. c:function:: PyObject* PyType_FromSpec(PyType_Spec *spec)
227239
228-
Equivalent to ``PyType_FromSpecWithBases(spec, NULL)``.
240+
Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``.
229241
230242
.. c:type:: PyType_Spec
231243

Doc/c-api/typeobj.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2071,7 +2071,7 @@ flag set.
20712071

20722072
This is done by filling a :c:type:`PyType_Spec` structure and calling
20732073
:c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`,
2074-
or :c:func:`PyType_FromModuleAndSpec`.
2074+
:c:func:`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`.
20752075

20762076

20772077
.. _number-structs:

Doc/data/stable_abi.dat

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/howto/logging.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,9 @@ need:
11011101
| Current process name when using ``multiprocessing`` | Set ``logging.logMultiprocessing`` to ``False``. |
11021102
| to manage multiple processes. | |
11031103
+-----------------------------------------------------+---------------------------------------------------+
1104+
| Current :class:`asyncio.Task` name when using | Set ``logging.logAsyncioTasks`` to ``False``. |
1105+
| ``asyncio``. | |
1106+
+-----------------------------------------------------+---------------------------------------------------+
11041107

11051108
Also note that the core logging module only includes the basic handlers. If
11061109
you don't import :mod:`logging.handlers` and :mod:`logging.config`, they won't

Doc/library/locale.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ The :mod:`locale` module defines the following exception and functions:
375375
The default setting is determined by calling :func:`getdefaultlocale`.
376376
*category* defaults to :const:`LC_ALL`.
377377

378+
.. deprecated:: 3.11 3.13
379+
378380

379381
.. function:: strcoll(string1, string2)
380382

Doc/library/logging.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,10 +872,14 @@ the options available to you.
872872
+----------------+-------------------------+-----------------------------------------------+
873873
| threadName | ``%(threadName)s`` | Thread name (if available). |
874874
+----------------+-------------------------+-----------------------------------------------+
875+
| taskName | ``%(taskName)s`` | :class:`asyncio.Task` name (if available). |
876+
+----------------+-------------------------+-----------------------------------------------+
875877

876878
.. versionchanged:: 3.1
877879
*processName* was added.
878880

881+
.. versionchanged:: 3.12
882+
*taskName* was added.
879883

880884
.. _logger-adapter:
881885

Doc/library/re.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,14 @@ Match objects support the following methods and attributes:
13271327
>>> m[2] # The second parenthesized subgroup.
13281328
'Newton'
13291329

1330+
Named groups are supported as well::
1331+
1332+
>>> m = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Isaac Newton")
1333+
>>> m['first_name']
1334+
'Isaac'
1335+
>>> m['last_name']
1336+
'Newton'
1337+
13301338
.. versionadded:: 3.6
13311339

13321340

0 commit comments

Comments
 (0)
0