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 <rep...@bugs.python.org>
<http://bugs.python.org/issue16055>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to