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

bpo-47084: Clear cached representations on finalization #32032

Merged
merged 6 commits into from Mar 22, 2022

Conversation

jkloth
Copy link
Contributor

@jkloth jkloth commented Mar 21, 2022

@jkloth jkloth changed the title bpo-46084: Clear cached representations on finalization bpo-47084: Clear cached representations on finalization Mar 21, 2022
('off', 'import __hello__'),
('on', 'import __hello__'),
)
for flag, stmt in tests:
Copy link
Member

Choose a reason for hiding this comment

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

Can you please use with self.subTest(flag=flag, stmt=stmt):? Otherwise, it will be more complicated to debug if a test fails. With that, you can omit f"{xopt}, stmt='{stmt}' -> {out}") below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't know about TestCase.subTest(), thanks.



void
_PyStaticUnicode_Dealloc(PyObject *op)
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to share code between this function and unicode_dealloc()? Maybe add an unicode_dealloc_common() function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there is the duplication of the PyObect_Free() calls, but not really to the level of what I would consider "in common". I did, however, refactor out the duplication of the 1-character singletons and frozen strings deallocation into a standalone static function.

@vstinner vstinner merged commit 88872a2 into python:main Mar 22, 2022
@vstinner
Copy link
Member

Merged, thanks! Well spotted!

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

Successfully merging this pull request may close these issues.

None yet

4 participants