Skip to content

Commit 04c236b

Browse files
authored
GH-123299: Copyedit 3.14 What's New: Move and consolidate Porting (#138400)
1 parent 6dd21e9 commit 04c236b

File tree

1 file changed

+94
-92
lines changed

1 file changed

+94
-92
lines changed

Doc/whatsnew/3.14.rst

Lines changed: 94 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -2819,41 +2819,6 @@ CPython bytecode changes
28192819
* Replaced the opcode ``BINARY_SUBSCR`` by :opcode:`BINARY_OP` with oparg ``NB_SUBSCR``.
28202820
(Contributed by Irit Katriel in :gh:`100239`.)
28212821

2822-
Porting to Python 3.14
2823-
======================
2824-
2825-
This section lists previously described changes and other bugfixes
2826-
that may require changes to your code.
2827-
2828-
Changes in the Python API
2829-
-------------------------
2830-
2831-
* :class:`functools.partial` is now a method descriptor.
2832-
Wrap it in :func:`staticmethod` if you want to preserve the old behavior.
2833-
(Contributed by Serhiy Storchaka and Dominykas Grigonis in :gh:`121027`.)
2834-
2835-
* The :ref:`garbage collector is now incremental <whatsnew314-incremental-gc>`,
2836-
which means that the behavior of :func:`gc.collect` changes slightly:
2837-
2838-
* ``gc.collect(1)``: Performs an increment of garbage collection,
2839-
rather than collecting generation 1.
2840-
* Other calls to :func:`!gc.collect` are unchanged.
2841-
2842-
* The :func:`locale.nl_langinfo` function now temporarily sets the ``LC_CTYPE``
2843-
locale in some cases.
2844-
This temporary change affects other threads.
2845-
(Contributed by Serhiy Storchaka in :gh:`69998`.)
2846-
2847-
* :class:`types.UnionType` is now an alias for :class:`typing.Union`,
2848-
causing changes in some behaviors.
2849-
See :ref:`above <whatsnew314-typing-union>` for more details.
2850-
(Contributed by Jelle Zijlstra in :gh:`105499`.)
2851-
2852-
* The runtime behavior of annotations has changed in various ways; see
2853-
:ref:`above <whatsnew314-pep649>` for details. While most code that interacts
2854-
with annotations should continue to work, some undocumented details may behave
2855-
differently.
2856-
28572822

28582823
Build changes
28592824
=============
@@ -3048,63 +3013,6 @@ Limited C API changes
30483013
(Contributed by Victor Stinner in :gh:`91417`.)
30493014

30503015

