[New-bugs-announce] [issue34284] Nonsensical exception message when calling `__new__` on some sys objects
ppperry
report at bugs.python.org
Mon Jul 30 16:05:01 EDT 2018
New submission from ppperry <mapreader at olum.org>:
> type(sys.flags).__new__(type(sys.flags))
Traceback (most recent call last):
File "<pyshell#102>", line 1, in <module>
type(sys.flags).__new__(type(sys.flags))
TypeError: tuple.__new__(sys.flags) is not safe, use sys.flags.__new__()
Ignoring the confusion caused by both the type and the instance being called "sys.flags", this error doesn't make sense. I am using "sys.flags" (the type).__new__, so why is it complaining?
"type(sys.flags)()" produces the standard "non-instantiable type" error.
The same behavior also happens for "sys.version_info", but strangely not for any of the other sys constants.
----------
components: Interpreter Core, Library (Lib)
messages: 322688
nosy: ppperry
priority: normal
severity: normal
status: open
title: Nonsensical exception message when calling `__new__` on some sys objects
type: behavior
versions: Python 3.7, Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34284>
_______________________________________
More information about the New-bugs-announce
mailing list