1414def _assert_rpythonic (func ):
1515 """Raise ValueError if ``func`` is obviously not RPython"""
1616 try :
17- func .func_code .co_cellvars
17+ func .__code__ .co_cellvars
1818 except AttributeError :
1919 raise ValueError ("%r is not RPython: it is likely an unexpected "
2020 "built-in function or type" % (func ,))
2121 if getattr (func , "_not_rpython_" , False ):
2222 raise ValueError ("%r is tagged as @not_rpython" % (func ,))
23- if func .func_doc and func .func_doc .lstrip ().startswith ('NOT_RPYTHON' ):
23+ if func .__doc__ and func .__doc__ .lstrip ().startswith ('NOT_RPYTHON' ):
2424 raise ValueError ("%r is tagged as NOT_RPYTHON" % (func ,))
25- if func .func_code .co_cellvars :
25+ if func .__code__ .co_cellvars :
2626 raise ValueError (
2727"""RPython functions cannot create closures
2828Possible causes:
2929 Function is inner function
3030 Function uses generator expressions
3131 Lambda expressions
3232in %r""" % (func ,))
33- if not (func .func_code .co_flags & CO_NEWLOCALS ):
33+ if not (func .__code__ .co_flags & CO_NEWLOCALS ):
3434 raise ValueError ("The code object for a RPython function should have "
3535 "the flag CO_NEWLOCALS set." )
3636
@@ -43,7 +43,7 @@ def build_flow(func):
4343 if (isgeneratorfunction (func ) and
4444 not hasattr (func , '_generator_next_method_of_' )):
4545 return make_generator_entry_graph (func )
46- code = HostCode ._from_code (func .func_code )
46+ code = HostCode ._from_code (func .__code__ )
4747 graph = PyGraph (func , code )
4848 ctx = FlowContext (graph , code )
4949 ctx .build_flow ()
0 commit comments