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-98522: Add version number to code objects, to provide better version numbers for closures and comprehensions. #98525

Merged
merged 6 commits into from
Dec 9, 2022

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Oct 21, 2022

Measured performance impact might be positive but is too close to noise to be meaningful.

@markshannon markshannon changed the title Add version number to code objects, to provide better version numbers for closures and comprehensions. GH-98522: Add version number to code objects, to provide better version numbers for closures and comprehensions. Oct 21, 2022
@brandtbucher brandtbucher self-requested a review November 18, 2022 21:02
@@ -472,6 +472,8 @@ typedef struct _PyShimCodeDef {
extern PyCodeObject *
_Py_MakeShimCode(const _PyShimCodeDef *code);

extern uint32_t _Py_next_func_version;
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why this is called func_version and not code_version? I find it a bit confusing (note that in deepfreeze.py we now have _Py_next_func_version = {next_code_version}).

Copy link
Member Author

Choose a reason for hiding this comment

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

It is primarily used as the version for functions.
https://github.com/python/cpython/blob/main/Python/bytecodes.c#L2976
Caching it in the code object is a further optimization.

@netlify
Copy link

netlify bot commented Dec 9, 2022

Deploy Preview for python-cpython-preview canceled.

Name Link
🔨 Latest commit 2ab0453
🔍 Latest deploy log https://app.netlify.com/sites/python-cpython-preview/deploys/6393165aa529f10008d886cf

@markshannon
Copy link
Member Author

Address sanitizer test failing itself because its too slow 🤨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants