GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||
GeezerVison is showing github.com — bpo-40077: Convert _abc module to use PyType_FromSpec() by corona10 · Pull Request #19202 · python/cpython Conversation
|
| negative cache to be cleared before its next use. | ||
| Note: this counter is private. Use `abc.get_cache_token()` for | ||
| external code. */ | ||
| static unsigned long long abc_invalidation_counter = 0; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that the abc_invalidation_counter is okay to be shared as static from interpreter Isolation point of view.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Should we move this into PyInterpreterState?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It seems like it would be safe to put it in the module state. The purpose of the counter is to invalidate the module cache. Registering a class in module instance 1 should not invalidate module instance 2. What do you think?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I agree, I 've updated the PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This test might be what we wanted exactly.
I just updated the test for more validation.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It seems like you cannot access to the module state in abc_data_new() which prevents you to move abc_invalidation_counter into the module state :-(
I suggest to leave abc_invalidation_counter as a "static" variable, but please add a FIXME like:
/* FIXME: PEP 573: Move abc_invalidation_counter into _abcmodule_state */
It's safe to keep it as a static variable until each interpreter gets its own GIL.
Until it happens, the change should move the module closer to the goal of isolated interpreters.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@vstinner
Thanks for the review.
PEP 573: Move abc_invalidation_counter into _abcmodule_state.
I agree, PEP 573 will solve this issue.
I 've updated the PR. Please take a look.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-Authored-By: Victor Stinner <[email protected]>
|
@vstinner Updated! Please take a look |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Sorry, just one last change request, I promise ;-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks, I merged your PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.