11diff --git a/pybind11/include/pybind11/detail/common.h b/pybind11/include/pybind11/detail/common.h
2- index f34fd27..f1681b7 100644
2+ index f34fd27..f73e41b 100644
33--- a/pybind11/include/pybind11/detail/common.h
44+++ b/pybind11/include/pybind11/detail/common.h
5- @@ -233,6 +233,9 @@
6- #if defined(PYPY_VERSION) && !defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
7- # define PYBIND11_SIMPLE_GIL_MANAGEMENT
5+ @@ -230,7 +230,7 @@
6+ # undef copysign
87 #endif
9- + #ifdef GRAALVM_PYTHON
10- + # define PYBIND11_SIMPLE_GIL_MANAGEMENT
11- + #endif
128
13- #if defined(_MSC_VER)
14- # if defined(PYBIND11_DEBUG_MARKER)
15- diff --git a/pybind11/include/pybind11/detail/internals.h b/pybind11/include/pybind11/detail/internals.h
16- index 7de7794..146b084 100644
17- --- a/pybind11/include/pybind11/detail/internals.h
18- +++ b/pybind11/include/pybind11/detail/internals.h
19- @@ -174,7 +174,7 @@ struct internals {
20- PyTypeObject *static_property_type;
21- PyTypeObject *default_metaclass;
22- PyObject *instance_base;
23- - #if defined(WITH_THREAD)
24- + #if defined(WITH_THREAD) && !defined(GRAALVM_PYTHON)
25- // Unused if PYBIND11_SIMPLE_GIL_MANAGEMENT is defined:
26- PYBIND11_TLS_KEY_INIT(tstate)
27- # if PYBIND11_INTERNALS_VERSION > 4
28- @@ -278,7 +278,7 @@ struct type_info {
9+ - #if defined(PYPY_VERSION) && !defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
10+ + #if (defined(PYPY_VERSION) || defined(GRAALVM_PYTHON)) && !defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
11+ # define PYBIND11_SIMPLE_GIL_MANAGEMENT
2912 #endif
3013
31- #ifndef PYBIND11_INTERNALS_KIND
32- - # if defined(WITH_THREAD)
33- + # if defined(WITH_THREAD) && !defined(GRAALVM_PYTHON)
34- # define PYBIND11_INTERNALS_KIND ""
35- # else
36- # define PYBIND11_INTERNALS_KIND "_without_thread"
37- @@ -454,7 +454,7 @@ PYBIND11_NOINLINE internals &get_internals() {
38- }
39- auto *&internals_ptr = *internals_pp;
40- internals_ptr = new internals();
41- - #if defined(WITH_THREAD)
42- + #if defined(WITH_THREAD) && !defined(GRAALVM_PYTHON)
43-
44- # if PY_VERSION_HEX < 0x03090000
45- PyEval_InitThreads();
46- @@ -491,7 +491,7 @@ PYBIND11_NOINLINE internals &get_internals() {
47- struct local_internals {
48- type_map<type_info *> registered_types_cpp;
49- std::forward_list<ExceptionTranslator> registered_exception_translators;
50- - #if defined(WITH_THREAD) && PYBIND11_INTERNALS_VERSION == 4
51- + #if defined(WITH_THREAD) && !defined(GRAALVM_PYTHON) && PYBIND11_INTERNALS_VERSION == 4
52-
53- // For ABI compatibility, we can't store the loader_life_support TLS key in
54- // the `internals` struct directly. Instead, we store it in `shared_data` and
5514diff --git a/pybind11/include/pybind11/detail/type_caster_base.h b/pybind11/include/pybind11/detail/type_caster_base.h
56- index 21f69c2..0b853f0 100644
15+ index 21f69c2..595c7d4 100644
5716--- a/pybind11/include/pybind11/detail/type_caster_base.h
5817+++ b/pybind11/include/pybind11/detail/type_caster_base.h
59- @@ -36,7 +36,7 @@ private:
60- loader_life_support *parent = nullptr;
61- std::unordered_set<PyObject *> keep_alive;
62-
63- - #if defined(WITH_THREAD)
64- + #if defined(WITH_THREAD) && !defined(GRAALVM_PYTHON)
65- // Store stack pointer in thread-local storage.
66- static PYBIND11_TLS_KEY_REF get_stack_tls_key() {
67- # if PYBIND11_INTERNALS_VERSION == 4
68- @@ -55,7 +55,7 @@ private:
69- // Use single global variable for stack.
70- static loader_life_support **get_stack_pp() {
71- static loader_life_support *global_stack = nullptr;
72- - return global_stack;
73- + return &global_stack;
74- }
75- static loader_life_support *get_stack_top() { return *get_stack_pp(); }
76- static void set_stack_top(loader_life_support *value) { *get_stack_pp() = value; }
7718@@ -484,7 +484,7 @@ PYBIND11_NOINLINE handle get_object_handle(const void *ptr, const detail::type_i
7819 }
7920
@@ -96,21 +37,6 @@ index bd5f981..c25f036 100644
9637 template <eval_mode mode = eval_statements>
9738 object eval_file(str, object, object) {
9839 pybind11_fail("eval_file not supported in PyPy3. Use eval");
99- diff --git a/pybind11/include/pybind11/gil.h b/pybind11/include/pybind11/gil.h
100- index cb0028d..6435226 100644
101- --- a/pybind11/include/pybind11/gil.h
102- +++ b/pybind11/include/pybind11/gil.h
103- @@ -173,8 +173,8 @@ public:
104- if (disassoc) {
105- // Python >= 3.7 can remove this, it's an int before 3.7
106- // NOLINTNEXTLINE(readability-qualified-auto)
107- - auto key = detail::get_internals().tstate;
108- - PYBIND11_TLS_REPLACE_VALUE(key, tstate);
109- + // auto key = detail::get_internals().tstate;
110- + // PYBIND11_TLS_REPLACE_VALUE(key, tstate);
111- }
112- }
113-
11440diff --git a/pybind11/include/pybind11/pybind11.h b/pybind11/include/pybind11/pybind11.h
11541index 42d432a..2e12a93 100644
11642--- a/pybind11/include/pybind11/pybind11.h
0 commit comments