Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3366d58

Browse files
authored
Merge branch 'main' into feature/os.timerfd_xxx
2 parents 94f248d + c6d5613 commit 3366d58

77 files changed

Lines changed: 974 additions & 573 deletions

Some content is hidden

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

Doc/c-api/typeobj.rst

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -528,28 +528,6 @@ type objects) *must* have the :c:member:`~PyVarObject.ob_size` field.
528528
This field is inherited by subtypes.
529529

530530

531-
.. c:member:: PyObject* PyObject._ob_next
532-
PyObject* PyObject._ob_prev
533-
534-
These fields are only present when the macro ``Py_TRACE_REFS`` is defined
535-
(see the :option:`configure --with-trace-refs option <--with-trace-refs>`).
536-
537-
Their initialization to ``NULL`` is taken care of by the
538-
``PyObject_HEAD_INIT`` macro. For :ref:`statically allocated objects
539-
<static-types>`, these fields always remain ``NULL``. For :ref:`dynamically
540-
allocated objects <heap-types>`, these two fields are used to link the
541-
object into a doubly linked list of *all* live objects on the heap.
542-
543-
This could be used for various debugging purposes; currently the only uses
544-
are the :func:`sys.getobjects` function and to print the objects that are
545-
still alive at the end of a run when the environment variable
546-
:envvar:`PYTHONDUMPREFS` is set.
547-
548-
**Inheritance:**
549-
550-
These fields are not inherited by subtypes.
551-
552-
553531
PyVarObject Slots
554532
-----------------
555533

Doc/howto/enum.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,17 @@ enumeration, with the exception of special methods (:meth:`__str__`,
426426
:meth:`__add__`, etc.), descriptors (methods are also descriptors), and
427427
variable names listed in :attr:`_ignore_`.
428428

429-
Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__` then
429+
Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__`,
430430
any value(s) given to the enum member will be passed into those methods.
431431
See `Planet`_ for an example.
432432

433+
.. note::
434+
435+
The :meth:`__new__` method, if defined, is used during creation of the Enum
436+
members; it is then replaced by Enum's :meth:`__new__` which is used after
437+
class creation for lookup of existing members. See :ref:`new-vs-init` for
438+
more details.
439+
433440

434441
Restricted Enum subclassing
435442
---------------------------
@@ -895,6 +902,8 @@ Some rules:
895902
:meth:`__str__` method has been reset to their data types'
896903
:meth:`__str__` method.
897904

905+
.. _new-vs-init:
906+
898907
When to use :meth:`__new__` vs. :meth:`__init__`
899908
------------------------------------------------
900909

@@ -927,6 +936,11 @@ want one of them to be the value::
927936
>>> print(Coordinate(3))
928937
Coordinate.VY
929938

939+
.. warning::
940+
941+
*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the one
942+
that is found; instead, use the data type directly.
943+
930944

931945
Finer Points
932946
^^^^^^^^^^^^
@@ -1353,6 +1367,13 @@ to handle any extra arguments::
13531367
members; it is then replaced by Enum's :meth:`__new__` which is used after
13541368
class creation for lookup of existing members.
13551369

1370+
.. warning::
1371+
1372+
*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the one
1373+
that is found; instead, use the data type directly -- e.g.::
1374+
1375+
obj = int.__new__(cls, value)
1376+
13561377

13571378
OrderedEnum
13581379
^^^^^^^^^^^

Doc/library/threading.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ The instance's values will be different for separate threads.
272272
A class that represents thread-local data.
273273

274274
For more details and extensive examples, see the documentation string of the
275-
:mod:`_threading_local` module: :source:`Lib/_threading_local.py`.
275+
:mod:`!_threading_local` module: :source:`Lib/_threading_local.py`.
276276

277277

