From d8104d13cd80737f5efe1cd94aeec5979f912cd0 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 9 May 2022 12:40:56 +0200 Subject: 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. --- Doc/whatsnew/3.11.rst | 62 +++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 793c92a..ab760d1 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -1501,37 +1501,6 @@ Build Changes C API Changes ============= -* :c:func:`PyErr_SetExcInfo()` no longer uses the ``type`` and ``traceback`` - arguments, the interpreter now derives those values from the exception - instance (the ``value`` argument). The function still steals references - of all three arguments. - (Contributed by Irit Katriel in :issue:`45711`.) - -* :c:func:`PyErr_GetExcInfo()` now derives the ``type`` and ``traceback`` - fields of the result from the exception instance (the ``value`` field). - (Contributed by Irit Katriel in :issue:`45711`.) - -* :c:type:`_frozen` has a new ``is_package`` field to indicate whether - or not the frozen module is a package. Previously, a negative value - in the ``size`` field was the indicator. Now only non-negative values - be used for ``size``. - (Contributed by Kumar Aditya in :issue:`46608`.) - -* :c:func:`_PyFrameEvalFunction` now takes ``_PyInterpreterFrame*`` - as its second parameter, instead of ``PyFrameObject*``. - See :pep:`523` for more details of how to use this function pointer type. - -* :c:func:`PyCode_New` and :c:func:`PyCode_NewWithPosOnlyArgs` now take - an additional ``exception_table`` argument. - Using these functions should be avoided, if at all possible. - To get a custom code object: create a code object using the compiler, - then get a modified version with the ``replace`` method. - -* :c:type:`PyCodeObject` no longer has a ``co_code`` field. Instead, - use ``PyObject_GetAttrString(code_object, "co_code")`` or - :c:func:`PyCode_GetCode` to get the underlying bytes object. - (Contributed by Brandt Bucher in :issue:`46841` and Ken Jin in :gh:`92154`.) - New Features ------------ @@ -1598,6 +1567,37 @@ New Features Porting to Python 3.11 ---------------------- +* :c:func:`PyErr_SetExcInfo()` no longer uses the ``type`` and ``traceback`` + arguments, the interpreter now derives those values from the exception + instance (the ``value`` argument). The function still steals references + of all three arguments. + (Contributed by Irit Katriel in :issue:`45711`.) + +* :c:func:`PyErr_GetExcInfo()` now derives the ``type`` and ``traceback`` + fields of the result from the exception instance (the ``value`` field). + (Contributed by Irit Katriel in :issue:`45711`.) + +* :c:type:`_frozen` has a new ``is_package`` field to indicate whether + or not the frozen module is a package. Previously, a negative value + in the ``size`` field was the indicator. Now only non-negative values + be used for ``size``. + (Contributed by Kumar Aditya in :issue:`46608`.) + +* :c:func:`_PyFrameEvalFunction` now takes ``_PyInterpreterFrame*`` + as its second parameter, instead of ``PyFrameObject*``. + See :pep:`523` for more details of how to use this function pointer type. + +* :c:func:`PyCode_New` and :c:func:`PyCode_NewWithPosOnlyArgs` now take + an additional ``exception_table`` argument. + Using these functions should be avoided, if at all possible. + To get a custom code object: create a code object using the compiler, + then get a modified version with the ``replace`` method. + +* :c:type:`PyCodeObject` no longer has a ``co_code`` field. Instead, + use ``PyObject_GetAttrString(code_object, "co_code")`` or + :c:func:`PyCode_GetCode` to get the underlying bytes object. + (Contributed by Brandt Bucher in :issue:`46841` and Ken Jin in :gh:`92154`.) + * The old trashcan macros (``Py_TRASHCAN_SAFE_BEGIN``/``Py_TRASHCAN_SAFE_END``) are now deprecated. They should be replaced by the new macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``. -- cgit v0.12