summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorAlex Waygood <Alex.Waygood@Gmail.com>2023-12-06 22:11:53 (GMT)
committerGitHub <noreply@github.com>2023-12-06 22:11:53 (GMT)
commitca11aec98c39a08da858a1270b13b7e3ae6aa53b (patch)
tree7cc5299f8a01e2ab3d3c5876dcaab2dba857ca34 /Doc/whatsnew
parentaf7cf385a2394895d93a11b02934c529eafce83c (diff)
downloadcpython-ca11aec98c39a08da858a1270b13b7e3ae6aa53b.zip
cpython-ca11aec98c39a08da858a1270b13b7e3ae6aa53b.tar.gz
cpython-ca11aec98c39a08da858a1270b13b7e3ae6aa53b.tar.bz2
[3.12] gh-101100: Improve documentation of code object attributes (#112781) (#112816)
(cherry-picked from commit e9707d3c3d)
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/2.7.rst2
-rw-r--r--Doc/whatsnew/3.10.rst3
-rw-r--r--Doc/whatsnew/3.12.rst5
-rw-r--r--Doc/whatsnew/3.6.rst7
4 files changed, 10 insertions, 7 deletions
diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst
index 92de3e4..9207051 100644
--- a/Doc/whatsnew/2.7.rst
+++ b/Doc/whatsnew/2.7.rst
@@ -2405,7 +2405,7 @@ Other Changes and Fixes
:issue:`5464`.)
* When importing a module from a :file:`.pyc` or :file:`.pyo` file
- with an existing :file:`.py` counterpart, the :attr:`co_filename`
+ with an existing :file:`.py` counterpart, the :attr:`~codeobject.co_filename`
attributes of the resulting code objects are overwritten when the
original filename is obsolete. This can happen if the file has been
renamed, moved, or is accessed through different paths. (Patch by
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index 8854dd2..ad25e16 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -402,7 +402,8 @@ Tracing events, with the correct line number, are generated for all lines of cod
The :attr:`~frame.f_lineno` attribute of frame objects will always contain the
expected line number.
-The ``co_lnotab`` attribute of code objects is deprecated and will be removed in 3.12.
+The :attr:`~codeobject.co_lnotab` attribute of code objects is deprecated and
+will be removed in 3.12.
Code that needs to convert from offset to line number should use the new ``co_lines()`` method instead.
PEP 634: Structural Pattern Matching
diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst
index a7626d7..c79f2e7 100644
--- a/Doc/whatsnew/3.12.rst
+++ b/Doc/whatsnew/3.12.rst
@@ -1323,7 +1323,8 @@ Deprecated
``int``, convert to int explicitly: ``~int(x)``. (Contributed by Tim Hoffmann
in :gh:`103487`.)
-* Accessing ``co_lnotab`` on code objects was deprecated in Python 3.10 via :pep:`626`,
+* Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in
+ Python 3.10 via :pep:`626`,
but it only got a proper :exc:`DeprecationWarning` in 3.12,
therefore it will be removed in 3.14.
(Contributed by Nikita Sobolev in :gh:`101866`.)
@@ -1430,7 +1431,7 @@ and will be removed in Python 3.14.
* The ``__package__`` and ``__cached__`` attributes on module objects.
-* The ``co_lnotab`` attribute of code objects.
+* The :attr:`~codeobject.co_lnotab` attribute of code objects.
Pending Removal in Python 3.15
------------------------------
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
index e910f74..71e9e74 100644
--- a/Doc/whatsnew/3.6.rst
+++ b/Doc/whatsnew/3.6.rst
@@ -2160,14 +2160,15 @@ Changes in the Python API
* :c:func:`PyErr_SetImportError` now sets :exc:`TypeError` when its **msg**
argument is not set. Previously only ``NULL`` was returned.
-* The format of the ``co_lnotab`` attribute of code objects changed to support
+* The format of the :attr:`~codeobject.co_lnotab` attribute of code objects
+ changed to support
a negative line number delta. By default, Python does not emit bytecode with
a negative line number delta. Functions using :attr:`frame.f_lineno`,
``PyFrame_GetLineNumber()`` or ``PyCode_Addr2Line()`` are not affected.
- Functions directly decoding ``co_lnotab`` should be updated to use a signed
+ Functions directly decoding :attr:`!co_lnotab` should be updated to use a signed
8-bit integer type for the line number delta, but this is only required to
support applications using a negative line number delta. See
- ``Objects/lnotab_notes.txt`` for the ``co_lnotab`` format and how to decode
+ ``Objects/lnotab_notes.txt`` for the :attr:`!co_lnotab` format and how to decode
it, and see the :pep:`511` for the rationale.
* The functions in the :mod:`compileall` module now return booleans instead