You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
List comprehensions cause subinterpreter crashes #135450
If you use any list comprehension inside a subinterpreter (either through _interpreters or through interpreters), an assertion fails in _PyCode_CheckNoExternalState:
import_interpretersinterp=_interpreters.create()
_interpreters.run_string(interp, "[None for _ in []]")
This was originally causing failures in #134606. I think that assertion can be removed, because _PyCode_CheckNoExternalState seems to have no need for the number of hidden locals being zero.
I added that assertion with the gut instinct that we'd have to remove it. It just wasn't clear to me at the time where to expect hidden variables relative to "external" state in a code object. Comprehensions make sense. Thanks for identifying this.
Ok, yeah, that makes sense. I kept staring at that assertion trying to figure out why the function wanted that as a precondition. Thanks for the insight!
Activity
ericsnowcurrently commentedon Jun 13, 2025
I added that assertion with the gut instinct that we'd have to remove it. It just wasn't clear to me at the time where to expect hidden variables relative to "external" state in a code object. Comprehensions make sense. Thanks for identifying this.
ZeroIntensity commentedon Jun 13, 2025
Ok, yeah, that makes sense. I kept staring at that assertion trying to figure out why the function wanted that as a precondition. Thanks for the insight!
gh-135450: Remove assertion in `_PyCode_CheckNoExternalState` (gh-135466
pythongh-135450: Remove assertion in `_PyCode_CheckNoExternalState` (p…
[3.14] gh-135450: Remove assertion in `_PyCode_CheckNoExternalState` (g…
ericsnowcurrently commentedon Jun 19, 2025
Thanks for the fix, @ZeroIntensity.
pythongh-135450: Remove assertion in `_PyCode_CheckNoExternalState` (p…
pythongh-135450: Remove assertion in `_PyCode_CheckNoExternalState` (p…
pythongh-135450: Remove assertion in `_PyCode_CheckNoExternalState` (p…
pythongh-135450: Remove assertion in `_PyCode_CheckNoExternalState` (p…