278278
.. _thread-objects:
@@ -285,7 +285,7 @@ thread of control. There are two ways to specify the activity: by passing a
285285
callable object to the constructor, or by overriding the :meth:`~Thread.run`
286286
method in a subclass. No other methods (except for the constructor) should be
287287
overridden in a subclass. In other words, *only* override the
288-
:meth:`~Thread.__init__` and :meth:`~Thread.run` methods of this class.
288+
``__init__()`` and :meth:`~Thread.run` methods of this class.
289289

290290
Once a thread object is created, its activity must be started by calling the
291291
thread's :meth:`~Thread.start` method. This invokes the :meth:`~Thread.run`
@@ -337,7 +337,7 @@ since it is impossible to detect the termination of alien threads.
337337
are:
338338

339339
*group* should be ``None``; reserved for future extension when a
340-
:class:`ThreadGroup` class is implemented.
340+
:class:`!ThreadGroup` class is implemented.
341341

342342
*target* is the callable object to be invoked by the :meth:`run` method.
343343
Defaults to ``None``, meaning nothing is called.
@@ -1009,7 +1009,7 @@ This class represents an action that should be run only after a certain amount
10091009
of time has passed --- a timer. :class:`Timer` is a subclass of :class:`Thread`
10101010
and as such also functions as an example of creating custom threads.
10111011

1012-
Timers are started, as with threads, by calling their :meth:`~Timer.start`
1012+
Timers are started, as with threads, by calling their :meth:`Timer.start <Thread.start>`
10131013
method. The timer can be stopped (before its action has begun) by calling the
10141014
:meth:`~Timer.cancel` method. The interval the timer will wait before
10151015
executing its action may not be exactly the same as the interval specified by
@@ -1147,10 +1147,10 @@ As an example, here is a simple way to synchronize a client and server thread::
11471147
Using locks, conditions, and semaphores in the :keyword:`!with` statement
11481148
-------------------------------------------------------------------------
11491149

1150-
All of the objects provided by this module that have :meth:`acquire` and
1151-
:meth:`release` methods can be used as context managers for a :keyword:`with`
1152-
statement. The :meth:`acquire` method will be called when the block is
1153-
entered, and :meth:`release` will be called when the block is exited. Hence,
1150+
All of the objects provided by this module that have ``acquire`` and
1151+
``release`` methods can be used as context managers for a :keyword:`with`
1152+
statement. The ``acquire`` method will be called when the block is
1153+
entered, and ``release`` will be called when the block is exited. Hence,
11541154
the following snippet::
11551155

11561156
with some_lock:

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ Doc/library/tarfile.rst
124124
Doc/library/tempfile.rst
125125
Doc/library/termios.rst
126126
Doc/library/test.rst
127-
Doc/library/threading.rst
128127
Doc/library/time.rst
129128
Doc/library/tkinter.rst
130129
Doc/library/tkinter.scrolledtext.rst

Doc/using/configure.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,7 @@ See also the :ref:`Python Development Mode <devmode>` and the
425425
.. versionchanged:: 3.8
426426
Release builds and debug builds are now ABI compatible: defining the
427427
``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see the
428-
:option:`--with-trace-refs` option), which introduces the only ABI
429-
incompatibility.
428+
:option:`--with-trace-refs` option).
430429

431430

432431
Debug options
@@ -447,8 +446,14 @@ Debug options
447446
* Add :func:`sys.getobjects` function.
448447
* Add :envvar:`PYTHONDUMPREFS` environment variable.
449448

450-
This build is not ABI compatible with release build (default build) or debug
451-
build (``Py_DEBUG`` and ``Py_REF_DEBUG`` macros).
449+
The :envvar:`PYTHONDUMPREFS` environment variable can be used to dump
450+
objects and reference counts still alive at Python exit.
451+
452+
:ref:`Statically allocated objects <static-types>` are not traced.
453+
454+
.. versionchanged:: 3.13
455+
This build is now ABI compatible with release build and :ref:`debug build
456+
<debug-build>`.
452457

