fix: make gil.h self-contained for PyPy/GraalPy and silence -Wredundant-decls
gil.h evaluated PYBIND11_SIMPLE_GIL_MANAGEMENT before including common.h, which defines it on PyPy/GraalPy. Every existing TU included common.h first through pybind11.h, so this only surfaced when src/type_caster_base.cpp reached gil.h directly. Also suppress GCC -Wredundant-decls for the isinstance_generic declaration duplicated in pytypes.h. Assisted-by: ClaudeCode:claude-fable-5
This commit is contained in:
committed by
Henry Schreiner
parent
57b3abcbb7
commit
d495d3e047
@@ -219,7 +219,11 @@ public:
|
||||
// (get_value_and_holder, allocate_layout, and deallocate_layout are declared inside
|
||||
// struct instance in detail/common.h; definitions are in type_caster_base-inl.h.)
|
||||
|
||||
PYBIND11_WARNING_PUSH
|
||||
PYBIND11_WARNING_DISABLE_GCC("-Wredundant-decls")
|
||||
// also forward-declared in pytypes.h
|
||||
bool isinstance_generic(handle obj, const std::type_info &tp);
|
||||
PYBIND11_WARNING_POP
|
||||
|
||||
handle get_object_handle(const void *ptr, const detail::type_info *type);
|
||||
|
||||
|
||||
@@ -9,9 +9,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// common.h must come first: on PyPy/GraalPy it defines PYBIND11_SIMPLE_GIL_MANAGEMENT,
|
||||
// which selects the branch below.
|
||||
#include "detail/common.h"
|
||||
|
||||
#if defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
|
||||
|
||||
# include "detail/common.h"
|
||||
# include "gil_simple.h"
|
||||
|
||||
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
|
||||
@@ -23,7 +26,6 @@ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
|
||||
|
||||
#else
|
||||
|
||||
# include "detail/common.h"
|
||||
# include "detail/internals.h"
|
||||
|
||||
# include <cassert>
|
||||
|
||||
Reference in New Issue
Block a user