diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-09-10 16:16:51 (GMT) |
---|---|---|
committer | Pablo Galindo <pablogsal@gmail.com> | 2021-09-29 11:34:08 (GMT) |
commit | 490a7427dce1cba55a9fbdbccd092e4c8ffae05f (patch) | |
tree | 2d401bee316e534d62b13d75672da70694a11757 | |
parent | 9d8a64a7ccebb288094d4e9da66f30d2ada9a973 (diff) | |
download | cpython-490a7427dce1cba55a9fbdbccd092e4c8ffae05f.zip cpython-490a7427dce1cba55a9fbdbccd092e4c8ffae05f.tar.gz cpython-490a7427dce1cba55a9fbdbccd092e4c8ffae05f.tar.bz2 |
bpo-44964: Correct the note about the f_lasti field (GH-28208) (GH-28276)
(cherry picked from commit ab327f2929589407595a3de95727c8ab34ddd4af)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
-rw-r--r-- | Doc/reference/datamodel.rst | 5 | ||||
-rw-r--r-- | Doc/whatsnew/3.10.rst | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index dd3d509..310167e 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1034,9 +1034,8 @@ Internal types :attr:`f_code` is the code object being executed in this frame; :attr:`f_locals` is the dictionary used to look up local variables; :attr:`f_globals` is used for global variables; :attr:`f_builtins` is used for built-in (intrinsic) names; - :attr:`f_lasti` gives the precise instruction (it represents a wordcode index, which - means that to get an index into the bytecode string of the code object it needs to be - multiplied by 2). + :attr:`f_lasti` gives the precise instruction (this is an index into the + bytecode string of the code object). Accessing ``f_code`` raises an :ref:`auditing event <auditing>` ``object.__getattr__`` with arguments ``obj`` and ``"f_code"``. diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index e76c761..c11fe41 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -1959,7 +1959,8 @@ Changes in the C API offset instead of a simple offset into the bytecode string. This means that this number needs to be multiplied by 2 to be used with APIs that expect a byte offset instead (like :c:func:`PyCode_Addr2Line` for example). Notice as well that the - ``f_lasti`` member of ``FrameObject`` objects is not considered stable. + ``f_lasti`` member of ``FrameObject`` objects is not considered stable: please + use :c:func:`PyFrame_GetLineNumber` instead. CPython bytecode changes ======================== |