453458
.. versionadded:: 3.8
454459

Doc/whatsnew/3.12.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,8 +1312,9 @@ Removed
13121312
* References to, and support for :meth:`!module_repr()` has been removed.
13131313
(Contributed by Barry Warsaw in :gh:`97850`.)
13141314

1315-
* ``importlib.util.set_package`` has been removed. (Contributed by Brett
1316-
Cannon in :gh:`65961`.)
1315+
* ``importlib.util.set_package``, ``importlib.util.set_loader`` and
1316+
``importlib.util.module_for_loader`` have all been removed. (Contributed by
1317+
Brett Cannon and Nikita Sobolev in :gh:`65961` and :gh:`97850`.)
13171318

13181319
* Support for ``find_loader()`` and ``find_module()`` APIs have been
13191320
removed. (Contributed by Barry Warsaw in :gh:`98040`.)

Doc/whatsnew/3.13.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,11 @@ Build Changes
838838
* SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension module.
839839
(Contributed by Erlend Aasland in :gh:`105875`.)
840840

841+
* Python built with :file:`configure` :option:`--with-trace-refs` (tracing
842+
references) is now ABI compatible with Python release build and
843+
:ref:`debug build <debug-build>`.
844+
(Contributed by Victor Stinner in :gh:`108634`.)
845+
841846

842847
C API Changes
843848
=============
@@ -910,6 +915,10 @@ New Features
910915
(with an underscore prefix).
911916
(Contributed by Victor Stinner in :gh:`108014`.)
912917

918+
* Python built with :file:`configure` :option:`--with-trace-refs` (tracing
919+
references) now supports the :ref:`Limited API <limited-c-api>`.
920+
(Contributed by Victor Stinner in :gh:`108634`.)
921+
913922
Porting to Python 3.13
914923
----------------------
915924

Include/cpython/initconfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ PyAPI_FUNC(PyStatus) PyStatus_Exit(int exitcode);
2525
PyAPI_FUNC(int) PyStatus_IsError(PyStatus err);
2626
PyAPI_FUNC(int) PyStatus_IsExit(PyStatus err);
2727
PyAPI_FUNC(int) PyStatus_Exception(PyStatus err);
28-
PyAPI_FUNC(PyObject *) _PyErr_SetFromPyStatus(PyStatus status);
2928

3029
/* --- PyWideStringList ------------------------------------------------ */
3130

Include/cpython/pyerrors.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@ typedef PyOSErrorObject PyEnvironmentErrorObject;
8888
typedef PyOSErrorObject PyWindowsErrorObject;
8989
#endif
9090

91-
/* Context manipulation (PEP 3134) */
92-
93-
Py_DEPRECATED(3.12) PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
94-
PyAPI_FUNC(void) _PyErr_ChainExceptions1(PyObject *);
95-
9691
/* In exceptions.c */
9792

9893
PyAPI_FUNC(PyObject*) PyUnstable_Exc_PrepReraiseStar(

Include/cpython/pyframe.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,11 @@ PyAPI_FUNC(int) PyUnstable_InterpreterFrame_GetLasti(struct _PyInterpreterFrame
3333
/* Returns the currently executing line number, or -1 if there is no line number.
3434
* Does not raise an exception. */
3535
PyAPI_FUNC(int) PyUnstable_InterpreterFrame_GetLine(struct _PyInterpreterFrame *frame);
36+
37+
#define PyUnstable_EXECUTABLE_KIND_SKIP 0
38+
#define PyUnstable_EXECUTABLE_KIND_PY_FUNCTION 1
39+
#define PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION 3
40+
#define PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR 4
41+
#define PyUnstable_EXECUTABLE_KINDS 5
42+
43+
PyAPI_DATA(const PyTypeObject *) const PyUnstable_ExecutableKinds[PyUnstable_EXECUTABLE_KINDS+1];

0 commit comments

Comments
 (0)