[issue32615] Inconsistent behavior if globals is a dict subclass

STINNER Victor report at bugs.python.org
Wed Jan 15 16:45:42 EST 2020


STINNER Victor <vstinner at python.org> added the comment:

I modified ceval.c to accept dict subclasses when I was working on PEP 416:
https://www.python.org/dev/peps/pep-0416/

This PEP motivation was to implement a sandbox. The PEP was rejected. Later, I closed my pysandbox beause it was "broken by design":
https://lwn.net/Articles/574215/

Paul Sokolovsky wrote in bpo-36220 than his idea is also to implement a sandbox:
https://bugs.python.org/issue36220#msg359046

IMHO we should reject dict subclasses to make Python (especially ceval.c) more efficient. The global type must be checked at every place where it's possible to specify or override globals. Like the exec() function.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32615>
_______________________________________


More information about the Python-bugs-list mailing list