-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
no_redundant_jumps: Assertion `0' failed #120367
Comments
I have also several other code samples which trigger the same assertion like: try:
pass
except:
pass
else:
match name_2:
case b'':
pass
finally:
something let me know if you need more of them to fix the issue. (The good news is that I have only samples for this issue 😄) |
I can re-produce the same crash with f5289c4 or current main branch(7dd8c37). |
On main (e16aed6), I can reproduce the first crash but not the one given in #120367 (comment). The second one only gives me NameError on |
@picnixz sorry I that I did not post the complete example. import ast
code="""
try:
pass
except:
pass
else:
match name_2:
case b'':
pass
finally:
something
"""
tree = ast.parse(code)
for node in ast.walk(tree):
if hasattr(node,"lineno"):
del node.lineno
del node.end_lineno
del node.col_offset
del node.end_col_offset
compile(ast.fix_missing_locations(tree), "<file>", "exec") This fails for me also on main |
Oh yes, now it works (I mean, it works in its failure). |
…ring hot-cold blocks
…ring hot-cold blocks (pythonGH-120425) (cherry picked from commit 21866c8) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
@iritkatriel this fix solved most of the samples I found, but there are two samples which look similar and are still failing with the current 3.13 branch (71ad34d) import ast
source='''
if name_2:
pass
else:
try:
pass
except:
pass
~name_5
'''
tree = ast.parse(source)
for node in ast.walk(tree):
if hasattr(node, 'lineno'):
del node.lineno
ast.fix_missing_locations(tree)
compile(tree, '', 'exec') output (Python 3.13.0b2+): python: Python/flowgraph.c:511: no_redundant_jumps: Assertion `0' failed. and the second: import ast
source='''
for [] in b'':
if name_0:
pass
else:
try:
pass
except* name_0:
pass
name_2
'''
tree = ast.parse(source)
for node in ast.walk(tree):
if hasattr(node, 'lineno'):
del node.lineno
ast.fix_missing_locations(tree)
compile(tree, '', 'exec') output (Python 3.13.0b2+): python: Python/flowgraph.c:511: no_redundant_jumps: Assertion `0' failed. Can you take a look at it? |
I see, what's happening is that we get:
The jump is not identified as redundant because of the (The jump would not be redundant if it, as well as the |
…pseudo op replacement (pythonGH-120714) (cherry picked from commit b7f4789) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
…ring hot-cold blocks (python#120425)
…pseudo op replacement (python#120714)
…ring hot-cold blocks (python#120425)
…pseudo op replacement (python#120714)
…ring hot-cold blocks (python#120425)
…pseudo op replacement (python#120714)
Bug report
Bug description:
The following code causes a crash on cpython 3.13 branch (f5289c4) and the current main.
output (Python 3.13.0a3+):
I bisected the problem down to 2091fb2.
@iritkatriel can you take a look at it?
CPython versions tested on:
3.13, CPython main branch
Operating systems tested on:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: