mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-21 20:55:11 +00:00
Revert "Add PYBIND11_CONSTINIT
, but it does not work for the current use cases:"
This reverts commit f07b28bda9
.
This commit is contained in:
parent
f07b28bda9
commit
36be645758
@ -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");
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user