[ python-Bugs-1566140 ] T_ULONG -> double rounding in PyMember_GetOne()

SourceForge.net noreply at sourceforge.net
Fri Oct 27 08:19:48 CEST 2006


Bugs item #1566140, was opened at 2006-09-27 07:23
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1566140&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.6
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Piet Delport (pjdelport)
Assigned to: Nobody/Anonymous (nobody)
Summary: T_ULONG -> double rounding in PyMember_GetOne()

Initial Comment:
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 at satori.za.net>


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2006-10-27 08:19

Message:
Logged In: YES 
user_id=21627

This was fixed with said patch.

----------------------------------------------------------------------

Comment By: Žiga Seilnacht (zseil)
Date: 2006-09-27 10:56

Message:
Logged In: YES 
user_id=1326842

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

has a fix for this and some other bugs.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1566140&group_id=5470


More information about the Python-bugs-list mailing list