##// END OF EJS Templates
still allow @interactive on Classes
MinRK -
Show More
@@ -222,16 +222,17 b' def interactive(f):'
222 222 This results in the function being linked to the user_ns as globals()
223 223 instead of the module globals().
224 224 """
225 mainmod = __import__('__main__')
226 225
227 226 # build new FunctionType, so it can have the right globals
228 227 # interactive functions never have closures, that's kind of the point
229 f2 = FunctionType(f.__code__, mainmod.__dict__,
230 f.__name__, f.__defaults__,
231 )
228 if isinstance(f, FunctionType):
229 mainmod = __import__('__main__')
230 f = FunctionType(f.__code__, mainmod.__dict__,
231 f.__name__, f.__defaults__,
232 )
232 233 # associate with __main__ for uncanning
233 f2.__module__ = '__main__'
234 return f2
234 f.__module__ = '__main__'
235 return f
235 236
236 237 @interactive
237 238 def _push(**ns):
General Comments 0
You need to be logged in to leave comments. Login now