Skip to content

Commit 36be645

Browse files
committed
Revert "Add PYBIND11_CONSTINIT, but it does not work for the current use cases:"
This reverts commit f07b28b.
1 parent f07b28b commit 36be645

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

include/pybind11/numpy.h

+2-11
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ class array; // Forward declaration
4343

4444
PYBIND11_NAMESPACE_BEGIN(detail)
4545

46-
#ifndef PYBIND11_CONSTINIT
47-
# if __cplusplus >= 202002L
48-
# define PYBIND11_CONSTINIT constinit
49-
# else
50-
# define PYBIND11_CONSTINIT
51-
# endif
52-
#endif
53-
5446
// Main author of this class: jbms@
5547
template <typename T>
5648
class LazyInitializeAtLeastOnceDestroyNever {
@@ -255,7 +247,7 @@ struct npy_api {
255247
};
256248

257249
static npy_api &get() {
258-
PYBIND11_CONSTINIT static LazyInitializeAtLeastOnceDestroyNever<npy_api> api_init;
250+
static LazyInitializeAtLeastOnceDestroyNever<npy_api> api_init;
259251
return api_init.Get(lookup);
260252
}
261253

@@ -693,8 +685,7 @@ class dtype : public object {
693685

694686
private:
695687
static object &_dtype_from_pep3118() {
696-
PYBIND11_CONSTINIT static detail::LazyInitializeAtLeastOnceDestroyNever<object>
697-
imported_obj;
688+
static detail::LazyInitializeAtLeastOnceDestroyNever<object> imported_obj;
698689
return imported_obj.Get([]() {
699690
return detail::import_numpy_core_submodule("_internal").attr("_dtype_from_pep3118");
700691
});

0 commit comments

Comments
 (0)