Skip to content

Commit

Permalink
Use Base.require in core.Julia
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Aug 3, 2020
1 parent 97ca0ec commit 19d1965
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/julia/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from .libjulia import UNBOXABLE_TYPES, LibJulia, get_inprocess_libjulia, get_libjulia
from .options import JuliaOptions, options_docs
from .release import __version__
from .utils import is_windows
from .utils import IMPORT_PYCALL, is_windows

try:
from shutil import which
Expand Down Expand Up @@ -500,7 +500,7 @@ def __init__(self, init_julia=True, jl_init_path=None, runtime=None,

# Currently, PyJulia assumes that `Main.PyCall` exsits. Thus, we need
# to import `PyCall` again here in case `init_julia=False` is passed:
self._call(u"using PyCall")
self._call(IMPORT_PYCALL)

# Whether we initialized Julia or not, we MUST create at least one
# instance of PyObject and the convert function. Since these will be
Expand Down
6 changes: 6 additions & 0 deletions src/julia/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ def _execprog_subprocess(cmd):
execprog = _execprog_subprocess
else:
execprog = _execprog_os


PYCALL_PKGID = """\
Base.PkgId(Base.UUID("438e738f-606a-5dbb-bf0a-cddfbfd45ab0"), "PyCall")"""

IMPORT_PYCALL = "const PyCall = Base.require({})".format(PYCALL_PKGID)

0 comments on commit 19d1965

Please sign in to comment.