[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread EGuesnet


New submission from EGuesnet :

Hi,
I have an error during regression tests with Python3.8.1 on AIX 6.1 compiled 
with GCC 8.3.
It occurs only on 64 bit. Test passes on 32 bit.

```
==
ERROR: test_add_file_after_2107 (test.test_zipfile.StoredTestsWithSourceFile)
--
Traceback (most recent call last):
  File 
"/opt/freeware/src/packages/BUILD/Python-3.8.1/64bit/Lib/test/test_zipfile.py", 
line 606, in test_add_file_after_2107
self.assertRaises(struct.error, zipfp.write, TESTFN)
  File 
"/opt/freeware/src/packages/BUILD/Python-3.8.1/64bit/Lib/unittest/case.py", 
line 816, in assertRaises
return context.handle('assertRaises', args, kwargs)
  File 
"/opt/freeware/src/packages/BUILD/Python-3.8.1/64bit/Lib/unittest/case.py", 
line 202, in handle
callable_obj(*args, **kwargs)
  File "/opt/freeware/src/packages/BUILD/Python-3.8.1/64bit/Lib/zipfile.py", 
line 1739, in write
zinfo = ZipInfo.from_file(filename, arcname,
  File "/opt/freeware/src/packages/BUILD/Python-3.8.1/64bit/Lib/zipfile.py", 
line 523, in from_file
mtime = time.localtime(st.st_mtime)
OverflowError: localtime argument out of range
```

The PR associated to the new behavior is: 
https://github.com/python/cpython/pull/12726 (new on Python 3.8). Code is AIX 
specific. Is the code 32 bit only, or maybe the test was not updated?

-

I can reproduce the behavior as follow:

```
$ python3.8_32
Python 3.8.1 (default, Jan 27 2020, 11:34:59) 
[GCC 8.3.0] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.localtime(4325562452)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: timestamp out of range for platform time_t

$ python3.8_64
Python 3.8.1 (default, Jan 27 2020, 11:30:15) 
[GCC 8.3.0] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.localtime(4325562452)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: localtime argument out of range

$ python3.7_32
Python 3.7.4 (default, Jan 15 2020, 15:50:53) 
[GCC 8.3.0] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.localtime(4325562452)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: timestamp out of range for platform time_t

$ python3.7_64
Python 3.7.4 (default, Jan 15 2020, 15:46:22) 
[GCC 8.3.0] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.localtime(4325562452)
time.struct_time(tm_year=2107, tm_mon=1, tm_mday=27, tm_hour=10, tm_min=7, 
tm_sec=32, tm_wday=3, tm_yday=27, tm_isdst=0)
```

--
components: Tests
messages: 361058
nosy: EGuesnet
priority: normal
severity: normal
status: open
title: test_zipfile fails on AIX due to time.localtime
type: behavior
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue39502>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread EGuesnet


EGuesnet  added the comment:

Tested on Python 3.8.1 on both 32 and 64 bits.
Test is now skipped.


test_add_file_after_2107 (test.test_zipfile.StoredTestsWithSourceFile) ... 
skipped 'time.localtime(4386268800) raises OverflowError'

--

___
Python tracker 
<https://bugs.python.org/issue39502>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread EGuesnet


EGuesnet  added the comment:

> I'm not sure of the meaning of your patch. Are you saying that localtime() 
> supports timestamp after the year 2038 on 64-bit AIX? Did you test that 
> time.localtime(2**32) actually works as expected?

I think it worked as expected before 3.8 on 64 bit.

On AIX 64bit, with Python3.7.4,

$ python3_64
Python 3.7.4 (default, Jan 15 2020, 15:46:22)
[GCC 8.3.0] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import time; time.localtime(2**32)
time.struct_time(tm_year=2106, tm_mon=2, tm_mday=7, tm_hour=7, tm_min=28, 
tm_sec=16, tm_wday=6, tm_yday=38, tm_isdst=0)

and on 32bit

$ python3_32 
Python 3.7.4 (default, Jan 15 2020, 15:50:53) 
[GCC 8.3.0] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import time; time.localtime(2**32)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: timestamp out of range for platform time_t

With the new Python 3.8.1, on both 32 and 64bits,

Python 3.8.1 (default, Jan 30 2020, 11:23:14) 
[GCC 8.3.0] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import time; time.localtime(2**32)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: localtime argument out of range

--

___
Python tracker 
<https://bugs.python.org/issue39502>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com