##// END OF EJS Templates
can func_defaults...
MinRK -
Show More
@@ -84,7 +84,10 b' class CannedFunction(CannedObject):'
84 def __init__(self, f):
84 def __init__(self, f):
85 self._check_type(f)
85 self._check_type(f)
86 self.code = f.func_code
86 self.code = f.func_code
87 self.defaults = f.func_defaults
87 if f.func_defaults:
88 self.defaults = [ can(fd) for fd in f.func_defaults ]
89 else:
90 self.defaults = None
88 self.module = f.__module__ or '__main__'
91 self.module = f.__module__ or '__main__'
89 self.__name__ = f.__name__
92 self.__name__ = f.__name__
90 self.buffers = []
93 self.buffers = []
@@ -104,7 +107,11 b' class CannedFunction(CannedObject):'
104
107
105 if g is None:
108 if g is None:
106 g = {}
109 g = {}
107 newFunc = FunctionType(self.code, g, self.__name__, self.defaults)
110 if self.defaults:
111 defaults = tuple(uncan(cfd, g) for cfd in self.defaults)
112 else:
113 defaults = None
114 newFunc = FunctionType(self.code, g, self.__name__, defaults)
108 return newFunc
115 return newFunc
109
116
110
117
General Comments 0
You need to be logged in to leave comments. Login now