File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 23
23
const CTX = Context ()
24
24
25
25
function _atpyexit ()
26
- if CTX. is_initialized && CTX. which != :PyCall
26
+ if CTX. is_initialized && ! CTX. is_preinitialized
27
27
@warn " Python exited unexpectedly"
28
28
end
29
29
CTX. is_initialized = false
@@ -40,7 +40,7 @@ function init_context()
40
40
init_pointers ()
41
41
# Check Python is initialized
42
42
Py_IsInitialized () == 0 && error (" Python is not already initialized." )
43
- CTX. is_initialized = CTX . is_preinitialized = true
43
+ CTX. is_initialized = true
44
44
CTX. which = :embedded
45
45
exe_path = get (ENV , " JULIA_PYTHONCALL_EXE" , " " )
46
46
if exe_path != " "
@@ -121,7 +121,8 @@ function init_context()
121
121
122
122
# Initialize
123
123
with_gil () do
124
- if Py_IsInitialized () != 0
124
+ CTX. is_preinitialized = Py_IsInitialized () != 0
125
+ if CTX. is_preinitialized
125
126
# Already initialized (maybe you're using PyCall as well)
126
127
@assert CTX. which in (:embedded , :PyCall )
127
128
else
You can’t perform that action at this time.
0 commit comments