[issue31212] min date can't be converted to timestamp

2017-08-16 Thread STINNER Victor

STINNER Victor added the comment:

This error is a side effect of the implementation of the PEP 495. In your 
timezone, datetime(1, 1, 1, 0, 0, 0).timestamp() creates an internal timestamp 
with year=0. The problem is that the internal function ymd_to_ord() doesn't 
support year=0:

/* This is incorrect if year <= 0; we really want the floor
 * here.  But so long as MINYEAR is 1, the smallest year this
 * can see is 1.
 */
assert (year >= 1);

> This worked in Python 3.6.0 and before: (...)

The question is if the result was correct before?

--
assignee: haypo -> belopolsky
nosy: +belopolsky

___
Python tracker 

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



[issue31212] min date can't be converted to timestamp

2017-08-15 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> haypo
nosy: +haypo

___
Python tracker 

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



[issue31212] min date can't be converted to timestamp

2017-08-15 Thread Dave Johansen

New submission from Dave Johansen:

This worked in Python 3.6.0 and before:
```
from datetime import datetime
d = datetime(1, 1, 1, 0, 0, 0)
d.timestamp()
```

The error output is:
```
ValueError: year 0 is out of range
```

But it used to return `-62135658000.0`.

Appears to be related to https://bugs.python.org/issue29921

--
messages: 300303
nosy: Dave Johansen
priority: normal
severity: normal
status: open
title: min date can't be converted to timestamp
type: behavior
versions: Python 3.6

___
Python tracker 

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