Skip to content

Commit 312ed88

Browse files
committed
Merge branch 'main' into sys_getattr
2 parents 312fdce + 379ab85 commit 312ed88

Some content is hidden

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

53 files changed

+1104
-1122
lines changed

Doc/c-api/object.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,3 +613,14 @@ Object Protocol
613613
614614
.. versionadded:: 3.14
615615
616+
.. c:function:: int PyUnstable_IsImmortal(PyObject *obj)
617+
618+
This function returns non-zero if *obj* is :term:`immortal`, and zero
619+
otherwise. This function cannot fail.
620+
621+
.. note::
622+
623+
Objects that are immortal in one CPython version are not guaranteed to
624+
be immortal in another.
625+
626+
.. versionadded:: next

Doc/deprecations/c-api-pending-removal-in-future.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ although there is currently no date scheduled for their removal.
3434
Use :c:func:`!_PyErr_ChainExceptions1` instead.
3535
* :c:member:`!PyBytesObject.ob_shash` member:
3636
call :c:func:`PyObject_Hash` instead.
37-
* :c:member:`!PyDictObject.ma_version_tag` member.
3837
* Thread Local Storage (TLS) API:
3938

4039
* :c:func:`PyThread_create_key`:

Doc/library/uuid.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,25 @@ of the :attr:`~UUID.variant` attribute:
289289
Reserved for future definition.
290290

291291

292+
The :mod:`uuid` module defines the special Nil and Max UUID values:
293+
294+
295+
.. data:: NIL
296+
297+
A special form of UUID that is specified to have all 128 bits set to zero
298+
according to :rfc:`RFC 9562, §5.9 <9562#section-5.9>`.
299+
300+
.. versionadded:: next
301+
302+
303+
.. data:: MAX
304+
305+
A special form of UUID that is specified to have all 128 bits set to one
306+
according to :rfc:`RFC 9562, §5.10 <9562#section-5.10>`.
307+
308+
.. versionadded:: next
309+
310+
292311
.. seealso::
293312

294313
:rfc:`9562` - A Universally Unique IDentifier (UUID) URN Namespace
@@ -380,6 +399,14 @@ Here are some examples of typical usage of the :mod:`uuid` module::
380399
>>> uuid.UUID(bytes=x.bytes)
381400
UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')
382401

402+
>>> # get the Nil UUID
403+
>>> uuid.NIL
404+
UUID('00000000-0000-0000-0000-000000000000')
405+
406+
>>> # get the Max UUID
407+
>>> uuid.MAX
408+
UUID('ffffffff-ffff-ffff-ffff-ffffffffffff')
409+
383410

384411
.. _uuid-cli-example:
385412

Doc/whatsnew/3.14.rst

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,11 @@ uuid
731731
in :rfc:`9562`.
732732
(Contributed by Bénédikt Tran in :gh:`89083`.)
733733

734+
* :const:`uuid.NIL` and :const:`uuid.MAX` are now available to represent the
735+
Nil and Max UUID formats as defined by :rfc:`9562`.
736+
(Contributed by Nick Pope in :gh:`128427`.)
737+
738+
734739
zipinfo
735740
-------
736741

@@ -1218,16 +1223,6 @@ New features
12181223
which has an ambiguous return value.
12191224
(Contributed by Irit Katriel and Erlend Aasland in :gh:`105201`.)
12201225

1221-
* :c:func:`Py_Finalize` now deletes all interned strings. This
1222-
is backwards incompatible to any C-Extension that holds onto an interned
1223-
string after a call to :c:func:`Py_Finalize` and is then reused after a
1224-
call to :c:func:`Py_Initialize`. Any issues arising from this behavior will
1225-
normally result in crashes during the execution of the subsequent call to
1226-
:c:func:`Py_Initialize` from accessing uninitialized memory. To fix, use
1227-
an address sanitizer to identify any use-after-free coming from
1228-
an interned string and deallocate it during module shutdown.
1229-
(Contributed by Eddie Elizondo in :gh:`113601`.)
1230-
12311226
* Add :c:func:`PyLong_IsPositive`, :c:func:`PyLong_IsNegative`
12321227
and :c:func:`PyLong_IsZero` for checking if :c:type:`PyLongObject`
12331228
is positive, negative, or zero, respectively.
@@ -1303,18 +1298,12 @@ New features
13031298
test if two strings are equal.
13041299
(Contributed by Victor Stinner in :gh:`124502`.)
13051300

