STINNER Victor <vstin...@python.org> added the comment: exec() function is currently quite clear on which types are accepted or not: exact dict for globals, mapping for locals.
* "If only globals is provided, it must be a dictionary (and not a subclass of dictionary), which will be used for both the global and the local variables." * "If provided, locals can be any mapping object." Moreover, the requirement on the exact dict type allowed to implement an optimization on globals in Python 3.8: "LOAD_GLOBAL instruction now uses new “per opcode cache” mechanism. It is about 40% faster now. (Contributed by Yury Selivanov and Inada Naoki in bpo-26219.)" ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32615> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com