Skip to content

Commit

Permalink
bpo-41260: C impl of datetime.date.strftime() takes different keyword…
Browse files Browse the repository at this point in the history
… arg (GH-21712)
  • Loading branch information
ZackerySpytz authored Nov 25, 2022
1 parent 3a803bc commit b1dcdef
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,13 +1032,13 @@ def ctime(self):
_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):
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Rename the *fmt* parameter of the pure Python implementation of
:meth:`datetime.date.strftime` to *format*.

0 comments on commit b1dcdef

Please sign in to comment.