Skip to content

Commit 14f77cc

Browse files
authored
fix PyCall.__init__ when no __main__ present (#819)
1 parent bfc59b8 commit 14f77cc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/pyinit.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,10 @@ function __init__()
232232
# function (in particular, `self` won't be passed to it). The solution is:
233233
# obj[:foo] = jlfun2pyfun(some_julia_function)
234234
# This is a bit of a kludge, obviously.
235-
copy!(jlfun2pyfun,
236-
pyeval_("""lambda f: lambda *args, **kwargs: f(*args, **kwargs)"""))
235+
copy!(
236+
jlfun2pyfun,
237+
pyeval_("lambda f: lambda *args, **kwargs: f(*args, **kwargs)", pynamespace(PyCall), pynamespace(PyCall))
238+
)
237239

238240
if !already_inited
239241
# some modules (e.g. IPython) expect sys.argv to be set

0 commit comments

Comments
 (0)