From 36be645758aa82b576d24003808386bec6e55bf9 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 9 Oct 2023 07:56:40 -0700 Subject: [PATCH] Revert "Add `PYBIND11_CONSTINIT`, but it does not work for the current use cases:" This reverts commit f07b28bda9f91fb723aa898a21c81b6dd6857072. --- include/pybind11/numpy.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index b1365ec1e3..62768adcef 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -43,14 +43,6 @@ class array; // Forward declaration PYBIND11_NAMESPACE_BEGIN(detail) -#ifndef PYBIND11_CONSTINIT -# if __cplusplus >= 202002L -# define PYBIND11_CONSTINIT constinit -# else -# define PYBIND11_CONSTINIT -# endif -#endif - // Main author of this class: jbms@ template class LazyInitializeAtLeastOnceDestroyNever { @@ -255,7 +247,7 @@ struct npy_api { }; static npy_api &get() { - PYBIND11_CONSTINIT static LazyInitializeAtLeastOnceDestroyNever api_init; + static LazyInitializeAtLeastOnceDestroyNever api_init; return api_init.Get(lookup); } @@ -693,8 +685,7 @@ class dtype : public object { private: static object &_dtype_from_pep3118() { - PYBIND11_CONSTINIT static detail::LazyInitializeAtLeastOnceDestroyNever - imported_obj; + static detail::LazyInitializeAtLeastOnceDestroyNever imported_obj; return imported_obj.Get([]() { return detail::import_numpy_core_submodule("_internal").attr("_dtype_from_pep3118"); });