bpo-44964: Correct the note about the f_lasti field (GH-28208) (GH-28276)

(cherry picked from commit ab327f2929)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
Miss Islington (bot) 2021-09-10 09:16:51 -07:00 committed by Pablo Galindo
parent 9d8a64a7cc
commit 490a7427dc
No known key found for this signature in database
GPG key ID: FFE87404168BD847
2 changed files with 4 additions and 4 deletions

View file

@ -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"``.

View file

@ -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
========================