Skip to content
Open
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
Prev Previous commit
Next Next commit
Fix refleaks and tests for FreeBSD
  • Loading branch information
marat committed Sep 23, 2025
commit 375cf41de30a7dbc0befe73dc073989411535bdf
4 changes: 2 additions & 2 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2769,8 +2769,8 @@ Notes:
When used with the :meth:`~.datetime.strftime` method, leading zeroes are included
by default for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, ``%j``, ``%U``,
``%W``, ``%V`` and ``%y``. The ``%-`` flag (for example, ``%-d``) will produce
Comment thread
mhsmith marked this conversation as resolved.
Outdated
non-zero-padded output, except for ``%-y`` on Apple platforms, which is still
zero-padded.
non-zero-padded output, except for ``%-y`` on Apple platforms and FreeBSD,
which is still zero-padded.

(10)
When parsing a month and day using :meth:`~.datetime.strptime`, always
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@ def test_strftime(self):
self.assertEqual(t.strftime('x'*1000), 'x'*1000) # SF bug #1556784

# See gh-137165
if platform.system() in ('Darwin', 'iOS'):
if platform.system() in ('Darwin', 'iOS', 'FreeBSD'):
self.assertEqual(t.strftime("m:%-m d:%-d y:%-y"), "m:3 d:2 y:05")
Comment thread
mhsmith marked this conversation as resolved.
else:
if platform.system() == 'Windows':
Expand Down
1 change: 1 addition & 0 deletions Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,7 @@ make_dash_replacement(PyObject *object, Py_UCS4 ch, PyObject *timetuple)
}

if (PyUnicode_GET_LENGTH(stripped) == 0) {
Py_DECREF(stripped);
stripped = PyUnicode_FromString("0");
}
Comment thread
StanFromIreland marked this conversation as resolved.

Expand Down
Loading