From c066c762bab5903bb289d6b7d05cd02f95cb6f22 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 30 Mar 2026 12:33:20 -0700 Subject: [PATCH] fix: add missing PYBIND11_ALWAYS_INLINE macro for v3.0.3 backports Cherry-picking #5992 without #5887 left this macro undefined and broke builds, so this restores the expected inline helper definition with the smallest possible change. Made-with: Cursor --- include/pybind11/detail/common.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index 2ca1558e7..715892308 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -167,6 +167,14 @@ # define PYBIND11_NOINLINE __attribute__((noinline)) inline #endif +#if defined(_MSC_VER) +# define PYBIND11_ALWAYS_INLINE __forceinline +#elif defined(__GNUC__) +# define PYBIND11_ALWAYS_INLINE __attribute__((__always_inline__)) inline +#else +# define PYBIND11_ALWAYS_INLINE inline +#endif + #if defined(__MINGW32__) // For unknown reasons all PYBIND11_DEPRECATED member trigger a warning when declared // whether it is used or not