[issue32768] object.__new__ does not accept arguments if __bases__ is changed
VA
report at bugs.python.org
Sun Feb 4 17:05:13 EST 2018
New submission from VA <d.python.dc54 at 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 <report at bugs.python.org>
<https://bugs.python.org/issue32768>
_______________________________________
More information about the Python-bugs-list
mailing list