]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41260: C impl of datetime.date.strftime() takes different keyword arg (GH-21712)
authorZackery Spytz <zspytz@gmail.com>
Fri, 25 Nov 2022 09:21:25 +0000 (01:21 -0800)
committerGitHub <noreply@github.com>
Fri, 25 Nov 2022 09:21:25 +0000 (09:21 +0000)
Lib/datetime.py
Lib/test/datetimetester.py
Misc/NEWS.d/next/Library/2020-08-02-23-46-22.bpo-41260.Q2BNzY.rst [new file with mode: 0644]

index 01742680a95bb66204d377d9e7878ec6a911cee1..1b0c5cb2d1c6ff497d44e8ab408d099f7eee0bbe 100644 (file)
@@ -1032,13 +1032,13 @@ class date:
             _MONTHNAMES[self._month],
             self._day, self._year)
 
-    def strftime(self, fmt):
+    def strftime(self, format):
         """
         Format using strftime().
 
         Example: "%d/%m/%Y, %H:%M:%S"
         """
-        return _wrap_strftime(self, fmt, self.timetuple())
+        return _wrap_strftime(self, format, self.timetuple())
 
     def __format__(self, fmt):
         if not isinstance(fmt, str):
index bba96698e9e2ebea1309dba91fc47f8ef56da6c5..121d973b6d5f20d6cecf2ca2b823dfc86666ac0f 100644 (file)
@@ -1489,6 +1489,9 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
         #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 (file)
index 0000000..ae2fdd9
--- /dev/null
@@ -0,0 +1,2 @@
+Rename the *fmt* parameter of the pure Python implementation of
+:meth:`datetime.date.strftime` to *format*.