]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
On Windows, we suddenly find, strftime() may return "" for an
authorGuido van Rossum <guido@python.org>
Thu, 8 Apr 1999 17:23:11 +0000 (17:23 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 8 Apr 1999 17:23:11 +0000 (17:23 +0000)
unsupported format string.  (I guess this is because the logic for
deciding whether to reallocate the buffer or not has been improved.)
This caused the test code to crash on result[0].  Fix this by assuming
an empty result also means the format is not supported.

Lib/test/test_strftime.py

index e24d5d6b17cbb5dfc02b525ed1a6b8c5fe1ae66f..1ccb84ba7c5dfcde7ce3cabb3d873239d43c582d 100755 (executable)
@@ -99,7 +99,7 @@ def strftest(now):
             print "Standard '%s' format gave error:" % e[0], error
             continue
         if re.match(e[1], result): continue
-        if result[0] == '%':
+        if not result or result[0] == '%':
             print "Does not support standard '%s' format (%s)" % (e[0], e[2])
         else:
             print "Conflict for %s (%s):" % (e[0], e[2])