Skip to content

Commit ea68cd6

Browse files
committed
safer module access
1 parent f48c80a commit ea68cd6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Core/builtins.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ export pyfraction
12061206

12071207
### eval/exec
12081208

1209-
const MODULE_GLOBALS = Dict{Module,Py}()
1209+
const MODULE_GLOBALS = Lockable(Dict{Module,Py}())
12101210

12111211
function _pyeval_args(code, globals, locals)
12121212
if code isa AbstractString
@@ -1217,7 +1217,7 @@ function _pyeval_args(code, globals, locals)
12171217
throw(ArgumentError("code must be a string or Python code"))
12181218
end
12191219
if globals isa Module
1220-
globals_ = get!(pydict, MODULE_GLOBALS, globals)
1220+
globals_ = Base.@lock MODULE_GLOBALS get!(pydict, MODULE_GLOBALS[], globals)
12211221
elseif ispy(globals)
12221222
globals_ = globals
12231223
else

0 commit comments

Comments
 (0)