3051-
Porting to Python 3.14
3052-
----------------------
3053-
3054-
* :c:func:`Py_Finalize` now deletes all interned strings. This
3055-
is backwards incompatible to any C-Extension that holds onto an interned
3056-
string after a call to :c:func:`Py_Finalize` and is then reused after a
3057-
call to :c:func:`Py_Initialize`. Any issues arising from this behavior will
3058-
normally result in crashes during the execution of the subsequent call to
3059-
:c:func:`Py_Initialize` from accessing uninitialized memory. To fix, use
3060-
an address sanitizer to identify any use-after-free coming from
3061-
an interned string and deallocate it during module shutdown.
3062-
(Contributed by Eddie Elizondo in :gh:`113601`.)
3063-
3064-
* The :ref:`Unicode Exception Objects <unicodeexceptions>` C API
3065-
now raises a :exc:`TypeError` if its exception argument is not
3066-
a :exc:`UnicodeError` object.
3067-
(Contributed by Bénédikt Tran in :gh:`127691`.)
3068-
3069-
.. _whatsnew314-refcount:
3070-
3071-
* The interpreter internally avoids some reference count modifications when
3072-
loading objects onto the operands stack by :term:`borrowing <borrowed reference>`
3073-
references when possible. This can lead to smaller reference count values
3074-
compared to previous Python versions. C API extensions that checked
3075-
:c:func:`Py_REFCNT` of ``1`` to determine if an function argument is not
3076-
referenced by any other code should instead use
3077-
:c:func:`PyUnstable_Object_IsUniqueReferencedTemporary` as a safer replacement.
3078-
3079-
3080-
* Private functions promoted to public C APIs:
3081-
3082-
* ``_PyBytes_Join()``: :c:func:`PyBytes_Join`
3083-
* ``_PyLong_IsNegative()``: :c:func:`PyLong_IsNegative`
3084-
* ``_PyLong_IsPositive()``: :c:func:`PyLong_IsPositive`
3085-
* ``_PyLong_IsZero()``: :c:func:`PyLong_IsZero`
3086-
* ``_PyLong_Sign()``: :c:func:`PyLong_GetSign`
3087-
* ``_PyUnicodeWriter_Dealloc()``: :c:func:`PyUnicodeWriter_Discard`
3088-
* ``_PyUnicodeWriter_Finish()``: :c:func:`PyUnicodeWriter_Finish`
3089-
* ``_PyUnicodeWriter_Init()``: use :c:func:`PyUnicodeWriter_Create`
3090-
* ``_PyUnicodeWriter_Prepare()``: (no replacement)
3091-
* ``_PyUnicodeWriter_PrepareKind()``: (no replacement)
3092-
* ``_PyUnicodeWriter_WriteChar()``: :c:func:`PyUnicodeWriter_WriteChar`
3093-
* ``_PyUnicodeWriter_WriteStr()``: :c:func:`PyUnicodeWriter_WriteStr`
3094-
* ``_PyUnicodeWriter_WriteSubstring()``: :c:func:`PyUnicodeWriter_WriteSubstring`
3095-
* ``_PyUnicode_EQ()``: :c:func:`PyUnicode_Equal`
3096-
* ``_PyUnicode_Equal()``: :c:func:`PyUnicode_Equal`
3097-
* ``_Py_GetConfig()``: :c:func:`PyConfig_Get` and :c:func:`PyConfig_GetInt`
3098-
* ``_Py_HashBytes()``: :c:func:`Py_HashBuffer`
3099-
* ``_Py_fopen_obj()``: :c:func:`Py_fopen`
3100-
* ``PyMutex_IsLocked()`` : :c:func:`PyMutex_IsLocked`
3101-
3102-
The `pythoncapi-compat project`_ can be used to get most of these new
3103-
functions on Python 3.13 and older.
3104-
3105-
.. _pythoncapi-compat project: https://github.com/python/pythoncapi-compat/
3106-
3107-
31083016
.. _whatsnew314-c-api-deprecated:
31093017

