Armin Rigo added the comment: (B5) this is an old issue that was forgotten twice on the issue tracker: ``class C: __new__=int.__new__`` and ``class C(int): __new__=object.__new__`` can each be instantiated, even though they shouldn't. This is because ``__new__`` is completely ignored if it is set to any built-in function that uses ``tp_new_wrapper`` as its C code (many of the built-in types' ``__new__`` are like that). http://bugs.python.org/issue1694663#msg75957, http://bugs.python.org/issue5322#msg84112. In (at least) CPython 3.5, a few classes work only thanks to abuse of this bug: for example, ``io.UnsupportedOperation.__new__(io.UnsupportedOperation)`` doesn't work, but that was not noticed because ``io.UnsupportedOperation()`` mistakenly works.
---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28884> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com