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

2018-07-30 Thread Vadim Pushtaev
Vadim Pushtaev added the comment: > 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 Should it? There is no sys.flags.__new__, tuple.__new

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

2018-07-30 Thread ppperry
ppperry 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 n

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

2018-07-30 Thread Vadim Pushtaev
Change by Vadim Pushtaev : -- keywords: +patch pull_requests: +8083 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-l

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

2018-07-30 Thread Vadim Pushtaev
Vadim Pushtaev added the comment: Here is what I learned: 1) Nothing is wrong with that "tuple.__new__(sys.flags) is not safe" part. `__new__` is deleted from `type(sys.flags)`, so parent's `__new__` is called. `tuple` is indeed a base class for `type(sys.flags)`. 2) Another part where we r

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

2018-07-30 Thread Vadim Pushtaev
Vadim Pushtaev added the comment: I'm trying to do something about this. Let me know if you have some ideas. -- nosy: +Vadim Pushtaev ___ Python tracker ___ __

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

2018-07-30 Thread ppperry
New submission from ppperry : > type(sys.flags).__new__(type(sys.flags)) Traceback (most recent call last): File "", line 1, in 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