[issue29140] time_hash() reads the wrong bytes to get microseconds

2017-02-01 Thread STINNER Victor

Changes by STINNER Victor :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue29140] time_hash() reads the wrong bytes to get microseconds

2017-01-03 Thread STINNER Victor

STINNER Victor added the comment:

Note: I found this bug while working on the issue #29100.

--

___
Python tracker 

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



[issue29140] time_hash() reads the wrong bytes to get microseconds

2017-01-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 72e48ff7b169 by Victor Stinner in branch '3.6':
Issue #29140: Fix hash(datetime.time)
https://hg.python.org/cpython/rev/72e48ff7b169

--
nosy: +python-dev

___
Python tracker 

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



[issue29140] time_hash() reads the wrong bytes to get microseconds

2017-01-03 Thread STINNER Victor

STINNER Victor added the comment:

I used attached check.patch to check if macros are misused in other functions. 
Hopefully, only time_hash() has bugs.

I don't think that it's worth it to apply check.patch, I dislike such complex 
macro.

--
Added file: http://bugs.python.org/file46130/check.patch

___
Python tracker 

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



[issue29140] time_hash() reads the wrong bytes to get microseconds

2017-01-03 Thread STINNER Victor

Changes by STINNER Victor :


--
keywords: +3.6regression

___
Python tracker 

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



[issue29140] time_hash() reads the wrong bytes to get microseconds

2017-01-03 Thread STINNER Victor

New submission from STINNER Victor:

When the time is folded, time_hash() uses DATE_xxx() macros, instead of 
TIME_xxx() macros, and so reads microseconds from the wrong bytes.

Bug introduced by the implementation of the PEP 495 (Local Time Disambiguation).

#define PyDateTime_DATE_GET_MICROSECOND(o)  \
PyDateTime_DateTime*)o)->data[7] << 16) |   \
 (((PyDateTime_DateTime*)o)->data[8] << 8)  |   \
  ((PyDateTime_DateTime*)o)->data[9])

#define PyDateTime_TIME_GET_MICROSECOND(o)  \
PyDateTime_Time*)o)->data[3] << 16) |   \
 (((PyDateTime_Time*)o)->data[4] << 8)  |   \
  ((PyDateTime_Time*)o)->data[5])

Attached patch fixes time_hash().

I guess that it's a dummy copy-paste issue.

--
components: Library (Lib)
files: time_hash.patch
keywords: patch
messages: 284561
nosy: belopolsky, haypo
priority: normal
severity: normal
status: open
title: time_hash() reads the wrong bytes to get microseconds
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46123/time_hash.patch

___
Python tracker 

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