If astropy.units fails to import and a raises an exception (eg if warnings are converted to errors) when being imported via Schema.cc during import of lsst.afw.image an abort signal is received:
terminating with uncaught exception of type pybind11::error_already_set: SystemError: <built-in method __contains__ of dict object at 0x10049b900> returned a result with an error set
|
Stepping through schema.cc the line triggering this is:
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
|
frame #0: 0x0000000116e3d53d schema.so`void lsst::afw::table::(anonymous namespace)::declareSchemaType<unsigned char>(mod=0x00007ffeefbf33c0) at schema.cc:187 [opt]
|
184 std::string suffix = FieldBase<T>::getTypeString();
|
185 py::str pySuffix(suffix);
|
186
|
-> 187 py::object astropyUnit = py::module::import("astropy.units").attr("Unit");
|
188
|
189 // FieldBase
|
190 PyFieldBase<T> clsFieldBase(mod, ("FieldBase" + suffix).c_str());
|
|
* frame #0: 0x0000000116e3d53d schema.so`void lsst::afw::table::(anonymous namespace)::declareSchemaType<unsigned char>(mod=0x00007ffeefbf33c0) at schema.cc:187 [opt]
|
frame #1: 0x0000000116e3d143 schema.so`lsst::afw::table::(anonymous namespace)::pybind11_init_schema(mod=0x00007ffeefbf33c0) at schema.cc:398 [opt]
|
frame #2: 0x0000000116e3cf5d schema.so`::PyInit_schema() at schema.cc:390 [opt]
|
|
Something in the pybind11 layer is failing to catch the python exception and forward it on.
Depending on your system this can be reproduced with:
import warnings
|
warnings.simplefilter("error")
|
import lsst.afw.image
|
Given the reference to schema.cc and _contains_ I initially thought this was related to DM-15406 and there is some commentary there.