File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ def jlstr(x):
194
194
try
195
195
Base.require(Main, :CompilerSupportLibraries_jll)
196
196
import Pkg
197
- ENV["JULIA_PYTHONCALL_LIBPTR"] = {}
197
+ global __PythonCall_libptr = Ptr{{Cvoid}}(UInt({}))
198
198
ENV["JULIA_PYTHONCALL_EXE"] = {}
199
199
Pkg.activate({}, io=devnull)
200
200
import PythonCall
@@ -205,7 +205,7 @@ def jlstr(x):
205
205
rethrow()
206
206
end
207
207
''' .format (
208
- jlstr ( str ( c .pythonapi ._handle ) ),
208
+ hex ( c .pythonapi ._handle ),
209
209
jlstr (sys .executable or '' ),
210
210
jlstr (project ),
211
211
)
Original file line number Diff line number Diff line change 32
32
33
33
function init_context ()
34
34
35
- CTX. is_embedded = haskey ( ENV , " JULIA_PYTHONCALL_LIBPTR " )
35
+ CTX. is_embedded = hasproperty (Base . Main, :__PythonCall_libptr )
36
36
37
37
if CTX. is_embedded
38
38
# In this case, getting a handle to libpython is easy
39
- CTX. lib_ptr = Ptr {Cvoid} ( parse (UInt, ENV [ " JULIA_PYTHONCALL_LIBPTR " ]))
39
+ CTX. lib_ptr = Base . Main . __PythonCall_libptr :: Ptr{Cvoid}
40
40
init_pointers ()
41
41
# Check Python is initialized
42
42
Py_IsInitialized () == 0 && error (" Python is not already initialized." )
@@ -48,10 +48,6 @@ function init_context()
48
48
# this ensures PyCall uses the same Python interpreter
49
49
get! (ENV , " PYTHON" , exe_path)
50
50
end
51
- # On success, delete JULIA_PYTHONCALL_LIBPTR so that further processes do not think
52
- # they are embedded in Python (e.g. this can happen when precompiling).
53
- # See https://github.com/cjdoris/PythonCall.jl/issues/235
54
- delete! (ENV , " JULIA_PYTHONCALL_LIBPTR" )
55
51
else
56
52
# Find Python executable
57
53
exe_path = get (ENV , " JULIA_PYTHONCALL_EXE" , " " )
You can’t perform that action at this time.
0 commit comments