[3.6] bpo-31222: Make (datetime|date|time).replace return subclass type in Pure Python (GH-4176) by miss-islington · Pull Request #4356 · python/cpython

Expand Up @@ -827,7 +827,7 @@ def replace(self, year=None, month=None, day=None): month = self._month if day is None: day = self._day return date(year, month, day) return type(self)(year, month, day)
# Comparisons of date objects with other.
Expand Down Expand Up @@ -1315,7 +1315,7 @@ def replace(self, hour=None, minute=None, second=None, microsecond=None, tzinfo = self.tzinfo if fold is None: fold = self._fold return time(hour, minute, second, microsecond, tzinfo, fold=fold) return type(self)(hour, minute, second, microsecond, tzinfo, fold=fold)
# Pickle support.
Expand Down Expand Up @@ -1596,7 +1596,7 @@ def replace(self, year=None, month=None, day=None, hour=None, tzinfo = self.tzinfo if fold is None: fold = self.fold return datetime(year, month, day, hour, minute, second, return type(self)(year, month, day, hour, minute, second, microsecond, tzinfo, fold=fold)
def _local_timezone(self): Expand Down