This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, hagen
Date 2008-08-29.19:28:22
SpamBayes Score 5.3260436e-08
Marked as misclassified No
Message-id <1220038103.35.0.666760507285.issue3729@psf.upfronthosting.co.za>
In-reply-to
Content
Not bad! some remarks though:
- It's better to avoid the "expensive" call to PyErr_Occurred() when
possible. Here, an exception is set if (and only if) len==-1.
For example, it is enough to add these lines after the "__len__() should
return >= 0" message:

+		else if (PyErr_ExceptionMatches(PyExc_TypeError))
+			PyErr_SetString(PyExc_TypeError, 
+					"__len__() should return an int");

- Please clarify (that is: add tests for) the case where __len__ returns
1<<50 or -1<<50. If I remember correctly, PyNumber_AsSsize_t(res, NULL)
clips the values to MAXINT. Is this wanted?
History
Date User Action Args
2008-08-29 19:28:23amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, hagen
2008-08-29 19:28:23amaury.forgeotdarcsetmessageid: <1220038103.35.0.666760507285.issue3729@psf.upfronthosting.co.za>
2008-08-29 19:28:22amaury.forgeotdarclinkissue3729 messages
2008-08-29 19:28:22amaury.forgeotdarccreate