[issue22627] Calling timestamp() on a datetime object modifies the timestamp of a different datetime object.

Antoine Pitrou report at bugs.python.org
Tue Oct 14 09:58:29 CEST 2014


Antoine Pitrou added the comment:

This has nothing to do with the datetime module. Attached script reduces the issue to a bug (?) in time.mktime() with the corresponding timezone. time.mktime() is a thin wrapper around the C library's mktime() function, so it is probably not a bug in Python at all.

Note your script is fixed by removing ".replace(tzinfo=None)". It seems conter-productive to take the pain to create an aware timezone and then make it naive, IMHO. datetime.timestamp() falls back on time.mktime() when the datetime is naive (i.e. it asks the OS to do the computation).

(I did my tests under Ubuntu 13.10, btw)

----------
nosy: +belopolsky, pitrou
Added file: http://bugs.python.org/file36907/mkbug.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22627>
_______________________________________


More information about the Python-bugs-list mailing list