We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce08e37 commit a5b9e50Copy full SHA for a5b9e50
include/pybind11/detail/class.h
@@ -388,7 +388,11 @@ inline void clear_patients(PyObject *self) {
388
auto *instance = reinterpret_cast<detail::instance *>(self);
389
auto &internals = get_internals();
390
auto pos = internals.patients.find(self);
391
- assert(pos != internals.patients.end());
+
392
+ if (pos == internals.patients.end()) {
393
+ pybind11_fail("FATAL: Internal consistency check failed: Invalid clear_patients() call.");
394
+ }
395
396
// Clearing the patients can cause more Python code to run, which
397
// can invalidate the iterator. Extract the vector of patients
398
// from the unordered_map first.
0 commit comments