Skip to content

Commit d8104d1

Browse files
authored
What's New in Python 3.11: move C API changes (#92390)
Move C API changes to the C API > Porting to Python 3.11 section.
1 parent 7b9803f commit d8104d1

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

Doc/whatsnew/3.11.rst

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,37 +1501,6 @@ Build Changes
15011501
C API Changes
15021502
=============
15031503

1504-
* :c:func:`PyErr_SetExcInfo()` no longer uses the ``type`` and ``traceback``
1505-
arguments, the interpreter now derives those values from the exception
1506-
instance (the ``value`` argument). The function still steals references
1507-
of all three arguments.
1508-
(Contributed by Irit Katriel in :issue:`45711`.)
1509-
1510-
* :c:func:`PyErr_GetExcInfo()` now derives the ``type`` and ``traceback``
1511-
fields of the result from the exception instance (the ``value`` field).
1512-
(Contributed by Irit Katriel in :issue:`45711`.)
1513-
1514-
* :c:type:`_frozen` has a new ``is_package`` field to indicate whether
1515-
or not the frozen module is a package. Previously, a negative value
1516-
in the ``size`` field was the indicator. Now only non-negative values
1517-
be used for ``size``.
1518-
(Contributed by Kumar Aditya in :issue:`46608`.)
1519-
1520-
* :c:func:`_PyFrameEvalFunction` now takes ``_PyInterpreterFrame*``
1521-
as its second parameter, instead of ``PyFrameObject*``.
1522-
See :pep:`523` for more details of how to use this function pointer type.
1523-
1524-
* :c:func:`PyCode_New` and :c:func:`PyCode_NewWithPosOnlyArgs` now take
1525-
an additional ``exception_table`` argument.
1526-
Using these functions should be avoided, if at all possible.
1527-
To get a custom code object: create a code object using the compiler,
1528-
then get a modified version with the ``replace`` method.
1529-
1530-
* :c:type:`PyCodeObject` no longer has a ``co_code`` field. Instead,
1531-
use ``PyObject_GetAttrString(code_object, "co_code")`` or
1532-
:c:func:`PyCode_GetCode` to get the underlying bytes object.
1533-
(Contributed by Brandt Bucher in :issue:`46841` and Ken Jin in :gh:`92154`.)
1534-
15351504
New Features
15361505
------------
15371506

@@ -1598,6 +1567,37 @@ New Features
15981567
Porting to Python 3.11
15991568
----------------------
16001569

1570+
* :c:func:`PyErr_SetExcInfo()` no longer uses the ``type`` and ``traceback``
1571+
arguments, the interpreter now derives those values from the exception
1572+
instance (the ``value`` argument). The function still steals references
1573+
of all three arguments.
1574+
(Contributed by Irit Katriel in :issue:`45711`.)
1575+
1576+
* :c:func:`PyErr_GetExcInfo()` now derives the ``type`` and ``traceback``
1577+
fields of the result from the exception instance (the ``value`` field).
1578+
(Contributed by Irit Katriel in :issue:`45711`.)
1579+
1580+
* :c:type:`_frozen` has a new ``is_package`` field to indicate whether
1581+
or not the frozen module is a package. Previously, a negative value
1582+
in the ``size`` field was the indicator. Now only non-negative values
1583+
be used for ``size``.
1584+
(Contributed by Kumar Aditya in :issue:`46608`.)
1585+
1586+
* :c:func:`_PyFrameEvalFunction` now takes ``_PyInterpreterFrame*``
1587+
as its second parameter, instead of ``PyFrameObject*``.
1588+
See :pep:`523` for more details of how to use this function pointer type.
1589+
1590+
* :c:func:`PyCode_New` and :c:func:`PyCode_NewWithPosOnlyArgs` now take
1591+
an additional ``exception_table`` argument.
1592+
Using these functions should be avoided, if at all possible.
1593+
To get a custom code object: create a code object using the compiler,
1594+
then get a modified version with the ``replace`` method.
1595+
1596+
* :c:type:`PyCodeObject` no longer has a ``co_code`` field. Instead,
1597+
use ``PyObject_GetAttrString(code_object, "co_code")`` or
1598+
:c:func:`PyCode_GetCode` to get the underlying bytes object.
1599+
(Contributed by Brandt Bucher in :issue:`46841` and Ken Jin in :gh:`92154`.)
1600+
16011601
* The old trashcan macros (``Py_TRASHCAN_SAFE_BEGIN``/``Py_TRASHCAN_SAFE_END``)
16021602
are now deprecated. They should be replaced by the new macros
16031603
``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``.

0 commit comments

Comments
 (0)