[issue20189] inspect.Signature doesn't recognize all builtin types

Nick Coghlan report at bugs.python.org
Fri Jan 24 12:10:44 CET 2014


Nick Coghlan added the comment:

It doesn't act like a class method, though, it acts like a static method:

    >>> int.__new__()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: int.__new__(): not enough arguments
    >>> int.__new__(int)
    0

You have to *write* __new__ and tp_new as if they were class methods (because the type machinery expects you to do so), but you have to *call* them like static methods if you're invoking them directly for some reason.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20189>
_______________________________________


More information about the Python-bugs-list mailing list