提交 7b3b7d29 authored 作者: David Warde-Farley's avatar David Warde-Farley 提交者: Arnaud Bergeron

Python 3-compatible function attributes.

上级 feabe7f9
......@@ -35,7 +35,7 @@ def Op_to_RoutineDoc(op, routine_doc, module_name=None):
# Set the routine's line number.
if hasattr(func, 'func_code'):
routine_doc.lineno = func.func_code.co_firstlineno
routine_doc.lineno = func.__code__.co_firstlineno
else:
# [XX] I should probably use UNKNOWN here??
# dvarrazzo: if '...' is to be changed, also check that
......
......@@ -1770,9 +1770,8 @@ class _Linker(gof.link.LocalLinker):
# Pure ops don't really have a perform ( or their perform just
# raises an not implemented exception), so in those cases we
# consider that we don't have a python implementation
if ((self.maker.mode.check_py_code or thunks_c[-1] is None) and
(node.op.perform.func_code !=
gof.op.PureOp.perform.func_code)):
if (self.maker.mode.check_py_code or thunks_c[-1] is None) and \
node.op.perform.__code__ != gof.op.PureOp.perform.__code__:
thunk = node.op.make_py_thunk(node, storage_map, compute_map,
no_recycling)
thunks_py.append(thunk)
......
......@@ -306,7 +306,7 @@ FALL_THROUGH = Keyword("FALL_THROUGH")
def comm_guard(type1, type2):
def wrap(f):
old_f = f.func_globals[f.__name__]
old_f = f.__globals__[f.__name__]
def new_f(arg1, arg2, *rest):
if ((type1 is ANY_TYPE or isinstance(arg1, type1)) and
......@@ -345,7 +345,7 @@ def comm_guard(type1, type2):
def type_guard(type1):
def wrap(f):
old_f = f.func_globals[f.__name__]
old_f = f.__globals__[f.__name__]
def new_f(arg1, *rest):
if (type1 is ANY_TYPE or isinstance(arg1, type1)):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论