FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-47084: Clear cached representations on finalization by jkloth · Pull Request #32032 · python/cpython · GitHub

Repository navigation

bpo-47084: Clear cached representations on finalization - #32032

Merged
vstinner merged 6 commits into
python:mainfrom
jkloth:issue47084
Mar 22, 2022
Merged

vstinner merged 6 commits into
python:mainfrom
jkloth:issue47084

Conversation

jkloth commented Mar 21, 2022 •
edited
Loading

Copy link
Copy Markdown
Contributor

jkloth changed the title bpo-46084: Clear cached representations on finalization bpo-47084: Clear cached representations on finalization Mar 21, 2022
Comment thread Lib/test/test_embed.py
('off', 'import __hello__'),
('on', 'import __hello__'),
)
for flag, stmt in tests:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Comment thread Objects/unicodeobject.c


void
_PyStaticUnicode_Dealloc(PyObject *op)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 merged commit 88872a2 into python:main Mar 22, 2022

Copy link
Copy Markdown
Member

Merged, thanks! Well spotted!

jkloth deleted the issue47084 branch April 5, 2022 22:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

4 participants


Back | FazBrowse Home | New Git URL