pybind11/include/pybind11
Dean Moldovan 135ba8deaf Make error_already_set fetch and hold the Python error
This clears the Python error at the error_already_set throw site, thus
allowing Python calls to be made in destructors which are triggered by
the exception. This is preferable to the alternative, which would be
guarding every Python API call with an error_scope.

This effectively flips the behavior of error_already_set. Previously,
it was assumed that the error stays in Python, so handling the exception
in C++ would require explicitly calling PyErr_Clear(), but nothing was
needed to propagate the error to Python. With this change, handling the
error in C++ does not require a PyErr_Clear() call, but propagating the
error to Python requires an explicit error_already_set::restore().

The change does not break old code which explicitly calls PyErr_Clear()
for cleanup, which should be the majority of user code. The need for an
explicit restore() call does break old code, but this should be mostly
confined to the library and not user code.
2016-09-10 12:08:32 +02:00
..
attr.h operators should return NotImplemented given unsupported input (fixes #393) 2016-09-10 15:34:26 +09:00
cast.h Make error_already_set fetch and hold the Python error 2016-09-10 12:08:32 +02:00
common.h Make error_already_set fetch and hold the Python error 2016-09-10 12:08:32 +02:00
complex.h nicer type_caster::load() calling conventions 2016-05-15 20:23:27 +02:00
descr.h Intel compiler 2017 fix 2016-09-07 23:49:16 +09:00
eigen.h Make error_already_set fetch and hold the Python error 2016-09-10 12:08:32 +02:00
eval.h Python 2.7 fixes for eval() 2016-07-08 15:14:48 +02:00
functional.h fixed Py_None reference couting 2016-09-08 22:53:18 +09:00
numpy.h minor: renamed argument in array constructor 2016-08-28 01:55:07 +02:00
operators.h operators should return NotImplemented given unsupported input (fixes #393) 2016-09-10 15:34:26 +09:00
pybind11.h Make error_already_set fetch and hold the Python error 2016-09-10 12:08:32 +02:00
pytypes.h Add handle::is_none() method 2016-09-07 21:16:19 +01:00
stl_bind.h minor doc & style fixes 2016-09-06 13:02:29 +09:00
stl.h Apply make_caster and intrinsic_t aliases everywhere 2016-09-06 16:41:50 +02:00
typeid.h minor cleanups in common.h; updated author info and copyright year 2016-04-18 10:53:38 +02:00