[Patches] [ python-Patches-1530738 ] Fix __index__() clipping really big numbers

SourceForge.net noreply at sourceforge.net
Sat Jul 29 15:19:25 CEST 2006


Patches item #1530738, was opened at 2006-07-29 13:47
Message generated for change (Comment added) made by ncoghlan
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1530738&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: Core (C code)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 7
Submitted By: Nick Coghlan (ncoghlan)
Assigned to: Nobody/Anonymous (nobody)
Summary: Fix __index__() clipping really big numbers

Initial Comment:
Patch attached (index_overflow.diff) that causes
__index__() to raise OverflowError for really big
numbers instead of silently clipping them.

The approach in the patch is a "minimal fix" that is as
ugly as hell (3 different error return codes!), so I'm
going to try for a cleaner version that changes
nb_index to return a PyObject* (then the client code
can decide whether to convert to Py_ssize_t or not, and
whether to clip or raise OverflowError when doing so).

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

>Comment By: Nick Coghlan (ncoghlan)
Date: 2006-07-29 23:19

Message:
Logged In: YES 
user_id=1038590

Attaching the patch that approaches the problem from the
ground up by redesigning the PEP 357 C API to meet the needs
of the actual use cases in the standard library.

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

Comment By: Tim Peters (tim_one)
Date: 2006-07-29 14:05

Message:
Logged In: YES 
user_id=31435

Since I don't think this is a sane approach, I'm not going
to spend time reviewing it :-)  Suggest working out what's
/wanted/ on python-dev first, including beefing up PEP 357
so it spells out the revised intents.

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

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


More information about the Patches mailing list