8000 gh-117398: datetime: Access C-API via `PyInterpreterState` by neonene · Pull Request #118357 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-117398: datetime: Access C-API via PyInterpreterState #118357

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

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
run main interp twice in test
  • Loading branch information
neonene committed Apr 30, 2024
commit 39e17c72359fb53cbdf17e7188480a37ce6fecb8
1 change: 1 addition & 0 deletions Lib/test/test_capi/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2295,6 +2295,7 @@ def test_datetime_capi_client(self):
spec.loader.exec_module(module)
""")
exec(script) # run main interp first
exec(script) # run main interp twice
ret = support.run_in_subinterp(script)
self.assertEqual(ret, 0)

Expand Down
2 changes: 1 addition & 1 deletion Modules/_testmultiphase.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ datetime_capi_import_with_error(void)
{
static int is_datetime_multiphase = -1;
int ismain = PyInterpreterState_Get() == PyInterpreterState_Main();
if (ismain) {
if (ismain && is_datetime_multiphase < 0) {
PyObject *module = PyImport_ImportModule("_datetime");
if (module == NULL) {
return -1;
Expand Down
Loading
0