[issue20371] datetime.datetime.replace bypasses a subclass's __new__
Eugene Toder
report at bugs.python.org
Sun May 15 16:37:00 EDT 2016
Eugene Toder added the comment:
namedtuple._replace() actually doesn't call subclass' __new__. It calls tuple.__new__ directly, so it has the same problem as datetime classes.
Parameter and Signature are new in 3.3. I'm not sure if they're expected to be used as base classes.
@r.david.murray: is that contract specified anywhere? The doc says "Return a datetime with the same attributes, except for those attributes given new values by whichever keyword arguments are specified." This doesn't explicitly mention subclasses, but also doesn't mention the possibility of discarding any attribute values.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20371>
_______________________________________
More information about the Python-bugs-list
mailing list