[issue34284] Nonsensical exception message when calling `__new__` on some sys objects

ppperry report at bugs.python.org
Mon Jul 30 19:54:28 EDT 2018


ppperry <mapreader at olum.org> added the comment:

Your PR is not an improvement:
1. In this case, this will produce the error "tuple.__new__(sys.flags) is not safe". But I didn't call "tuple.__new__", I called sys.flags.__new__, and type(X).__new__(type(X)) should always be safe
2. The change in error message for namedtuples (A) isn't related and (B) isn't correct. `tuple.__new__(NamedTuple)` works, and produces a namedtuple object, so tuple.__new__ is what the error should point to.

----------

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


More information about the Python-bugs-list mailing list