Commit ce18721d by Aaron Gokaslan Committed by GitHub

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

parent 978617f6
...@@ -988,6 +988,13 @@ protected: ...@@ -988,6 +988,13 @@ protected:
} }
append_note_if_missing_header_is_suspected(msg); 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()); PyErr_SetString(PyExc_TypeError, msg.c_str());
return nullptr; return nullptr;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment