Prepare for GraalPy 3.13 (#6141)
diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h
index 7107b70..295485f 100644
--- a/include/pybind11/detail/internals.h
+++ b/include/pybind11/detail/internals.h
@@ -101,7 +101,11 @@
         // However, in GraalPy (as of v25.0 or older), TSS is implemented by Java and this call
         // requires a living Python interpreter.
 #ifdef GRAALVM_PYTHON
+#    if PY_VERSION_HEX >= 0x030D0000
+        if (Py_IsInitialized() == 0 || Py_IsFinalizing() != 0) {
+#    else
         if (Py_IsInitialized() == 0 || _Py_IsFinalizing() != 0) {
+#    endif
             return;
         }
 #endif