New issue 3110: Interaction between exec() and nonlocal
https://bitbucket.org/pypy/pypy/issues/3110/interaction-between-exec-and-nonlocal

Ronan Lamy:

The following test, which passes on CPython 3.6.9, fails on the last line in 
PyPy:

```python
def test_exec_nonlocal():
    x = 0
    def set_x(value):
        nonlocal x
        x = value
    set_x(1)
    assert x == 1
    exec('set_x(2)')
    assert x == 2
```

The situation is a bit unclear according to the docs, but I think PyPy’s 
behaviour is incorrect.


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to