Nick Coghlan added the comment: 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: pass 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" ---------- resolution: fixed -> stage: resolved -> needs patch status: closed -> open _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31506> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com