Skip to content

Commit b1dcdef

Browse files
authored
bpo-41260: C impl of datetime.date.strftime() takes different keyword arg (GH-21712)
1 parent 3a803bc commit b1dcdef

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

Lib/datetime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,13 +1032,13 @@ def ctime(self):
10321032
_MONTHNAMES[self._month],
10331033
self._day, self._year)
10341034

1035-
def strftime(self, fmt):
1035+
def strftime(self, format):
10361036
"""
10371037
Format using strftime().
10381038
10391039
Example: "%d/%m/%Y, %H:%M:%S"
10401040
"""
1041-
return _wrap_strftime(self, fmt, self.timetuple())
1041+
return _wrap_strftime(self, format, self.timetuple())
10421042

10431043
def __format__(self, fmt):
10441044
if not isinstance(fmt, str):

Lib/test/datetimetester.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,9 @@ def test_strftime(self):
14891489
#check that this standard extension works
14901490
t.strftime("%f")
14911491

1492+
# bpo-41260: The parameter was named "fmt" in the pure python impl.
1493+
t.strftime(format="%f")
1494+
14921495
def test_strftime_trailing_percent(self):
14931496
# bpo-35066: Make sure trailing '%' doesn't cause datetime's strftime to
14941497
# complain. Different libcs have different handling of trailing
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Rename the *fmt* parameter of the pure Python implementation of
2+
:meth:`datetime.date.strftime` to *format*.

0 commit comments

Comments
 (0)