New issue 3059: utcfromtimestamp fails with ValueError
https://bitbucket.org/pypy/pypy/issues/3059/utcfromtimestamp-fails-with-valueerror

Ram Rachum:

```
Python 3.6.1 (784b254d6699, Apr 16 2019, 12:10:48)
[PyPy 7.1.1-beta0 with MSC v.1910 32 bit]         
```

‌

`utcfromtimestamp(0)` is supposed to return `datetime.datetime(1970, 1, 1, 0, 
0)`, that’s what it does on CPython.

‌

```
In [8]: datetime.datetime.utcfromtimestamp(0)                                
---------------------------------------------------------------------------  
ValueError                                Traceback (most recent call last)  
<ipython-input-8-4200fea8baa6> in <module>                                   
----> 1 datetime.datetime.utcfromtimestamp(0)                                
                                                                             
C:\pypy3\lib-python\3\datetime.py in utcfromtimestamp(cls, t)                
   1482     def utcfromtimestamp(cls, t):                                    
   1483         """Construct a naive UTC datetime from a POSIX timestamp.""" 
-> 1484         return cls._fromtimestamp(t, True, None)                     
   1485                                                                      
   1486     @classmethod                                                     
                                                                             
C:\pypy3\lib-python\3\datetime.py in _fromtimestamp(cls, t, utc, tz)         
   1457             # Let's probe 24 hours in the past to detect a transition
   1458             max_fold_seconds = 24 * 3600                             
-> 1459             y, m, d, hh, mm, ss = converter(t - max_fold_seconds)[:6]
   1460             probe1 = cls(y, m, d, hh, mm, ss, us, tz)                
   1461             trans = result - probe1 - timedelta(0, max_fold_seconds) 
                                                                             
ValueError: Invalid argument                                                 
```


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to