-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
gh-142414: Remove singleton design pattern in Lib/concurrent/interpreters/_crossinterp.py. #142577
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
base: main
Are you sure you want to change the base?
Conversation
…est_interpreter_pool"
…THgP-.rst Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
| self.assertStartsWith(self.executor.submit(get_thread_name).result(), | ||
| "InterpreterPoolExecutor-"[:15]) | ||
|
|
||
| def test_cross_interpreter_unbound_identity(self): |
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.
FYI @ZeroIntensity This test will fail if we make the UNBOUND an object().
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.
What is this testing for? _queues.UNBOUND is not a public interface.
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.
It's defined under __all__, I guess it's okay to use?
__all__ = [
'UNBOUND', 'UNBOUND_ERROR', 'UNBOUND_REMOVE',
'create', 'list_all',
'Queue',
'QueueError', 'QueueNotFoundError', 'QueueEmpty', 'QueueFull',
'ItemInterpreterDestroyed',
]
This test verifies the object is consistent across interpreters.
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.
It's defined under __all__, but as far as I can tell, it's not exported to concurrent.interpreters, so the only way to access it is through the private API.
Generally speaking, I believe UNBOUND is supposed to be a sentinel that doesn't need a consistent state across interpreters. Do you have a case in mind where it would be useful to share UNBOUND?
We don't need to make singleton picklabe based on the current tests.
2b1d0f1 to
b128769
Compare
Test with
./python -m test test_interpreters test_struct./python -m test test_interpreters test_concurrent_futures.test_interpreter_pool./python -m test test_interpreters test_structfails with: KeyError: concurrent.interpreters._queues.UNBOUND #142414