@@ -828,7 +828,7 @@ def replace(self, year=None, month=None, day=None):
828
828
month = self ._month
829
829
if day is None :
830
830
day = self ._day
831
- return date (year , month , day )
831
+ return type ( self ) (year , month , day )
832
832
833
833
# Comparisons of date objects with other.
834
834
@@ -1316,7 +1316,7 @@ def replace(self, hour=None, minute=None, second=None, microsecond=None,
1316
1316
tzinfo = self .tzinfo
1317
1317
if fold is None :
1318
1318
fold = self ._fold
1319
- return time (hour , minute , second , microsecond , tzinfo , fold = fold )
1319
+ return type ( self ) (hour , minute , second , microsecond , tzinfo , fold = fold )
1320
1320
1321
1321
# Pickle support.
1322
1322
@@ -1597,7 +1597,7 @@ def replace(self, year=None, month=None, day=None, hour=None,
1597
1597
tzinfo = self .tzinfo
1598
1598
if fold is None :
1599
1599
fold = self .fold
1600
- return datetime (year , month , day , hour , minute , second ,
1600
+ return type ( self ) (year , month , day , hour , minute , second ,
1601
1601
microsecond , tzinfo , fold = fold )
1602
1602
1603
1603
def _local_timezone (self ):
0 commit comments