From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:58:43 +0000 (-0700) Subject: [3.12] Fix date.__repr__() docstring (GH-109422) (#109448) X-Git-Tag: v3.12.1~457 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e5c860f9d03669f152292fb82665edfc2c01e5ec;p=thirdparty%2FPython%2Fcpython.git [3.12] Fix date.__repr__() docstring (GH-109422) (#109448) Fix date.__repr__() docstring (GH-109422) (cherry picked from commit 5eec58a9e57383128ade7b527965b1efc474735b) Co-authored-by: Christopher Yeh --- diff --git a/Lib/_pydatetime.py b/Lib/_pydatetime.py index a6d43399f9e7..0e34d8aacf53 100644 --- a/Lib/_pydatetime.py +++ b/Lib/_pydatetime.py @@ -1015,13 +1015,9 @@ class date: def __repr__(self): """Convert to formal string, for repr(). - >>> dt = datetime(2010, 1, 1) - >>> repr(dt) - 'datetime.datetime(2010, 1, 1, 0, 0)' - - >>> dt = datetime(2010, 1, 1, tzinfo=timezone.utc) - >>> repr(dt) - 'datetime.datetime(2010, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)' + >>> d = date(2010, 1, 1) + >>> repr(d) + 'datetime.date(2010, 1, 1)' """ return "%s.%s(%d, %d, %d)" % (_get_class_module(self), self.__class__.__qualname__,