This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients BTaskaya, Simon.Chopin, georg.brandl, terry.reedy, tshepang, xdegaye
Date 2019-10-29.18:12:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1572372768.41.0.308607852532.issue14196@roundup.psfhosted.org>
In-reply-to
Content
Batuhan, thanks for the nudge.  For the record ...

If __new__ were a normal instance method, then 'some_class.__new__()' would be a correct call, as 'some_class' would be passed to '__new__' as its first and perhaps only argument.  But " __new__() is a static method (special-cased so you need not declare it as such)".
https://docs.python.org/3/reference/datamodel.html#object.__new__
Its special-casing makes it easy to forget that its first argument, a class, must be passed explicitly.  Hence Xavier's comment.

In current 2.7.17 and 3.8 (for instance), with pdb left out of the picture, the missing cls argument results in
  TypeError: object.__new__(): not enough arguments

When I pdb.run('A()') new and step, it catches the error and refuses to advance.

> <pyshell#10>(3)__new__()
(Pdb) s
TypeError: object.__new__(): not enough arguments
> <pyshell#10>(3)__new__()
History
Date User Action Args
2019-10-29 18:12:48terry.reedysetrecipients: + terry.reedy, georg.brandl, xdegaye, tshepang, Simon.Chopin, BTaskaya
2019-10-29 18:12:48terry.reedysetmessageid: <1572372768.41.0.308607852532.issue14196@roundup.psfhosted.org>
2019-10-29 18:12:48terry.reedylinkissue14196 messages
2019-10-29 18:12:48terry.reedycreate