Skip to content

Commit 395019a

Browse files
committed
guard reading as well
1 parent e5960dc commit 395019a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

mlir/lib/Bindings/Python/Globals.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ class PyGlobals {
120120

121121
class TracebackLoc {
122122
public:
123-
bool locTracebacksEnabled() const;
123+
bool locTracebacksEnabled();
124124

125125
void setLocTracebacksEnabled(bool value);
126126

127-
size_t locTracebackFramesLimit() const;
127+
size_t locTracebackFramesLimit();
128128

129129
void setLocTracebackFramesLimit(size_t value);
130130

mlir/lib/Bindings/Python/IRModule.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ PyGlobals::lookupOperationClass(llvm::StringRef operationName) {
198198
return std::nullopt;
199199
}
200200

201-
bool PyGlobals::TracebackLoc::locTracebacksEnabled() const {
201+
bool PyGlobals::TracebackLoc::locTracebacksEnabled() {
202+
nanobind::ft_lock_guard lock(mutex);
202203
return locTracebackEnabled_;
203204
}
204205

@@ -207,7 +208,8 @@ void PyGlobals::TracebackLoc::setLocTracebacksEnabled(bool value) {
207208
locTracebackEnabled_ = value;
208209
}
209210

210-
size_t PyGlobals::TracebackLoc::locTracebackFramesLimit() const {
211+
size_t PyGlobals::TracebackLoc::locTracebackFramesLimit() {
212+
nanobind::ft_lock_guard lock(mutex);
211213
return locTracebackFramesLimit_;
212214
}
213215

0 commit comments

Comments
 (0)