Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
ZackerySpytz committed Aug 3, 2020
commit 9132c91ef8b746788c81423d8b7e7d2d42d45ef4
4 changes: 2 additions & 2 deletions Lib/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
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*.