Commit b3c92491 authored by Matti Picus's avatar Matti Picus
Browse files

redo d137aaa8fb1a to enable the sys_flags on windows

parent a50f8ba2853c
Pipeline #19241 passed with stage
in 7 minutes and 30 seconds
......@@ -1188,21 +1188,31 @@ def attach_c_functions(space, eci, prefix):
state.C.tuple_new = rffi.llexternal(
'_PyPy_tuple_new', [PyTypeObjectPtr, PyObject, PyObject], PyObject,
compilation_info=eci, _nowrapper=True)
do_setters = True
if we_are_translated():
eci_flags = eci
elif sys.platform == "win32":
do_setters = False
eci_flags = eci
# To get this to work in tests, we need a new eci
libs = eci.get_module_files()[1].libraries
# To get this to work in tests, we need a new eci to
# link to the Note that all this linking
# will only happen for tests, when translating the link args here
# are irrelevant.
library_dirs = eci.library_dirs
link_extra = list(eci.link_extra)
link_files = eci.link_files
if sys.platform == "win32":
# since we include Python.h, we must disable linking with
# the regular import lib
from pypy.module.sys import version
ver = version.CPYTHON_VERSION[:2]
link_extra.append("/NODEFAULTLIB:Python%d%d.lib" % ver)
# for testing, make sure "pypyapi.lib" is linked in
link_extra += [x.replace('dll', 'lib') for x in eci.libraries]
eci_flags = ExternalCompilationInfo(
link_extra = libs,
link_extra = link_extra,
link_files = link_files,
library_dirs = library_dirs,
if do_setters:
state.C.flag_setters = {}
for c_name, attr in _flags:
_, setter = rffi.CExternVariable(rffi.SIGNED, c_name, eci_flags,
......@@ -1210,7 +1220,6 @@ def attach_c_functions(space, eci, prefix):
state.C.flag_setters[attr] = setter
def init_function(func):
return func
......@@ -1225,10 +1234,6 @@ def run_bootstrap_functions(space):
def init_flags(space):
do_setters = True
if not we_are_translated() and sys.platform == "win32":
do_setters = False
if do_setters:
state = space.fromcache(State)
for _, attr in _flags:
f = state.C.flag_setters[attr]
......@@ -1550,7 +1555,7 @@ def build_eci(code, use_micronumpy=False, translating=False):
# '%s' undefined; assuming extern returning int
# Sometimes the library is wrapped into another DLL, ensure that
# the correct bootstrap code is installed
# the correct bootstrap code is installed.
kwds["link_extra"] = ["msvcrt.lib"]
elif sys.platform.startswith('linux'):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment