Skip to content
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

gh-100720: refactor calculation of number of frame slots for a code object into the new function _PyFrame_NumSlotsForCodeObject #100722

Merged
merged 8 commits into from
Jan 4, 2023

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Jan 3, 2023

…code object into the new function _PyCode_GetNumFrameSlots
@iritkatriel iritkatriel added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Jan 3, 2023
Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but let's ask @markshannon.

Objects/codeobject.c Outdated Show resolved Hide resolved
Objects/codeobject.c Outdated Show resolved Hide resolved
Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I think _PyCode_GetNumFrameSlots should be an inline function.

@@ -1520,6 +1520,15 @@ PyCode_GetFreevars(PyCodeObject *code)
return _PyCode_GetFreevars(code);
}

int
_PyCode_GetNumFrameSlots(PyCodeObject *code)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a static inline function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I also think it belongs in pycore_frame.h rather than pycore_code.h.

@iritkatriel iritkatriel changed the title gh-100720: refactor calculation of number of frame slots for a code object into the new function _PyCode_GetNumFrameSlots gh-100720: refactor calculation of number of frame slots for a code object into the new function _PyFrame_NumSlotsForCodeObject Jan 4, 2023
@iritkatriel iritkatriel merged commit c31e356 into python:main Jan 4, 2023
@iritkatriel iritkatriel deleted the num_registers branch July 25, 2023 18:08
@iritkatriel iritkatriel restored the num_registers branch July 25, 2023 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add _PyFrame_NumSlotsForCodeObject()
4 participants