Nick Coghlan <ncogh...@gmail.com> added the comment:

Agreed, but it's still a definition time bug, as the types are only nulling out 
tp_new after creating the singleton instance, and not preventing __new__ from 
resolving.

If they *don't* null out tp_new, but instead set tp_new to a common helper 
function that raises "TypeError: Cannot create <type name> instances", that 
will both prevent __new__ from working, and also ensure that `type(obj)()` and 
`type(obj).__new__()` give the same error.

(Changing the applicable version, as this issues combines a relatively obscure 
error reporting issue with a relatively intrusive fix, so the risk/reward ratio 
pushes it towards being a Python 3.8 only change).

----------
versions:  -Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34284>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to