Commits

Amaury Forgeot d'Arc committed 4a23027

Fix cpyext compilation.

Comments (0)

Files changed (1)

pypy/module/cpyext/api.py

                                TP, compilation_info=eci)
         globals()['va_get_%s' % name_no_star] = func
 
-def setup_init_functions(eci):
+def setup_init_functions(eci, translating):
     init_pycobject = rffi.llexternal('init_pycobject', [], lltype.Void,
                                      compilation_info=eci, _nowrapper=True)
     init_capsule = rffi.llexternal('init_capsule', [], lltype.Void,
         lambda space: init_capsule(),
     ])
     from pypy.module.posix.interp_posix import add_fork_hook
-    if we_are_translated():
+    if translating:
         reinit_tls = rffi.llexternal('PyThread_ReInitTLS', [], lltype.Void,
                                      compilation_info=eci)
     else:
 
     setup_va_functions(eci)
 
-    setup_init_functions(eci)
+    setup_init_functions(eci, translating=False)
     return modulename.new(ext='')
 
 def generate_macros(export_symbols, rename=True, do_deref=True):
         deco = entrypoint("cpyext", func.argtypes, name, relax=True)
         deco(func.get_wrapper(space))
 
-    setup_init_functions(eci)
+    setup_init_functions(eci, translating=True)
     trunk_include = pypydir.dirpath() / 'include'
     copy_header_files(trunk_include)