-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-95756: Lazily created cached co_* attrs #97791
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
Note that these were all O(1) in 3.10. This restores their behavior. They also previously returned just incref of a cache. |
I'd like to reduce the size of code objects for a few reasons. PEP 649 will create lots of small code objects and we want multiple interpreters to share as much data as possible. |
I'm merging this, as we can add the line array, and any other tables needed in unusual cases, to the |
When you're done making the requested changes, leave the comment: |
if (*cached_field != NULL) { | ||
return Py_NewRef(*cached_field); | ||
} | ||
assert(*cached_field == NULL); |
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.
No need to assert this. The test two lines above ensures that it is true.
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.
One assert that could be removed, but it's harmless.
I'll leave the assert in since it communicates some info should the code change in the future. And like you mentioned it's harmless anyways. |
|
I'm confused. Why is this the only buildbot failing? In any case I might revert this within 24 hours. |
I created #98178 about this crash. It seems to be specific to macOS and unrelated to your change. If your change would introduce a bug, more tests would crash on more platforms. |
As long as these aren't accessed, they don't actually consume additional space over 3.11.