1306-
13071301
* Add :c:func:`PyType_Freeze` function to make a type immutable.
13081302
(Contributed by Victor Stinner in :gh:`121654`.)
13091303

13101304
* Add :c:func:`PyUnstable_Object_EnableDeferredRefcount` for enabling
13111305
deferred reference counting, as outlined in :pep:`703`.
13121306

1313-
* The :ref:`Unicode Exception Objects <unicodeexceptions>` C API
1314-
now raises a :exc:`TypeError` if its exception argument is not
1315-
a :exc:`UnicodeError` object.
1316-
(Contributed by Bénédikt Tran in :gh:`127691`.)
1317-
13181307
* Add :c:func:`PyMonitoring_FireBranchLeftEvent` and
13191308
:c:func:`PyMonitoring_FireBranchRightEvent` for generating
13201309
:monitoring-event:`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT`
@@ -1330,21 +1319,43 @@ New features
13301319
bit-packing Python version numbers.
13311320
(Contributed by Petr Viktorin in :gh:`128629`.)
13321321

1322+
* Add :c:func:`PyUnstable_IsImmortal` for determining whether an object is :term:`immortal`,
1323+
for debugging purposes.
1324+
13331325
* Add :c:func:`PySys_GetAttr` and :c:func:`PySys_GetAttrString` functions to
13341326
get an attribute of the :mod:`sys` module. Compared to
13351327
:c:func:`PySys_GetObject`, they don't ignore errors and return a
13361328
:term:`strong reference`.
13371329
(Contributed by Victor Stinner in :gh:`129367`.)
13381330

13391331

1340-
Porting to Python 3.14
1341-
----------------------
1332+
Limited C API changes
1333+
---------------------
13421334

13431335
* In the limited C API 3.14 and newer, :c:func:`Py_TYPE` and
13441336
:c:func:`Py_REFCNT` are now implemented as an opaque function call to hide
13451337
implementation details.
13461338
(Contributed by Victor Stinner in :gh:`120600` and :gh:`124127`.)
13471339

1340+
1341+
Porting to Python 3.14
1342+
----------------------
1343+
1344+
* :c:func:`Py_Finalize` now deletes all interned strings. This
1345+
is backwards incompatible to any C-Extension that holds onto an interned
1346+
string after a call to :c:func:`Py_Finalize` and is then reused after a
1347+
call to :c:func:`Py_Initialize`. Any issues arising from this behavior will
1348+
normally result in crashes during the execution of the subsequent call to
1349+
:c:func:`Py_Initialize` from accessing uninitialized memory. To fix, use
1350+
an address sanitizer to identify any use-after-free coming from
1351+
an interned string and deallocate it during module shutdown.
1352+
(Contributed by Eddie Elizondo in :gh:`113601`.)
1353+
1354+
* The :ref:`Unicode Exception Objects <unicodeexceptions>` C API
1355+
now raises a :exc:`TypeError` if its exception argument is not
1356+
a :exc:`UnicodeError` object.
1357+
(Contributed by Bénédikt Tran in :gh:`127691`.)
1358+
13481359
* Private functions promoted to public C APIs:
13491360

13501361
* ``_PyBytes_Join()``: :c:func:`PyBytes_Join`;
@@ -1389,12 +1400,6 @@ Deprecated
13891400

13901401
.. Add C API deprecations above alphabetically, not here at the end.
13911402
1392-
.. include:: ../deprecations/c-api-pending-removal-in-3.15.rst
1393-
1394-
.. include:: ../deprecations/c-api-pending-removal-in-3.18.rst
1395-
1396-
.. include:: ../deprecations/c-api-pending-removal-in-future.rst
1397-
13981403
* The ``PyMonitoring_FireBranchEvent`` function is deprecated and should
13991404
be replaced with calls to :c:func:`PyMonitoring_FireBranchLeftEvent`
14001405
and :c:func:`PyMonitoring_FireBranchRightEvent`.
@@ -1419,12 +1424,23 @@ Deprecated
14191424
(Contributed by Victor Stinner in :gh:`128863`.)
14201425

14211426

1427+
.. include:: ../deprecations/c-api-pending-removal-in-3.15.rst
1428+
1429+
.. include:: ../deprecations/c-api-pending-removal-in-3.18.rst
1430+
1431+
.. include:: ../deprecations/c-api-pending-removal-in-future.rst
1432+
1433+
14221434
Removed
14231435
-------
14241436

14251437
* Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable
14261438
bases was deprecated since 3.12 and now raises a :exc:`TypeError`.
14271439

1440+
* Remove ``PyDictObject.ma_version_tag`` member which was deprecated since
1441+
Python 3.12. Use the :c:func:`PyDict_AddWatcher` API instead.
1442+
(Contributed by Sam Gross in :gh:`124296`.)
1443+
14281444
* Remove the private ``_Py_InitializeMain()`` function. It was a
14291445
:term:`provisional API` added to Python 3.8 by :pep:`587`.
14301446
(Contributed by Victor Stinner in :gh:`129033`.)

Include/cpython/object.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,3 +541,6 @@ PyAPI_FUNC(PyRefTracer) PyRefTracer_GetTracer(void**);
541541
* 0 if the runtime ignored it. This function cannot fail.
542542
*/
543543
PyAPI_FUNC(int) PyUnstable_Object_EnableDeferredRefcount(PyObject *);
544+
545+
/* Check whether the object is immortal. This cannot fail. */
546+
PyAPI_FUNC(int) PyUnstable_IsImmortal(PyObject *);

Include/internal/pycore_frame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ typedef struct _PyInterpreterFrame {
6969
PyObject *f_locals; /* Strong reference, may be NULL. Only valid if not on C stack */
7070
PyFrameObject *frame_obj; /* Strong reference, may be NULL. Only valid if not on C stack */
7171
_Py_CODEUNIT *instr_ptr; /* Instruction currently executing (or about to begin) */
72+
_PyStackRef *stackpointer;
7273
#ifdef Py_GIL_DISABLED
7374
/* Index of thread-local bytecode containing instr_ptr. */
7475
int32_t tlbc_index;
7576
#endif
76-
_PyStackRef *stackpointer;
7777
uint16_t return_offset; /* Only relevant during a function call */
7878
char owner;
7979
#ifdef Py_DEBUG

Include/internal/pycore_magic_number.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ Known values:
267267
Python 3.14a4 3612 (Add POP_ITER and INSTRUMENTED_POP_ITER)
268268
Python 3.14a4 3613 (Add LOAD_CONST_MORTAL instruction)
269269
Python 3.14a5 3614 (Add BINARY_OP_EXTEND)
270+
Python 3.14a5 3615 (CALL_FUNCTION_EX always take a kwargs argument)
270271
271272
Python 3.15 will start with 3650
272273
@@ -279,7 +280,7 @@ PC/launcher.c must also be updated.
279280
280281
*/
281282

282-
#define PYC_MAGIC_NUMBER 3614
283+
#define PYC_MAGIC_NUMBER 3615
283284
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
284285
(little-endian) and then appending b'\r\n'. */
285286
#define PYC_MAGIC_NUMBER_TOKEN \

Include/internal/pycore_opcode_metadata.h

Lines changed: 18 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)