-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-136421: Load _datetime
static types during interpreter initialization
#136583
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
Changes from 1 commit
77d117c
963a9ee
e16fb54
ed65682
43b4843
0ad304f
d762ed5
db327e7
9456147
6adafa1
6e2f891
a15843f
d6064c4
9a3b1c2
3520514
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3651,6 +3651,35 @@ def test_repr_subclass(self): | |
td = SubclassDatetime(2010, 10, 2, second=3) | ||
self.assertEqual(repr(td), "SubclassDatetime(2010, 10, 2, 0, 0, 3)") | ||
|
||
@support.cpython_only | ||
def test_concurrent_initialization(self): | ||
try: | ||
from concurrent.futures import InterpreterPoolExecutor as _ | ||
except ImportError: | ||
self.skipTest("requires subinterpreters") | ||
|
||
try: | ||
import _datetime as _ | ||
except ImportError: | ||
self.skipTest("requires C implementation of datetime") | ||
|
||
# Run in a subprocess to ensure we get a clean version of _datetime | ||
script = """if True: | ||
from concurrent.futures import InterpreterPoolExecutor | ||
|
||
def func(): | ||
import _datetime | ||
print('a', end='') | ||
|
||
with InterpreterPoolExecutor() as executor: | ||
for _ in range(8): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eh, I think this is fine. Many other systems have 8 cores, not 10. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, but it sounds like you are talking about the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
executor.submit(func) | ||
""" | ||
rc, out, err = script_helper.assert_python_ok("-c", script) | ||
self.assertEqual(rc, 0) | ||
self.assertEqual(out, b"a" * 8) | ||
self.assertEqual(err, b"") | ||
|
||
|
||
class TestSubclassDateTime(TestDateTime): | ||
theclass = SubclassDatetime | ||
|
Uh oh!
There was an error while loading. Please reload this page.