Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: 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? _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3729> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com