-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-44964: Add a note explaining the new semantics of f_last_i in frame objects #28200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
…me objects (pythonGH-28200) (cherry picked from commit fa2c0b8) Co-authored-by: Pablo Galindo Salgado <[email protected]>
GH-28202 is a backport of this pull request to the 3.10 branch. |
…me objects (GH-28200) (cherry picked from commit fa2c0b8) Co-authored-by: Pablo Galindo Salgado <[email protected]>
@@ -1069,8 +1069,9 @@ 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 (this is an index into the | |||
bytecode string of the code object). | |||
:attr:`f_lasti` gives the precise instruction (it represents a wordcode index, which |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect. f_lasti is the index in the bytecode. No need to multiply by two.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #28208
@@ -1948,6 +1948,12 @@ Changes in the C API | |||
source_buf = PyBytes_AsString(source_bytes_object); | |||
code = Py_CompileString(source_buf, filename, Py_file_input); | |||
|
|||
* For ``FrameObject`` objects, the ``f_lasti`` member now represents a wordcode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a note to use PyFrame_GetLineNumber() instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #28208
https://bugs.python.org/issue44964