[issue25155] datetime.datetime.now() raises

2015-09-18 Thread STINNER Victor

STINNER Victor added the comment:

Oh wow, I didn't expect such much headaches when I worked on unifiying the code 
to handle timestamps in the C part of CPython...

> The bug was introduced while trying to support #22117: "Rewrite pytime.h to 
> work on nanoseconds" in reve93eeadef0c3: 
> https://hg.python.org/cpython/rev/e93eeadef0c3

Yeah, the changeset e93eeadef0c3 was the last change to drop the last function 
of the old PyTime.

Well... in fact, I also had to keep _PyTime_ObjectToTime_t() and 
_PyTime_ObjectToTimeval() for the exact same reason: support timestamp after 
the year 2038 on Windows.

Right, the tv_sec field of a timeval structure on Windows has the C type long, 
whereas it has the type time_t on all other platforms...

I fixed the bug in Python 3.5 and 3.6. Thanks for your bug report. I didn't 
expect to test year 2038 bug on the latest release, thanks time traveler :-)

--

___
Python tracker 

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



[issue25155] datetime.datetime.now() raises

2015-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4ca99a0a18e4 by Victor Stinner in branch '3.5':
Issue #25155: Add _PyTime_AsTimevalTime_t() function
https://hg.python.org/cpython/rev/4ca99a0a18e4

--

___
Python tracker 

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



[issue25155] datetime.datetime.now() raises

2015-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5bfcccf229c4 by Victor Stinner in branch '3.5':
Issue #25155: document the bugfix in Misc/NEWS
https://hg.python.org/cpython/rev/5bfcccf229c4

--

___
Python tracker 

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



[issue25155] datetime.datetime.now() raises

2015-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 203134592edf by Victor Stinner in branch 'default':
Issue #25155: Add _PyTime_AsTimevalTime_t() function
https://hg.python.org/cpython/rev/203134592edf

--
nosy: +python-dev

___
Python tracker 

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



[issue25155] datetime.datetime.now() raises

2015-09-17 Thread Vitaly Murashev

New submission from Vitaly Murashev:

Current time on my machine with Windows7x64 is set to year 2045 for test 
purposes.
Since Python3.5(amd64) I have an OverflowError when I am trying to call 
datetime.datetime.now()

It looks like a regress since there was no such error on Python3.4.3

Could anyone please give me a note, whether it would be reasonable for me to 
wait for a patch in Python3.5.x, or such behavior is common since 3.5 and 
should not use it in my 'strange' case at all ? 

A bit of details:

Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.now()
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: timestamp too large to convert to C _PyTime_t
>>>

Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.now()
datetime.datetime(2045, 4, 2, 2, 42, 8, 359375)
>>>

--
components: Interpreter Core, Windows
messages: 250914
nosy: paul.moore, steve.dower, tim.golden, vmurashev, zach.ware
priority: normal
severity: normal
status: open
title: datetime.datetime.now() raises
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue25155] datetime.datetime.now() raises

2015-09-17 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy: +belopolsky

___
Python tracker 

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



[issue25155] datetime.datetime.now() raises

2015-09-17 Thread Zachary Ware

Changes by Zachary Ware :


--
nosy: +haypo

___
Python tracker 

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



[issue25155] datetime.datetime.now() raises

2015-09-17 Thread Josh Rosenberg

Josh Rosenberg added the comment:

It looks like between 3.4.3 and 3.5, datetime_best_possible changed from using 
_PyTime_gettimeofday with a _PyTime_timeval to using _PyTime_AsTimeval with 
struct timeval. The difference is that _PyTime_timeval appears to have been 
defined with a proper time_t for secs, where struct timeval is defined (on 
Windows) with a long which is still 32 bits on Windows, so we reintroduced the 
Y2K38 problem.

The bug was introduced while trying to support #22117: "Rewrite pytime.h to 
work on nanoseconds" in reve93eeadef0c3: 
https://hg.python.org/cpython/rev/e93eeadef0c3

--
nosy: +josh.r

___
Python tracker 

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