Bugs item #1536786, was opened at 2006-08-08 11:50
Message generated for change (Comment added) made by tim_one
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: Open
>Resolution: Accepted
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: Tim Peters (tim_one)
Date: 2006-08-08 12: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
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to