Revert "Add `PYBIND11_CONSTINIT`, but it does not work for the current use cases:"

This reverts commit f07b28bda9.
This commit is contained in:
Ralf W. Grosse-Kunstleve 2023-10-09 07:56:40 -07:00
parent f07b28bda9
commit 36be645758
1 changed files with 2 additions and 11 deletions

View File

@ -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 <typename T>
class LazyInitializeAtLeastOnceDestroyNever {
@ -255,7 +247,7 @@ struct npy_api {
};
static npy_api &get() {
PYBIND11_CONSTINIT static LazyInitializeAtLeastOnceDestroyNever<npy_api> api_init;
static LazyInitializeAtLeastOnceDestroyNever<npy_api> api_init;
return api_init.Get(lookup);
}
@ -693,8 +685,7 @@ public:
private:
static object &_dtype_from_pep3118() {
PYBIND11_CONSTINIT static detail::LazyInitializeAtLeastOnceDestroyNever<object>
imported_obj;
static detail::LazyInitializeAtLeastOnceDestroyNever<object> imported_obj;
return imported_obj.Get([]() {
return detail::import_numpy_core_submodule("_internal").attr("_dtype_from_pep3118");
});