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
Parser crash #43965
Comments
The code def x(((y))):pass crashes the compiler (?) in 2.5c2, on Windows. |
Logged In: YES The problem is in Python/ast.c around line 666. See the /* def foo((x)): setup for checking NAME below. */ The code is not sufficient, we need a loop and need to def f(((((x))),)),))): pass I don't know if the parens above match, but the general idea |
Logged In: YES I guess what 2.4 does is the most reasonable behavior: >>> def f((((((x)),),),)): pass
>>> dis.dis(f)
1 0 LOAD_FAST 0 (.0)
3 UNPACK_SEQUENCE 1
6 UNPACK_SEQUENCE 1
9 UNPACK_SEQUENCE 1
12 STORE_FAST 1 (x)
15 LOAD_CONST 0 (None)
18 RETURN_VALUE |
Logged In: YES The attached patch seems to fix the ((((x)))) problem. I However now my test case below doesn't work, it puts in 5 Not sure how much farther I'll get tonight. |
Logged In: YES I think patch v2 might fix both problems. I'm not sure it's |
Logged In: YES Attaching a new patch with tests. There probably should be Conceptually this is a very small patch. I've added a bunch The first chunk deals with complex_args and elides I will apply to head and 2.5.1 later. |
Logged In: YES Committed revision 51972. (2.6) |
Logged In: YES Backported in rev. 51999. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: