Skip to content

Commit b029dd5

Browse files
committed
Avoid using list comprehensions in the tests.
These cause crashes due to an existing bug with subinterpreters.
1 parent 62bd653 commit b029dd5

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Lib/test/test_interpreters/test_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ def task():
725725
time.sleep(1)
726726
os.write({w_interp}, {FINISHED!r})
727727
728-
threads = [threading.Thread(target=task) for _ in range(3)]
728+
threads = (threading.Thread(target=task) for _ in range(3))
729729
for t in threads:
730730
t.start()
731731
""")
@@ -759,7 +759,7 @@ def test_remaining_daemon_threads(self):
759759
def task():
760760
time.sleep(3)
761761
762-
threads = [threading.Thread(target=task, daemon=True) for _ in range(3)]
762+
threads = (threading.Thread(target=task, daemon=True) for _ in range(3))
763763
for t in threads:
764764
t.start()
765765
""")

Objects/codeobject.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,9 +1979,7 @@ _PyCode_CheckNoExternalState(PyCodeObject *co, _PyCode_var_counts_t *counts,
19791979
const char **p_errmsg)
19801980
{
19811981
const char *errmsg = NULL;
1982-
// Why is it an assumption that there can't be any hidden
1983-
// locals?
1984-
//assert(counts->locals.hidden.total == 0);
1982+
assert(counts->locals.hidden.total == 0);
19851983
if (counts->numfree > 0) { // It's a closure.
19861984
errmsg = "closures not supported";
19871985
}

0 commit comments

Comments
 (0)