homepage

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 p-ganssle
Recipients p-ganssle
Date 2017年08月16日.17:01:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1502902905.88.0.809330827331.issue31222@psf.upfronthosting.co.za>
In-reply-to
Content
In the .py implementation of datetime.replace (and date.replace and time.replace), the new datetime is created using the datetime type:
https://github.com/python/cpython/blob/master/Lib/datetime.py#L1578
But in the C source, it is created from type(self):
https://github.com/python/cpython/blob/master/Modules/_datetimemodule.c#L5046
I think the second should be the preferred behavior, so the datetime.py source should be updated to reflect that it's calling self.__class__(...) rather than datetime(...). I can prepare a PR if this would be desirable.
(That said, I'm not 100% clear under what circumstances the code in datetime.py is actually *used*, so I'm not sure how to write tests for it - is datetime.py essentially documentation, or is there a way to explicitly fall back to it?)
Per this issue on the pypy3 tracker:
https://bitbucket.org/pypy/pypy/issues/2635/datetimereplace-always-returns 
History
Date User Action Args
2017年08月16日 17:01:46p-gansslesetrecipients: + p-ganssle
2017年08月16日 17:01:45p-gansslesetmessageid: <1502902905.88.0.809330827331.issue31222@psf.upfronthosting.co.za>
2017年08月16日 17:01:45p-gansslelinkissue31222 messages
2017年08月16日 17:01:45p-gansslecreate

AltStyle によって変換されたページ (->オリジナル) /