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
test_time failures on AIX #63947
Comments
http://buildbot.python.org/all/builders/PPC64%20AIX%203.x/builds/1138/steps/test/logs/stdio ====================================================================== Traceback (most recent call last):
File "/home/shager/cpython-buildarea/3.x.edelsohn-aix-ppc64/build/Lib/test/test_time.py", line 348, in test_mktime
self.assertEqual(time.mktime(tt), t)
OverflowError: mktime argument out of range ====================================================================== Traceback (most recent call last):
File "/home/shager/cpython-buildarea/3.x.edelsohn-aix-ppc64/build/Lib/test/test_time.py", line 233, in test_ctime
self.assertEqual(time.ctime(testval)[20:], str(year))
AssertionError: '1941' != '-100'
- 1941
+ -100 |
Oh, I missed also this one: ====================================================================== Traceback (most recent call last):
File "/home/shager/cpython-buildarea/3.x.edelsohn-aix-ppc64/build/Lib/test/test_time.py", line 365, in test_mktime_error
self.assertEqual(time.strftime('%Z', tt), tzname)
AssertionError: 'LMT' != 'PST'
- LMT
+ PST |
@david: Can you try to check what the minimum accepted timestamp for the time module? |
The valid range is 00:00:00 UTC, January 1, 1970 to 03:14:07 UTC, January 19, 2038. |
@david Edelsohn: Can you please test attached patch on AIX? It should fix test_mktime and test_ctime. |
Isn't this a duplicate of bpo-11188? |
With the patch, the results are: ERROR: test_ctime (test.test_time.TimeTestCase) Traceback (most recent call last):
File "/home/dje/src/cpython/Lib/test/test_time.py", line 239, in test_ctime
self.assertEqual(time.ctime(testval)[20:], str(year))
OverflowError: ctime() timestamp argument out of range ====================================================================== Traceback (most recent call last):
File "/home/dje/src/cpython/Lib/test/test_time.py", line 371, in test_mktime_error
self.assertEqual(time.strftime('%Z', tt), tzname)
AssertionError: 'LMT' != 'PST'
- LMT
+ PST which is what I would expect based on the patch and the new AIX-specific error message. What did you expect? |
No, mktime() and ctime() should both raise OverflowError. It looks like mktime() doesn't fail. Can you please try the following examples on AIX? Examples on Linux: >>> time.mktime((-100, 1, 10) + (0,)*6)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: year out of range
>>> time.mktime((100, 1, 10) + (0,)*6)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: year out of range
>>> time.mktime((1900, 1, 10) + (0,)*6)
-2208211761.0
>>> time.mktime((1930, 1, 10) + (0,)*6)
-1261526400.0
>>> time.mktime((1969,12,31, 23,59,59, 0,0,0))
-3601.0 |
>>> time.mktime((-100, 1, 10) + (0,)*6)
-897577382.0
>>> time.mktime((100, 1, 10) + (0,)*6)
1118888922.0
>>> time.mktime((1900, 1, 10) + (0,)*6)
2086784896.0
>>> time.mktime((1930, 1, 10) + (0,)*6)
-1261497600.0
>>> time.mktime((1969,12,31, 23,59,59, 0,0,0))
28799.0 |
With the latest patch, test_time passes. >>> time.mktime((-100, 1, 10) + (0,)*6)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: mktime argument out of range
>>> time.mktime((-100, 1, 10) + (0,)*6)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: mktime argument out of range
>>> time.mktime((1900, 1, 10) + (0,)*6)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: mktime argument out of range
>>> time.mktime((1930, 1, 10) + (0,)*6)
-1261497600.0
>>> time.mktime((1969,12,31, 23,59,59, 0,0,0))
28799.0 |
New changeset 502c8b7e8ad2 by Victor Stinner in branch 'default': |
Ok, thanks for your tests. But time.ctime() is still wrong. Can you please try the following examples with the latest Python version (502c8b7e8ad2) and then retry with pylocaltime_aix.patch? >>> time.ctime(-2**29)
'Sat Dec 27 06:11:28 1952'
>>> time.ctime(2**29)
'Mon Jan 5 19:48:32 1987' I would like to know if pylocaltime_aix.patch is needed or not. |
WITHOUT the patch to timemodule.c: >>> time.ctime(-2**29)
'Fri Dec 26 21:11:28 1952'
>>> time.ctime(2**29)
'Mon Jan 5 10:48:32 1987' ERROR: test_mktime (test.test_time.TimeTestCase) Traceback (most recent call last):
File "/home/dje/src/cpython/Lib/test/test_time.py", line 354, in test_mktime
self.assertEqual(time.mktime(tt), t)
OverflowError: mktime argument out of range |
WITH the patch: >>> time.ctime(-2**29)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: ctime() timestamp argument out of range
>>> time.ctime(2**29)
'Mon Jan 5 10:48:32 1987' OK (skipped=8) |
""" >>> time.ctime(-2**29)
'Fri Dec 26 21:11:28 1952'
""" Oh, in this case, pylocaltime_aix.patch is wrong. There was a bug in mktime(), but ctime() works fine. """ Oh, I don't understand this one. On Linux I get: >>> time.localtime(-2)
time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=59, tm_sec=58, tm_wday=3, tm_yday=1, tm_isdst=0)
>>> time.localtime(-1)
time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=59, tm_sec=59, tm_wday=3, tm_yday=1, tm_isdst=0)
>>> time.localtime(0)
time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=1, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)
>>> time.localtime(1)
time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=1, tm_min=0, tm_sec=1, tm_wday=3, tm_yday=1, tm_isdst=0) And: >>> time.mktime(time.localtime(-2))
-2.0
>>> time.mktime(time.localtime(-1))
-1.0
>>> time.mktime(time.localtime(0))
0.0
>>> time.mktime(time.localtime(1))
1.0 |
>>> time.localtime(-2)
time.struct_time(tm_year=1969, tm_mon=12, tm_mday=31, tm_hour=15, tm_min=59, tm_sec=58, tm_wday=2, tm_yday=365, tm_isdst=0)
>>> time.localtime(-1)
time.struct_time(tm_year=1969, tm_mon=12, tm_mday=31, tm_hour=15, tm_min=59, tm_sec=59, tm_wday=2, tm_yday=365, tm_isdst=0)
>>> time.localtime(0)
time.struct_time(tm_year=1969, tm_mon=12, tm_mday=31, tm_hour=16, tm_min=0, tm_sec=0, tm_wday=2, tm_yday=365, tm_isdst=0)
>>> time.localtime(1)
time.struct_time(tm_year=1969, tm_mon=12, tm_mday=31, tm_hour=16, tm_min=0, tm_sec=1, tm_wday=2, tm_yday=365, tm_isdst=0)
>>> time.mktime(time.localtime(-2))
-2.0
>>> time.mktime(time.localtime(-1))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: mktime argument out of range
>>> time.mktime(time.localtime(0))
0.0
>>> time.mktime(time.localtime(1))
1.0 |
New changeset 00e94e454813 by Victor Stinner in branch 'default': |
>>> time.mktime(time.localtime(-1))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: mktime argument out of range Oh yes, I now remember it. Sorry, it was 3 years ago: The problem is to detect invalid time tuple and support the timestamp value -1 (1 second before the UNIX epoch). I modified the test to skip mktime(localtime(-1)) test on AIX: changeset 00e94e454813. It would be nice to support this specific value, but I don't see how to implement it. It's maybe not possible. |
I'm no more interested to work on this issue, I prefer to close it. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: