Pablo Galindo Salgado <pablog...@gmail.com> added the comment:
> Maybe someone can bisect and find when this started happening? As far as I understand, this has been the case since Python 2 at least: $cat code.py gdict = {} ldict = {} exec(''' x = 1 def f(): global x''', gdict, ldict) print(('x' in gdict, 'x' in ldict)) gdict = {} ldict = {} exec(''' x = 1 def f(): pass''', gdict, ldict) print(('x' in gdict, 'x' in ldict)) $ python2 code.py (True, False) (False, True) $ python3.9 code.py (True, False) (False, True) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42190> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com