[issue20371] datetime.datetime.replace bypasses a subclass's __new__

Eugene Toder report at bugs.python.org
Sun May 15 13:02:56 EDT 2016


Eugene Toder added the comment:

This seems like it can lead to even more subtle bugs when replace() is not overriden. Currently, any extra state in the subclass is left uninitialized, which usually leads to obvious breakage and is relatively easy to trace back to replace(). (I've done it before.) If we call the constructor passing only base class values, the extra state may get initialized with default values. This is probably not what anyone wants, and is probably harder to debug, because there's no obvious breakage.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20371>
_______________________________________


More information about the Python-bugs-list mailing list