[ python-Bugs-1536786 ] buffer comparison emits a RuntimeWarning
SourceForge.net
noreply at sourceforge.net
Tue Aug 8 19:45:18 CEST 2006
Bugs item #1536786, was opened at 2006-08-08 17:50
Message generated for change (Comment added) made by theller
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1536786&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.5
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Thomas Heller (theller)
Assigned to: Thomas Heller (theller)
Summary: buffer comparison emits a RuntimeWarning
Initial Comment:
On some systems, the memcmp() function returns values
other than -1, 0, or +1, which gives a warning:
>>> cmp(buffer("abc"), buffer("def"))
__main__:1: RuntimeWarning: tp_compare didn't return
-1, 0 or 1
-1
>>>
The problem occurred on OS X and Windows CE.
Patch and test attached.
----------------------------------------------------------------------
>Comment By: Thomas Heller (theller)
Date: 2006-08-08 19:45
Message:
Logged In: YES
user_id=11105
Thanks.
Committed, with the suggested changes, as r51139/51140 on
the trunk, and r51141 on the release-24maint branch.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2006-08-08 18:52
Message:
Logged In: YES
user_id=31435
Looks good to me, although I'd collapse the new code to just:
if (cmp != 0)
return cmp < 0 ? -1 : 1;
Marked Accepted and assigned back to you for checkin (or if
you can't, assign back to me). Proabably affects 2.4 too.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1536786&group_id=5470
More information about the Python-bugs-list
mailing list