8000 gh-115490: Make the interpreter.channels and interpreter.queues Modules Handle Reloading Properly by ericsnowcurrently · Pull Request #115493 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-115490: Make the interpreter.channels and interpreter.queues Modules Handle Reloading Properly #115493

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

Merged

Conversation

ericsnowcurrently
Copy link
Member
@ericsnowcurrently ericsnowcurrently commented Feb 14, 2024

The problem manifested when the .py module got reloaded and the corresponding extension module didn't. The .py module registers types with the extension and the extension was not allowing that to happen more than once. The solution: let it happen more than once.

Copy link
Member
@encukou encukou left a comment

Choose a reason for hiding this comment

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

This looks good to me, though I'm not too familiar with the details here.

@encukou
Copy link
Member
encukou commented Feb 15, 2024

I see comments about doing unregistration via weakref or removing the registry altogether, both of which I thought about before noticing the comments:

// XXX Assign a callback to clear the entry from the registry?

/* For now we use a global registry of shareable classes.  An
alternative would be to add a tp_* slot for a class's
crossinterpdatafunc. It would be simpler and more efficient.  */

Is there a reason for not doing one of these now?
It definitely shouldn't block the PR.

@Yhg1s
Copy link
Member
Yhg1s commented Feb 15, 2024

This... is a lot of change to fix a test failure caused by the shenanigans our testing framework does. I'd rather not rush this in right before a release, even an alpha release. A change like this needs time to bake so repeated runs and all the different buildbots get a chance to find issues.

I'll make a separate change to just special-case test.support.interpreters in libregrtest's sys.modules cleanup, we can roll it back after this goes in.

@Yhg1s
Copy link
Member
Yhg1s commented Feb 15, 2024

#115515 is the temporary workaround.

@ericsnowcurrently
Copy link
Member Author

FYI, I've cut out the extra cleanup code.

@gpshead
Copy link
Member
gpshead commented Feb 16, 2024

shouldn't we add an explicit test case for this behavior? (a single test that reloads the modules leading to the problem perhaps?)

@ericsnowcurrently ericsnowcurrently enabled auto-merge (squash) March 4, 2024 19:50
@ericsnowcurrently ericsnowcurrently merged commit eb22e2b into python:main Mar 4, 2024
@ericsnowcurrently ericsnowcurrently deleted the fix-registered-xid-types branch March 4, 2024 21:03
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 25, 2024
… Modules Handle Reloading Properly (pythongh-115493)

The problem manifested when the .py module got reloaded and the corresponding extension module didn't. The .py module registers types with the extension and the extension was not allowing that to happen more than once. The solution: let it happen more than once.
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
… Modules Handle Reloading Properly (pythongh-115493)

The problem manifested when the .py module got reloaded and the corresponding extension module didn't. The .py module registers types with the extension and the extension was not allowing that to happen more than once. The solution: let it happen more than once.
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
0