diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 8551aa26485..1d8b415208b 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -208,7 +208,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(); } @@ -646,7 +646,7 @@ class dtype : public object { char flags() const { return detail::array_descriptor_proxy(m_ptr)->flags; } 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 1b2122522d5..bf9b66f0379 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; }