31103018
Deprecated
@@ -3210,3 +3118,97 @@ Removed
32103118
Please use :c:func:`Py_EnterRecursiveCall` to guard against runaway recursion
32113119
in C code.
32123120
(Removed in :gh:`133079`, see also :gh:`130396`.)
3121+
3122+
3123+
Porting to Python 3.14
3124+
======================
3125+
3126+
This section lists previously described changes and other bugfixes
3127+
that may require changes to your code.
3128+
3129+
3130+
Changes in the Python API
3131+
-------------------------
3132+
3133+
* :class:`functools.partial` is now a method descriptor.
3134+
Wrap it in :func:`staticmethod` if you want to preserve the old behavior.
3135+
(Contributed by Serhiy Storchaka and Dominykas Grigonis in :gh:`121027`.)
3136+
3137+
* The :ref:`garbage collector is now incremental <whatsnew314-incremental-gc>`,
3138+
which means that the behavior of :func:`gc.collect` changes slightly:
3139+
3140+
* ``gc.collect(1)``: Performs an increment of garbage collection,
3141+
rather than collecting generation 1.
3142+
* Other calls to :func:`!gc.collect` are unchanged.
3143+
3144+
* The :func:`locale.nl_langinfo` function now temporarily sets the ``LC_CTYPE``
3145+
locale in some cases.
3146+
This temporary change affects other threads.
3147+
(Contributed by Serhiy Storchaka in :gh:`69998`.)
3148+
3149+
* :class:`types.UnionType` is now an alias for :class:`typing.Union`,
3150+
causing changes in some behaviors.
3151+
See :ref:`above <whatsnew314-typing-union>` for more details.
3152+
(Contributed by Jelle Zijlstra in :gh:`105499`.)
3153+
3154+
* The runtime behavior of annotations has changed in various ways; see
3155+
:ref:`above <whatsnew314-pep649>` for details. While most code that interacts
3156+
with annotations should continue to work, some undocumented details may behave
3157+
differently.
3158+
3159+
3160+
Changes in the C API
3161+
--------------------
3162+
3163+
* :c:func:`Py_Finalize` now deletes all interned strings. This
3164+
is backwards incompatible to any C extension that holds onto an interned
3165+
string after a call to :c:func:`Py_Finalize` and is then reused after a
3166+
call to :c:func:`Py_Initialize`. Any issues arising from this behavior will
3167+
normally result in crashes during the execution of the subsequent call to
3168+
:c:func:`Py_Initialize` from accessing uninitialized memory. To fix, use
3169+
an address sanitizer to identify any use-after-free coming from
3170+
an interned string and deallocate it during module shutdown.
3171+
(Contributed by Eddie Elizondo in :gh:`113601`.)
3172+
3173+
* The :ref:`Unicode Exception Objects <unicodeexceptions>` C API
3174+
now raises a :exc:`TypeError` if its exception argument is not
3175+
a :exc:`UnicodeError` object.
3176+
(Contributed by Bénédikt Tran in :gh:`127691`.)
3177+
3178+
.. _whatsnew314-refcount:
3179+
3180+
* The interpreter internally avoids some reference count modifications when
3181+
loading objects onto the operands stack by :term:`borrowing <borrowed reference>`
3182+
references when possible. This can lead to smaller reference count values
3183+
compared to previous Python versions. C API extensions that checked
3184+
:c:func:`Py_REFCNT` of ``1`` to determine if an function argument is not
3185+
referenced by any other code should instead use
3186+
:c:func:`PyUnstable_Object_IsUniqueReferencedTemporary` as a safer replacement.
3187+
3188+
3189+
* Private functions promoted to public C APIs:
3190+
3191+
* ``_PyBytes_Join()``: :c:func:`PyBytes_Join`
3192+
* ``_PyLong_IsNegative()``: :c:func:`PyLong_IsNegative`
3193+
* ``_PyLong_IsPositive()``: :c:func:`PyLong_IsPositive`
3194+
* ``_PyLong_IsZero()``: :c:func:`PyLong_IsZero`
3195+
* ``_PyLong_Sign()``: :c:func:`PyLong_GetSign`
3196+
* ``_PyUnicodeWriter_Dealloc()``: :c:func:`PyUnicodeWriter_Discard`
3197+
* ``_PyUnicodeWriter_Finish()``: :c:func:`PyUnicodeWriter_Finish`
3198+
* ``_PyUnicodeWriter_Init()``: use :c:func:`PyUnicodeWriter_Create`
3199+
* ``_PyUnicodeWriter_Prepare()``: (no replacement)
3200+
* ``_PyUnicodeWriter_PrepareKind()``: (no replacement)
3201+
* ``_PyUnicodeWriter_WriteChar()``: :c:func:`PyUnicodeWriter_WriteChar`
3202+
* ``_PyUnicodeWriter_WriteStr()``: :c:func:`PyUnicodeWriter_WriteStr`
3203+
* ``_PyUnicodeWriter_WriteSubstring()``: :c:func:`PyUnicodeWriter_WriteSubstring`
3204+
* ``_PyUnicode_EQ()``: :c:func:`PyUnicode_Equal`
3205+
* ``_PyUnicode_Equal()``: :c:func:`PyUnicode_Equal`
3206+
* ``_Py_GetConfig()``: :c:func:`PyConfig_Get` and :c:func:`PyConfig_GetInt`
3207+
* ``_Py_HashBytes()``: :c:func:`Py_HashBuffer`
3208+
* ``_Py_fopen_obj()``: :c:func:`Py_fopen`
3209+
* ``PyMutex_IsLocked()`` : :c:func:`PyMutex_IsLocked`
3210+
3211+
The `pythoncapi-compat project`_ can be used to get most of these new
3212+
functions on Python 3.13 and older.
3213+
3214+
.. _pythoncapi-compat project: https://github.com/python/pythoncapi-compat/

0 commit comments

Comments
 (0)