Ensure TypeError use raise_from for C++->Python overload res. (#3671)

This commit is contained in:
Aaron Gokaslan
2022-01-31 15:13:05 -05:00
committed by GitHub
parent 978617f6b5
commit ce18721d83

View File

@@ -988,6 +988,13 @@ protected:
}
append_note_if_missing_header_is_suspected(msg);
#if PY_VERSION_HEX >= 0x03030000
// Attach additional error info to the exception if supported
if (PyErr_Occurred()) {
raise_from(PyExc_TypeError, msg.c_str());
return nullptr;
}
#endif
PyErr_SetString(PyExc_TypeError, msg.c_str());
return nullptr;
}