[issue16055] incorrect error text for int(base=1000, x='1')

Chris Jerdonek report at bugs.python.org
Sun Sep 30 17:25:25 CEST 2012


Chris Jerdonek added the comment:

A few comments on the patch:

1) You should also check the exception type (e.g. by using PyErr_ExceptionMatches()).

2) If the exception doesn't match, you should restore the original exception so that the pure Python test framework will in turn raise it and the caller can inspect it.  Currently, the caller will find out only that it doesn't match but not why.  Take a look at CHECK_INVALID() to see an example of this pattern being used.

3) I would expose the functionality that checks an exception's type and text as a helper function so that it can be used throughout _testcapimodule.c.  The function is nontrivial enough that we wouldn't want to be copying and pasting it throughout if we want to check exception texts for other parts of the C API.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16055>
_______________________________________


More information about the Python-bugs-list mailing list