Skip to content

Commit 375cf41

Browse files
author
marat
committed
Fix refleaks and tests for FreeBSD
1 parent 0e5ef8b commit 375cf41

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Doc/library/datetime.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2769,8 +2769,8 @@ Notes:
27692769
When used with the :meth:`~.datetime.strftime` method, leading zeroes are included
27702770
by default for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, ``%j``, ``%U``,
27712771
``%W``, ``%V`` and ``%y``. The ``%-`` flag (for example, ``%-d``) will produce
2772-
non-zero-padded output, except for ``%-y`` on Apple platforms, which is still
2773-
zero-padded.
2772+
non-zero-padded output, except for ``%-y`` on Apple platforms and FreeBSD,
2773+
which is still zero-padded.
27742774

27752775
(10)
27762776
When parsing a month and day using :meth:`~.datetime.strptime`, always

Lib/test/datetimetester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ def test_strftime(self):
15901590
self.assertEqual(t.strftime('x'*1000), 'x'*1000) # SF bug #1556784
15911591

15921592
# See gh-137165
1593-
if platform.system() in ('Darwin', 'iOS'):
1593+
if platform.system() in ('Darwin', 'iOS', 'FreeBSD'):
15941594
self.assertEqual(t.strftime("m:%-m d:%-d y:%-y"), "m:3 d:2 y:05")
15951595
else:
15961596
if platform.system() == 'Windows':

Modules/_datetimemodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,7 @@ make_dash_replacement(PyObject *object, Py_UCS4 ch, PyObject *timetuple)
18861886
}
18871887

18881888
if (PyUnicode_GET_LENGTH(stripped) == 0) {
1889+
Py_DECREF(stripped);
18891890
stripped = PyUnicode_FromString("0");
18901891
}
18911892

0 commit comments

Comments
 (0)