Skip to content

Commit 2047c7d

Browse files
committed
convert single function defined via exec() due to Python2/3 differences
1 parent 5e33b75 commit 2047c7d

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

dill/source.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -506,24 +506,6 @@ def outdent(code, spaces=None, all=True):
506506

507507

508508
#XXX: not sure what the point of _wrap is...
509-
#exec_ = lambda s, *a: eval(compile(s, '<string>', 'exec'), *a)
510-
__globals__ = globals()
511-
__locals__ = locals()
512-
wrap2 = '''
513-
def _wrap(f):
514-
""" encapsulate a function and it's __import__ """
515-
def func(*args, **kwds):
516-
try:
517-
# _ = eval(getsource(f, force=True)) #XXX: safer but less robust
518-
exec getimportable(f, alias='_') in %s, %s
519-
except:
520-
raise ImportError('cannot import name ' + f.__name__)
521-
return _(*args, **kwds)
522-
func.__name__ = f.__name__
523-
func.__doc__ = f.__doc__
524-
return func
525-
''' % ('__globals__', '__locals__')
526-
wrap3 = '''
527509
def _wrap(f):
528510
""" encapsulate a function and it's __import__ """
529511
def func(*args, **kwds):
@@ -536,9 +518,6 @@ def func(*args, **kwds):
536518
func.__name__ = f.__name__
537519
func.__doc__ = f.__doc__
538520
return func
539-
''' % ('__globals__', '__locals__')
540-
exec(wrap3)
541-
del wrap2, wrap3
542521

543522

544523
def _enclose(object, alias=''): #FIXME: needs alias to hold returned object

0 commit comments

Comments
 (0)