This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: T_ULONG -> double rounding in PyMember_GetOne()
Type: Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: loewis, pjdelport, zseil
Priority: normal Keywords:

Created on 2006-09-27 05:23 by pjdelport, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg30016 - (view) Author: Piet Delport (pjdelport) Date: 2006-09-27 05:23
Problem:

Python/structmember.c's PyMember_GetOne currently
handles getting T_ULONG members as follows:

case T_ULONG:
        v = PyLong_FromDouble((double) *(unsigned
long*)addr);
        break;

On platforms with 64-bit longs, the double won't have
enough precision to hold big values without rounding.

The fix should be simple:

v = PyLong_FromUnsignedLong(*(unsigned long*)addr);

-- Piet Delport <pjd@satori.za.net>
msg30017 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2006-09-27 08:56
Logged In: YES 
user_id=1326842

Patch #1549049:
http://www.python.org/sf/1549049

has a fix for this and some other bugs.
msg30018 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-10-27 06:19
Logged In: YES 
user_id=21627

This was fixed with said patch.
History
Date User Action Args
2022-04-11 14:56:20adminsetgithub: 44037
2006-09-27 05:23:51pjdelportcreate