Skip to content

Commit c6c9a9e

Browse files
committed
Merge branch 'master' into sh_merge_master
2 parents 9193b8e + 43de801 commit c6c9a9e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/pip.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
- uses: actions/download-artifact@v4
104104

105105
- name: Generate artifact attestation for sdist and wheel
106-
uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
106+
uses: actions/attest-build-provenance@5e9cb68e95676991667494a6a4e59b8a2f13e1d0 # v1.3.3
107107
with:
108108
subject-path: "*/pybind11*"
109109

include/pybind11/gil_safe_call_once.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
#include <cassert>
99
#include <mutex>
1010

11+
#ifdef Py_GIL_DISABLED
12+
# include <atomic>
13+
#endif
14+
1115
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
1216

1317
// Use the `gil_safe_call_once_and_store` class below instead of the naive
@@ -82,7 +86,12 @@ class gil_safe_call_once_and_store {
8286
private:
8387
alignas(T) char storage_[sizeof(T)] = {};
8488
std::once_flag once_flag_ = {};
85-
bool is_initialized_ = false;
89+
#ifdef Py_GIL_DISABLED
90+
std::atomic_bool
91+
#else
92+
bool
93+
#endif
94+
is_initialized_{false};
8695
// The `is_initialized_`-`storage_` pair is very similar to `std::optional`,
8796
// but the latter does not have the triviality properties of former,
8897
// therefore `std::optional` is not a viable alternative here.

0 commit comments

Comments
 (0)