Skip to content

gh-128639: Don't assume one thread in subinterpreter finalization with fixed daemon thread support #134606

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Prev Previous commit
Avoid using list comprehensions in the tests.
These cause crashes due to an existing bug with subinterpreters.
  • Loading branch information
ZeroIntensity committed Jun 13, 2025
commit b029dd57f9c5cdbf2f99eb75c2ac86eaac80f94f
4 changes: 2 additions & 2 deletions Lib/test/test_interpreters/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ def task():
time.sleep(1)
os.write({w_interp}, {FINISHED!r})

threads = [threading.Thread(target=task) for _ in range(3)]
threads = (threading.Thread(target=task) for _ in range(3))
for t in threads:
t.start()
""")
Expand Down Expand Up @@ -759,7 +759,7 @@ def test_remaining_daemon_threads(self):
def task():
time.sleep(3)

threads = [threading.Thread(target=task, daemon=True) for _ in range(3)]
threads = (threading.Thread(target=task, daemon=True) for _ in range(3))
for t in threads:
t.start()
""")
Expand Down
4 changes: 1 addition & 3 deletions Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1979,9 +1979,7 @@ _PyCode_CheckNoExternalState(PyCodeObject *co, _PyCode_var_counts_t *counts,
const char **p_errmsg)
{
const char *errmsg = NULL;
// Why is it an assumption that there can't be any hidden
// locals?
//assert(counts->locals.hidden.total == 0);
assert(counts->locals.hidden.total == 0);
if (counts->numfree > 0) { // It's a closure.
errmsg = "closures not supported";
}
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy