pybind11/include/pybind11
Wenzel Jakob bf2b031449 Handle cases where binding code immediately throws py::error_already_set
When binding code immediately throws an exception of type
py::error_already_set (e.g. via py::module::import that fails), the
catch block sets an import error as expected. Unfortunately, following
this, the deconstructor of py::error_already_set decides to call
py::detail::get_internals() and set up various internal data structures
of pybind11, which fails given that the error flag is active. The call
stack of this looks as follows:

Py_init_mymodule() -> __cxa_decrement_exception_refcount ->
error_already_set::~error_already_set() ->
gil_scoped_acquire::gil_scoped_acquire() -> detail::get_internals() ->
... -> pybind11::detail::simple_collector() -> uh oh..

The solution is simple: we call detail::get_internals() once before
running any binding code to make sure that the internal data structures
are ready.
2020-01-02 22:18:03 +01:00
..
detail Handle cases where binding code immediately throws py::error_already_set 2020-01-02 22:18:03 +01:00
attr.h type_record: Uninit Member (#1658) 2019-06-10 22:02:40 +02:00
buffer_info.h support for readonly buffers (#863) (#1466) 2019-11-24 08:33:05 +01:00
cast.h Use C++17 fold expressions when casting tuples and argument lists (#2043) 2019-12-30 01:26:32 +01:00
chrono.h Added ability to convert from datetime.date to system_clock::time_point (#1848) 2019-07-19 11:28:48 +02:00
common.h Add a dummy common.h header with a deprecation warning 2017-09-06 15:22:26 +02:00
complex.h Add -Wdeprecated to test suite and fix associated warnings (#1191) 2017-11-22 17:37:41 -04:00
eigen.h stl.h: propagate return value policies to type-specific casters (#1455) 2018-07-17 16:56:26 +02:00
embed.h Fix build with -Wmissing-prototypes (#1954) 2019-10-17 10:43:33 +02:00
eval.h Force hidden visibility on pybind code 2017-08-14 11:40:38 -04:00
functional.h Replace a usage of C++14 language features with C++11 code (#1833) 2019-07-10 10:13:56 +02:00
iostream.h quiet clang warning by adding default move ctor (#1821) 2019-07-15 16:16:14 +02:00
numpy.h Revert "numpy.h: minor preprocessor fix suggested by @chaekwan" 2019-11-28 08:07:32 +01:00
operators.h Access C++ hash functions from Python and vice versa (#1034) 2017-08-30 14:22:00 +02:00
options.h Move internal headers into detail subdirectory 2017-08-17 04:06:35 +02:00
pybind11.h Revert "Fix a memory leak when creating Python3 modules. (#2019)" 2019-12-11 21:26:46 +01:00
pytypes.h support for readonly buffers (#863) (#1466) 2019-11-24 08:33:05 +01:00
stl_bind.h test pair-copyability on C++17 upwards (#1886) 2019-10-31 12:38:24 +01:00
stl.h Adds type_caster support for std::deque. (#1609) 2018-11-16 06:45:19 +01:00