Message282531
(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. |
|
| Date |
User |
Action |
Args |
| 2016-12-06 11:56:58 | arigo | set | recipients:
+ arigo |
| 2016-12-06 11:56:58 | arigo | set | messageid: <1481025418.85.0.187901644209.issue28884@psf.upfronthosting.co.za> |
| 2016-12-06 11:56:58 | arigo | link | issue28884 messages |
| 2016-12-06 11:56:58 | arigo | create | |
|