summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-08-04 14:16:52 (GMT)
committerGitHub <noreply@github.com>2022-08-04 14:16:52 (GMT)
commitf2926358d1cd70625222eaf4b541584d2f2a1272 (patch)
tree37ed377090939bb2f3bee77b1bdf7ed925d0a82d /Doc/whatsnew
parentc521c5cdc3f766ac5ac3574fa142aeec11c14267 (diff)
downloadcpython-f2926358d1cd70625222eaf4b541584d2f2a1272.zip
cpython-f2926358d1cd70625222eaf4b541584d2f2a1272.tar.gz
cpython-f2926358d1cd70625222eaf4b541584d2f2a1272.tar.bz2
gh-94936: C getters: co_varnames, co_cellvars, co_freevars (GH-95008)
(cherry picked from commit 42b102bbf9a9ae6fae8f6710202fb7afeeac277c) Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/3.11.rst11
1 files changed, 7 insertions, 4 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 1067982..c57f8a0 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -1724,10 +1724,13 @@ Porting to Python 3.11
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`.)
+* :c:type:`PyCodeObject` no longer has the ``co_code``, ``co_varnames``,
+ ``co_cellvars`` and ``co_freevars`` fields. Instead, use
+ :c:func:`PyCode_GetCode`, :c:func:`PyCode_GetVarnames`,
+ :c:func:`PyCode_GetCellvars` and :c:func:`PyCode_GetFreevars` respectively
+ to access them via the C API.
+ (Contributed by Brandt Bucher in :issue:`46841` and Ken Jin in :gh:`92154`
+ and :gh:`94936`.)
* The old trashcan macros (``Py_TRASHCAN_SAFE_BEGIN``/``Py_TRASHCAN_SAFE_END``)
are now deprecated. They should be replaced by the new macros