Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Handle Python layer exceptions correctly #2462
Conversation
longjon
added ready for review Python
labels
May 16, 2015
|
Merging as I agree that this is simpler than the solution in #2001. Thanks Jon and thanks Takuya for raising the issue! |
shelhamer
added a commit
that referenced
this pull request
Aug 6, 2015
|
|
shelhamer |
ac6d4b6
|
shelhamer
merged commit ac6d4b6
into
BVLC:master
Aug 6, 2015
1 check passed
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
shelhamer
referenced
this pull request
Aug 6, 2015
Closed
[Python] PythonLayer takes parameters by string and better exception handling #2001
ctrevino
added a commit
to Robotertechnik/caffe
that referenced
this pull request
Aug 6, 2015
|
|
ctrevino |
c95cc07
|
shelhamer
referenced
this pull request
Aug 6, 2015
Merged
[pycaffe,build] include Python first in caffe tool #2876
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
longjon commentedMay 15, 2015
(This is a simplified alternative implementation of part of the first commit of #2001, plus a test.)
As noted by @tnarihi, Python layer exceptions are not handled correctly in pycaffe.
PyErr_Printis used to display exception text on stderr, but this has the side effect of clearing the exception, which results in an additionalSystemError: NULL return without exception set.The exceptions get passed through correctly if we simply don't try to catch and print them; that's the first commit. (Note that the Python interpreter will print these exceptions, if uncaught; it's only the
caffetool that won't.) Since we'd still like to see the exception text when using thecaffetool, the second commit adds a single,ifdefed,catch/PyErr_Printblock to the tool code. (There's no harm in callingPyErr_Printsince we know we're not in the interpreter.)I prefer this approach to the one in #2001, for these reasons:
The disadvantage of this approach is that:
caffetoolLet me know what you think @tnarihi and others, and thanks @tnarihi for pointing out this issue. (Note also that this does not include all of the exception-fixing functionality from #2001, which I'll plan to check out separately.)