From 9132c91ef8b746788c81423d8b7e7d2d42d45ef4 Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Sun, 2 Aug 2020 23:47:23 -0600 Subject: [PATCH] bpo-41260: C impl of datetime.date.strftime() takes different keyword arg The parameter was named "fmt" in the Python implementation, but it was was named "format" in the C implementation. --- Lib/datetime.py | 4 ++-- Lib/test/datetimetester.py | 3 +++ .../next/Library/2020-08-02-23-46-22.bpo-41260.Q2BNzY.rst | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2020-08-02-23-46-22.bpo-41260.Q2BNzY.rst diff --git a/Lib/datetime.py b/Lib/datetime.py index 3090978508c921..7e0baf4056d484 100644 --- a/Lib/datetime.py +++ b/Lib/datetime.py @@ -924,9 +924,9 @@ def ctime(self): _MONTHNAMES[self._month], self._day, self._year) - def strftime(self, fmt): + def strftime(self, format): "Format using strftime()." - return _wrap_strftime(self, fmt, self.timetuple()) + return _wrap_strftime(self, format, self.timetuple()) def __format__(self, fmt): if not isinstance(fmt, str): diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index 520a51df879997..2debf648ed0d4a 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -1479,6 +1479,9 @@ def test_strftime(self): #check that this standard extension works t.strftime("%f") + # bpo-41260: The parameter was named "fmt" in the pure python impl. + t.strftime(format="%f") + def test_strftime_trailing_percent(self): # bpo-35066: Make sure trailing '%' doesn't cause datetime's strftime to # complain. Different libcs have different handling of trailing diff --git a/Misc/NEWS.d/next/Library/2020-08-02-23-46-22.bpo-41260.Q2BNzY.rst b/Misc/NEWS.d/next/Library/2020-08-02-23-46-22.bpo-41260.Q2BNzY.rst new file mode 100644 index 00000000000000..ae2fdd9b84a00e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-08-02-23-46-22.bpo-41260.Q2BNzY.rst @@ -0,0 +1,2 @@ +Rename the *fmt* parameter of the pure Python implementation of +:meth:`datetime.date.strftime` to *format*.