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
Bugs of the new AST compiler #42508
Comments
The newly merged AST branch is likely to expose |
Logged In: YES A scoping problem (comparing with the old compiler): class X:
print hello The variable 'hello' is incorrectly looked up with |
Logged In: YES import a as b, c the 'c' part gets completely forgotten and there is |
Logged In: YES any reason why lambda functions have a __name__ of |
Logged In: YES For reference, an optimization that got lost: def f():
'a'
'b' 'a' is the docstring, but the 'b' previously did not show |
Logged In: YES The Python rules about which names get mangled are a bit >>> def f():
... __x = 5
... class X:
... def g(self):
... return __x
... return X
...
Fatal Python error: unknown scope for _X__x in X(135832776)
in <stdin> |
Logged In: YES I would suspect the following one to be due to incorrect longexpr = 'x = x or ' + '-x' * 2500
code = '''
def f(x):
%s
%s
%s
%s
%s
%s
%s
%s
%s
%s
while x:
x -= 1
# EXTENDED_ARG/JUMP_ABSOLUTE here
return x
''' % ((longexpr,)*10) exec code dis.dis() shows that the target of both the SETUP_LOOP and |
Logged In: YES The following (similarly strange-looking) code snippets -------------------- def f():
class g:
exec "hi"
x
--------------------
def f(x):
class g:
exec "hi"
x
--------------------
def f():
class g:
from a import *
x
--------------------
def f(x):
class g:
from a import *
x |
Logged In: YES I assigned to Jeremy and Neil in the hopes they will see |
Logged In: YES FWIW, here are the warnings issued by my compiler: Python-ast.c compile.c |
Logged In: YES Checkpoint of outstanding issues. I think all the others
|
Logged In: YES At rev 41584, the following code snippet triggers an assert ----------------------- |
Logged In: YES I just checked Armin's problem code on rev. 41638 and it |
Logged In: YES You have to include those lines in a source file. It still crashes for me. |
Logged In: YES EXTENDED_ARG problem was fixed a while ago. That leaves the LOAD_CONST/POP_TOP optimization that was |
Logged In: YES We found another one. Something is wrong in the compilation of augmented class C:
def __setitem__(self, i, v):
print i, v
def __getitem__(self, i):
print i
return 0
c = C()
c[4,5] += 1 gives a spurious exception: Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object does not support item assignment By contrast, "c[(4,5)] += 1" works fine. |
Logged In: YES Subscripting is generally a bit sloppy: e.g. the AST model has >>> d = {}
>>> d[1,] = 6
>>> d
{1: 6} # ! I suggest we fix the model to turn the 'subs' of the 'Subscript' node |
Logged In: YES Jeremy, there's no need to read anything before my last |
Logged In: YES The tuple store problem is fixed. The only outstanding item |
Logged In: YES Another one: the literal -2147483648 (i.e. the value of |
Logged In: YES Good morning Armin! I've reported that bug already: http://python.org/sf/1441486 (this is running the pypy/module/array tests or something, isn't it?) |
Logged In: YES Attached a patch for the LOAD_CONST POP_TOP optimization |
Logged In: YES Regarding the -2147483648 bug: the old compiler tries to |
Logged In: YES Unary minus bug has been fixed in SVN rev 50495. |
Logged In: YES Fix pending. need tests and code to be thawed. |
Logged In: YES I believe this addresses all the bugs. If you find new Committed revision 51081. |
Logged In: YES Yes, I re-checked and all the bugs listed here are fixed. |
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: