Skip to content

Commit e940bf8

Browse files
drake: Workaround "Assertion '!PyErr_Occurred()'" for dtype=object (#52)
1 parent 58d9205 commit e940bf8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

include/pybind11/detail/class.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ extern "C" inline int pybind11_meta_setattro(PyObject* obj, PyObject* name, PyOb
157157
* to do a special case bypass for PyInstanceMethod_Types.
158158
*/
159159
extern "C" inline PyObject *pybind11_meta_getattro(PyObject *obj, PyObject *name) {
160+
// Workaround! See:
161+
// https://github.com/RobotLocomotion/drake/issues/14740
162+
// https://github.com/pybind/pybind11/pull/2685
163+
if (PyErr_Occurred()) {
164+
PyErr_Clear();
165+
}
160166
PyObject *descr = _PyType_Lookup((PyTypeObject *) obj, name);
161167
if (descr && PyInstanceMethod_Check(descr)) {
162168
Py_INCREF(descr);

0 commit comments

Comments
 (0)