New submission from VA <d.python.d...@indigo.re>:

object.__new__ takes only the class argument, but it still accepts extra 
arguments if a class doesn't override __new__, and rejects them otherwise. 
(This is because __new__ will receive the same arguments as __init__ but 
__new__ shouldn't need to be overridden just to remove args)

However, if a class has a custom __new__ at one point (in a parent class), and 
at a later point __bases__ is changed, object.__new__ will still reject 
arguments, although __new__ may not be overridden anymore at that point. See 
attached file.

I can't check with all Python 3 versions, but the same code works fine in 
Python 2.

----------
files: bases.py
messages: 311622
nosy: VA
priority: normal
severity: normal
status: open
title: object.__new__ does not accept arguments if __bases__ is changed
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47425/bases.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32768>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to