We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 978617f commit ce18721Copy full SHA for ce18721
1 file changed
include/pybind11/pybind11.h
@@ -988,6 +988,13 @@ class cpp_function : public function {
988
}
989
990
append_note_if_missing_header_is_suspected(msg);
991
+#if PY_VERSION_HEX >= 0x03030000
992
+ // Attach additional error info to the exception if supported
993
+ if (PyErr_Occurred()) {
994
+ raise_from(PyExc_TypeError, msg.c_str());
995
+ return nullptr;
996
+ }
997
+#endif
998
PyErr_SetString(PyExc_TypeError, msg.c_str());
999
return nullptr;
1000
0 commit comments