Author ncoghlan
Recipients ncoghlan, serhiy.storchaka
Date 2017-09-20.04:05:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Reopening, as I was a little hasty with the merge button: the merged PR *also* changed the `__init__` error message to drop the method name, but I don't think that's what we want.

I'm also wondering if we should change the up-call case to *always* report the method name.

That is, we'd implement the following revised behaviour:

    # Without any method overrides
    class C:

    C(42) -> "TypeError: C() takes no arguments"
    C.__new__(42) -> "TypeError: C() takes no arguments"
    C().__init__(42) -> "TypeError: C.__init__() takes no arguments"
    # These next two quirks are the price we pay for the nicer errors above
    object.__new__(C, 42) -> "TypeError: C() takes no arguments"
    object.__init__(C(), 42) -> "TypeError: C.__init__() takes no arguments"

    # With method overrides
    class D:
        def __new__(cls, *args, **kwds):
            super().__new__(cls, *args, **kwds)
        def __init__(self, *args, **kwds):
            super().__init__(*args, **kwds)

    D(42) -> "TypeError: object.__new__() takes no arguments"
    D.__new__(42) -> "TypeError: object.__new__() takes no arguments"
    D().__init__(42) -> "TypeError: object.__init__() takes no arguments"
    object.__new__(C, 42) -> "TypeError: object.__new__() takes no arguments"
    object.__init__(C(), 42) -> "TypeError: object.__init__() takes no arguments"
Date User Action Args
2017-09-20 04:05:39ncoghlansetrecipients: + ncoghlan, serhiy.storchaka
2017-09-20 04:05:39ncoghlansetmessageid: <>
2017-09-20 04:05:39ncoghlanlinkissue31506 messages
2017-09-20 04:05:39ncoghlancreate