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
incorrect LOAD/STORE_GLOBAL generation #43467
Comments
Python 2.5 compiles the following piece of code g = 1
def f():
g += 1 In Python 2.4, this raises an UnboundLocalError. In g = 1
def f():
g += 1
g = 5 I can't find where this optimization happens nowadays, |
Logged In: YES Possibly related is the discovery of free variables (used >>> def foo(x):
... def bar():
... if 0:
... print x
... return bar
In 2.4, there is no closure:
>>> foo.func_code.co_cellvars
()
>>> foo(5).func_closure
>>>
In 2.5, there is:
>>> foo.func_code.co_cellvars
('x',)
>>> foo(5).func_closure
(<cell at 0x2b9abf6d7e30: int object at 0x6b6580>,) (I don't think it's unreasonable to declare the old |
Logged In: YES Here are some notes in case I wear out before finding a fix. |
Logged In: YES I've got a simple fix that seems to work. I feel this part |
Logged In: YES Adding a patch to "fix" test_ast.py. I have no idea what |
Logged In: YES Checked in as SVN rev 50493. |
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: