This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xdegaye
Recipients belopolsky, eric.smith, matrixise, miss-islington, mjsaah, p-ganssle, pablogsal, terry.reedy, thatiparthy, vstinner, xdegaye, xtreak
Date 2019-03-18.11:39:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The new test added by changeset 454b3d4ea246e8751534e105548d141ed7b0b032 fails on Android:

FAIL: test_strftime_trailing_percent (test.datetimetester.TestDate_Pure)
Traceback (most recent call last):
  File "/data/local/tmp/python/lib/python3.8/test/", line 1400, in test_strftime_trailing_percent
    self.assertEqual(t.strftime('%'), '%')
AssertionError: '' != '%'
+ %

The implementation of strftime() on Android does not seem to be posix compliant:
>>> import time
>>> time.strftime('A%Q')
>>> time.strftime('%')

However the new test is not about testing posix compliance and the following patch fixes this test failure on Android while still testing that the changes made by this changeset cause a trailing '%' to not raise the exception anymore:

diff --git a/Lib/test/ b/Lib/test/
index 715f0ea6b4..ae1a97f0b4 100644
--- a/Lib/test/
+++ b/Lib/test/
@@ -1397,8 +1397,10 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
         except ValueError:
             self.skipTest('time module does not support trailing %')
-        self.assertEqual(t.strftime('%'), '%')
-        self.assertEqual(t.strftime("m:%m d:%d y:%y %"), "m:03 d:02 y:05 %")
+        trailing_percent = _time.strftime('%')
+        self.assertEqual(t.strftime('%'), trailing_percent)
+        self.assertEqual(t.strftime("m:%m d:%d y:%y %"),
+                         "m:03 d:02 y:05 %s" % trailing_percent)
     def test_format(self):
         dt = self.theclass(2007, 9, 10)
Date User Action Args
2019-03-18 11:39:51xdegayesetrecipients: + xdegaye, terry.reedy, belopolsky, vstinner, eric.smith, matrixise, thatiparthy, p-ganssle, pablogsal, miss-islington, xtreak, mjsaah
2019-03-18 11:39:51xdegayesetmessageid: <>
2019-03-18 11:39:51xdegayelinkissue35066 messages
2019-03-18 11:39:50xdegayecreate