Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-41260: C impl of datetime.date.strftime() takes different keyword arg #21712

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
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*.