GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-47084: Clear cached representations on finalization by jkloth · Pull Request #32032 · python/cpython

Conversation

@jkloth

@jkloth jkloth commented Mar 21, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

https://bugs.python.org/issue47084

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jkloth
Clear cached representations on finalization
4b166f0
@bedevere-bot bedevere-bot added the awaiting review label Mar 21, 2022
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label 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
jkloth added 2 commits March 21, 2022 13:21
@jkloth
Merge branch 'main' of https://github.com/python/cpython into issue47084
7d66a24
@jkloth
Also reset representation lengths on finalization
7a4b788
vstinner
vstinner reviewed Mar 21, 2022
View reviewed changes
Comment thread Lib/test/test_embed.py
('off', 'import __hello__'),
('on', 'import __hello__'),
)
for flag, stmt in tests:

@vstinner vstinner Mar 21, 2022

Copy link
Copy Markdown
Member

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.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jkloth jkloth Mar 21, 2022

Copy link
Copy Markdown
Contributor Author

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.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Objects/unicodeobject.c


void
_PyStaticUnicode_Dealloc(PyObject *op)

@vstinner vstinner Mar 21, 2022

Copy link
Copy Markdown
Member

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.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jkloth jkloth Mar 21, 2022

Copy link
Copy Markdown
Contributor Author

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.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
jkloth added 3 commits March 21, 2022 15:37
@jkloth
Merge branch 'main' of https://github.com/python/cpython into issue47084
08c0999
@jkloth
Use TestCase.subTest() for per-iteration testing
55163a2
@jkloth
Refactor dealloc into single function.
72f50c3
What started out as different behavior for each type ended up
being identical after edge cases were discovered.
@vstinner vstinner added the skip news label Mar 22, 2022
@vstinner
vstinner merged commit 88872a2 into python:main Mar 22, 2022
@bedevere-bot bedevere-bot removed the awaiting review label Mar 22, 2022
@vstinner

vstinner commented Mar 22, 2022

Copy link
Copy Markdown
Member

Merged, thanks! Well spotted!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jkloth
jkloth deleted the issue47084 branch April 5, 2022 22:28
@gvanrossum gvanrossum mentioned this pull request Aug 31, 2022
_PyStaticUnicode_Dealloc should not exist. #96458
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@jkloth @vstinner @the-knights-who-say-ni @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.