Skip to content

Commit 35f9d97

Browse files
authored
Handle result from PyObject_VisitManagedDict
1 parent 98e50b7 commit 35f9d97

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

include/pybind11/detail/class.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,10 @@ inline PyObject *make_object_base_type(PyTypeObject *metaclass) {
578578
/// dynamic_attr: Allow the garbage collector to traverse the internal instance `__dict__`.
579579
extern "C" inline int pybind11_traverse(PyObject *self, visitproc visit, void *arg) {
580580
#if PY_VERSION_HEX >= 0x030D0000
581-
PyObject_VisitManagedDict(self, visit, arg);
581+
int vret = PyObject_VisitManagedDict(self, visit, arg);
582+
if (vret) {
583+
return vret;
584+
}
582585
#else
583586
PyObject *&dict = *_PyObject_GetDictPtr(self);
584587
Py_VISIT(dict);

0 commit comments

Comments
 (0)