Skip to content

Commit 9dfc132

Browse files
tkfstevengj
authored andcommitted
Avoid recursion during error handling (#176)
1 parent e617ad9 commit 9dfc132

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

julia/core.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,12 @@ def using(self, module):
520520
self.eval("using %s" % module)
521521

522522

523-
class LegacyJulia(Julia):
523+
class LegacyJulia(object):
524+
__doc__ = Julia.__doc__
525+
526+
def __init__(self, *args, **kwargs):
527+
self.__julia = Julia(*args, **kwargs)
528+
__init__.__doc__ = Julia.__init__.__doc__
524529

525530
def __getattr__(self, name):
526531
from julia import Main
@@ -529,7 +534,10 @@ def __getattr__(self, name):
529534
" deprecated. Use `from julia import Main; Main.<name>` or"
530535
" `jl = Julia(); jl.eval('<name>')`.",
531536
DeprecationWarning)
532-
return getattr(Main, name)
537+
try:
538+
return getattr(self.__julia, name)
539+
except AttributeError:
540+
return getattr(Main, name)
533541

534542

535543
sys.meta_path.append(JuliaImporter())

0 commit comments

Comments
 (0)