Eryk Sun added the comment: In Python 2, using the exec statement makes the compiler disable fast locals:
>>> def foo(): pass ... >>> def bar(): exec '' ... >>> foo.__code__.co_flags & inspect.CO_OPTIMIZED 1 >>> bar.__code__.co_flags & inspect.CO_OPTIMIZED 0 This has never been the case in Python 3, in which exec() is a function instead of a statement. The exec function can be shadowed by a global named "exec", so the hack to disable fast locals was removed. ---------- nosy: +eryksun resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26825> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com