Patches item #1538606, was opened at 2006-08-11 04:51 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1538606&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: 5 Submitted By: Travis Oliphant (teoliphant) Assigned to: Nobody/Anonymous (nobody) Summary: Patch to fix __index__() clipping Initial Comment: This is a patch that builds off of Nick Coghlan's work to fix the __index__() clipping problem. It defines 3 New C-API calls (1 is a macro): int PyIndex_Check(obj) -- does this object have nb_index PyObject* PyNumber_Index(obj) -- return nb_index(obj) if possible Py_ssize_t PyNumber_AsSsize_t(obj, err) -- return obj as Py_ssize_t by frist going through nb_index(obj) which returns an integer or long integer. If err is NULL, then clip on Overflow, otherwise raise err on Overflow encountered when trying to fit the result of nb_index into a Py_ssize_t slot. With these three C-API calls, I was able to fix all the problems that have been identified and simplify several pieces of code. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1538606&group_id=5470 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches