Skip to content

Commit

Permalink
Avoid unused parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury committed Jan 15, 2025
1 parent bb215b5 commit 9f16d6b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/pybind11/detail/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ inline void traverse_offset_bases(void *valueptr,
}
}

static inline void enable_try_inc_ref(PyObject *op) {
#ifdef Py_GIL_DISABLED
static inline void enable_try_inc_ref(PyObject *op) {
// TODO: Replace with PyUnstable_Object_EnableTryIncRef when available.
// See https://github.com/python/cpython/issues/128844
if (_Py_IsImmortal(op)) {
Expand All @@ -330,11 +330,13 @@ static inline void enable_try_inc_ref(PyObject *op) {
return;
}
}
#endif
}
#endif

inline bool register_instance_impl(void *ptr, instance *self) {
#ifdef Py_GIL_DISABLED
enable_try_inc_ref((PyObject *) self);
#endif
with_instance_map(ptr, [&](instance_map &instances) { instances.emplace(ptr, self); });
return true; // unused, but gives the same signature as the deregister func
}
Expand Down

0 comments on commit 9f16d6b

Please sign in to comment.