diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 09894cf74f..bd4d98eab3 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -267,7 +267,7 @@ struct npy_api { int len; }; - static npy_api &get() { + static inline npy_api &get() { PYBIND11_CONSTINIT static gil_safe_call_once_and_store storage; return storage.call_once_and_store_result(lookup).get_stored(); } @@ -761,7 +761,7 @@ class dtype : public object { #endif private: - static object &_dtype_from_pep3118() { + static inline object &_dtype_from_pep3118() { PYBIND11_CONSTINIT static gil_safe_call_once_and_store storage; return storage .call_once_and_store_result([]() { diff --git a/include/pybind11/options.h b/include/pybind11/options.h index 1b2122522d..bf9b66f037 100644 --- a/include/pybind11/options.h +++ b/include/pybind11/options.h @@ -81,7 +81,7 @@ class options { // docstrings. }; - static state &global_state() { + static inline state &global_state() { static state instance; return instance; }