]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-89039: Call subclass constructors in datetime.*.replace (GH-114780) (GH...
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 2 Apr 2025 17:35:16 +0000 (20:35 +0300)
committerGitHub <noreply@github.com>
Wed, 2 Apr 2025 17:35:16 +0000 (20:35 +0300)
commit6f6b8b4ac95ac1921acc912ac28c5ddca83b927e
treee997f3675e0c42ba84da5ce028c5f7fc2e443d8d
parente4fe4d9d5343be2946d1879b298fec26b15e37ad
[3.12] gh-89039: Call subclass constructors in datetime.*.replace (GH-114780) (GH-131239)

When replace() method is called on a subclass of datetime, date or time,
properly call derived constructor. Previously, only the base class's
constructor was called.

Also, make sure to pass non-zero fold values when creating subclasses in
various methods. Previously, fold was silently ignored.
(cherry picked from commit 46190d9ea8a878a03d95b4e1bdcdc9ed576cf3fa)

Co-authored-by: Eugene Toder <eltoder@users.noreply.github.com>
Lib/test/datetimetester.py
Misc/NEWS.d/next/Library/2023-12-18-20-10-50.gh-issue-89039.gqFdtU.rst [new file with mode: 0644]
Modules/_datetimemodule.c