pypy/module/cpyext/test/test_misc.py::AppTestMisc::()::test_pyos_inputhook
self = <CallInfo when='setup' exception: CompilationError(out="""
""")>
func = <function <lambda> at 0x00000271736fe908>, when = 'setup'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
..\_pytest\runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
..\_pytest\runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_setup'>
kwargs = {'__multicall__': <_MultiCall 0 results, 5 meths, kwargs={'item': <AppTestMethod 'test_pyos_inputhook'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_pyos_inputhook'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
..\_pytest\vendored_packages\pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x000002716b621478>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000027172c446a0>, <_pytest.vendored_packages.pluggy.HookImp...y.HookImpl instance at 0x000002716bae8660>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x000002716bae86a0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 5 meths, kwargs={'item': <AppTestMethod 'test_pyos_inputhook'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_pyos_inputhook'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
..\_pytest\vendored_packages\pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000027172c446a0>, <_pytest.vendored_packages.pluggy.HookImp...y.HookImpl instance at 0x000002716bae8660>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x000002716bae86a0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 5 meths, kwargs={'item': <AppTestMethod 'test_pyos_inputhook'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_pyos_inputhook'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
..\_pytest\vendored_packages\pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 5 meths, kwargs={'item': <AppTestMethod 'test_pyos_inputhook'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
..\_pytest\vendored_packages\pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_setup at 0x0000027171c9e2c8>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 5 meths, kwargs={'i..._inputhook'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
..\_pytest\vendored_packages\pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x00000271724770a0>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
..\_pytest\vendored_packages\pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x00000271724770a0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 5 meths, kwargs={'i..._inputhook'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 5 meths, kwargs={'item': <AppTestMethod 'test_pyos_inputhook'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
..\_pytest\vendored_packages\pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_pyos_inputhook'>
@pytest.hookimpl(tryfirst=True)
def pytest_runtest_setup(item):
if isinstance(item, pytest.Function):
config = item.config
if get_marker(item, name='pypy_only'):
if config.applevel is not None and not config.applevel.is_pypy:
pytest.skip('PyPy-specific test')
appclass = item.getparent(pytest.Class)
if appclass is not None:
from pypy.tool.pytest.objspace import gettestobjspace
# Make cls.space and cls.runappdirect available in tests.
spaceconfig = getattr(appclass.obj, 'spaceconfig', {})
> appclass.obj.space = gettestobjspace(**spaceconfig)
conftest.py:259:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
kwds = {'objspace.disable_entrypoints_in_cffi': True, 'objspace.std.withspecialisedtuple': True, 'usemodules': ['cpyext', 'thread', 'struct', 'array', 'itertools', 'time', ...]}
config = <rpython.config.config.Config object at 0x00000271724b7050>
key = (((True, True, True, False, True, True, ...), True, None, False, None, False, ...), False, (False, 'lltype', 'c', True, True, 'ref', ...))
def gettestobjspace(**kwds):
""" helper for instantiating and caching spaces for testing.
"""
try:
config = make_config(option, **kwds)
except ConflictConfigError as e:
# this exception is typically only raised if a module is not available.
# in this case the test should be skipped
py.test.skip(str(e))
if getattr(option, 'runappdirect', None):
return TinyObjSpace()
key = config.getkey()
try:
return _SPACECACHE[key]
except KeyError:
> space = maketestobjspace(config)
tool\pytest\objspace.py:24:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
config = <rpython.config.config.Config object at 0x00000271724b7050>
def maketestobjspace(config=None):
if config is None:
config = make_config(option)
if config.objspace.usemodules.thread:
config.translation.thread = True
config.objspace.extmodules = 'pypy.tool.pytest.fake_pytest'
> space = make_objspace(config)
tool\pytest\objspace.py:34:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
config = <rpython.config.config.Config object at 0x00000271724b7050>
def make_objspace(config):
from pypy.objspace.std.objspace import StdObjSpace
> return StdObjSpace(config)
tool\option.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
config = <rpython.config.config.Config object at 0x00000271724b7050>
@not_rpython
def __init__(self, config=None):
"Basic initialization of objects."
self.w_default_importlib_import = None
self.fromcache = InternalSpaceCache(self).getorbuild
self.threadlocals = ThreadLocals()
# set recursion limit
# sets all the internal descriptors
if config is None:
from pypy.config.pypyoption import get_pypy_config
config = get_pypy_config(translating=False)
self.config = config
self.reverse_debugging = config.translation.reverse_debugger
self.builtin_modules = {}
self.reloading_modules = {}
self.interned_strings = make_weak_value_dictionary(self, str, W_Root)
self.actionflag = ActionFlag() # changed by the signal module
self.check_signal_action = None # changed by the signal module
make_finalizer_queue(W_Root, self)
self._code_of_sys_exc_info = None
self._builtin_functions_by_identifier = {'': None}
# can be overridden to a subclass
> self.initialize()
interpreter\baseobjspace.py:481:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
@not_rpython
def initialize(self):
"""only for initializing the space
Setup all the object types and implementations.
"""
setup_prebuilt(self)
self.FrameClass = frame.build_frame(self)
self.StringObjectCls = W_BytesObject
self.UnicodeObjectCls = W_UnicodeObject
self.IntObjectCls = W_IntObject
self.FloatObjectCls = W_FloatObject
# singletons
self.w_None = W_NoneObject.w_None
self.w_False = W_BoolObject.w_False
self.w_True = W_BoolObject.w_True
self.w_NotImplemented = self.wrap(special.NotImplemented())
self.w_Ellipsis = self.wrap(special.Ellipsis())
self.w_DisallowNew = self.wrap(special.DisallowNew())
# types
builtin_type_classes = {
W_BoolObject.typedef: W_BoolObject,
W_BytearrayObject.typedef: W_BytearrayObject,
W_BytesObject.typedef: W_BytesObject,
W_ComplexObject.typedef: W_ComplexObject,
W_DictMultiObject.typedef: W_DictMultiObject,
W_FloatObject.typedef: W_FloatObject,
W_IntObject.typedef: W_AbstractIntObject,
W_AbstractSeqIterObject.typedef: W_AbstractSeqIterObject,
W_ListObject.typedef: W_ListObject,
W_MemoryView.typedef: W_MemoryView,
W_NoneObject.typedef: W_NoneObject,
W_ObjectObject.typedef: W_ObjectObject,
W_SetObject.typedef: W_SetObject,
W_FrozensetObject.typedef: W_FrozensetObject,
W_SliceObject.typedef: W_SliceObject,
W_TupleObject.typedef: W_TupleObject,
W_TypeObject.typedef: W_TypeObject,
W_UnicodeObject.typedef: W_UnicodeObject,
}
self.builtin_types = {}
self._interplevel_classes = {}
for typedef, cls in builtin_type_classes.items():
w_type = self.gettypeobject(typedef)
self.builtin_types[typedef.name] = w_type
setattr(self, 'w_' + typedef.name, w_type)
self._interplevel_classes[w_type] = cls
# The loop above sets space.w_str and space.w_bytes.
# We rename 'space.w_str' to 'space.w_unicode' and
# 'space.w_text'.
self.w_unicode = self.w_str
self.w_text = self.w_str
del self.w_str
self.w_long = self.w_int
self.w_dict.flag_map_or_seq = 'M'
from pypy.objspace.std import dictproxyobject
dictproxyobject._set_flag_map_or_seq(self)
self.w_list.flag_map_or_seq = 'S'
self.w_tuple.flag_map_or_seq = 'S'
self.builtin_types['str'] = self.w_unicode
self.builtin_types['bytes'] = self.w_bytes
self.builtin_types["NotImplemented"] = self.w_NotImplemented
self.builtin_types["Ellipsis"] = self.w_Ellipsis
# exceptions & builtins
> self.make_builtins()
objspace\std\objspace.py:115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
@not_rpython
def make_builtins(self):
"only for initializing the space."
from pypy.module.exceptions.moduledef import Module
w_name = self.newtext('__exceptions__')
self.exceptions_module = Module(self, w_name)
self.exceptions_module.install()
from pypy.module.imp.moduledef import Module
w_name = self.newtext('_imp')
mod = Module(self, w_name)
mod.install()
from pypy.module.sys.moduledef import Module
w_name = self.newtext('sys')
self.sys = Module(self, w_name)
self.sys.install()
from pypy.module.__builtin__.moduledef import Module
w_name = self.newtext('builtins')
self.builtin = Module(self, w_name)
w_builtin = self.builtin
w_builtin.install()
self.setitem(self.builtin.w_dict, self.newtext('__builtins__'), w_builtin)
exception_types_w = self.export_builtin_exceptions()
# initialize with "bootstrap types" from objspace (e.g. w_None)
types_w = (self.get_builtin_types().items() +
exception_types_w.items())
for name, w_type in types_w:
self.setitem(self.builtin.w_dict, self.newtext(name), w_type)
# install mixed modules
bootstrap_modules = set(('sys', 'imp', 'builtins', 'exceptions',
'zipimport', '_frozen_importlib'))
for mixedname in self.get_builtinmodule_to_install():
if mixedname not in bootstrap_modules:
> self.install_mixedmodule(mixedname)
interpreter\baseobjspace.py:689:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, mixedname = '_cffi_backend'
@not_rpython
def install_mixedmodule(self, mixedname):
> self.setbuiltinmodule(mixedname)
interpreter\baseobjspace.py:730:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, pkgname = '_cffi_backend'
@not_rpython
def setbuiltinmodule(self, pkgname):
"""load a lazy pypy/module and put it into sys.modules"""
if '.' in pkgname:
fullname = "%s.moduledef" % (pkgname,)
importname = pkgname.rsplit('.', 1)[1]
else:
fullname = "pypy.module.%s.moduledef" % pkgname
importname = pkgname
Module = __import__(fullname,
> None, None, ["Module"]).Module
interpreter\baseobjspace.py:561:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import sys
from pypy.interpreter.mixedmodule import MixedModule
> from rpython.rlib import rdynload, clibffi
module\_cffi_backend\moduledef.py:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
""" Libffi wrapping
"""
from __future__ import with_statement
from rpython.rtyper.tool import rffi_platform
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.rtyper.lltypesystem.lloperation import llop
from rpython.rtyper.tool import rffi_platform
from rpython.rlib.unroll import unrolling_iterable
from rpython.rlib.rarithmetic import intmask, is_emulated_long
from rpython.rlib.objectmodel import we_are_translated
from rpython.rlib.rmmap import alloc
from rpython.rlib.rdynload import dlopen, dlclose, dlsym, dlsym_byordinal
from rpython.rlib.rdynload import DLOpenError, DLLHANDLE
from rpython.rlib import jit, rposix
from rpython.rlib.objectmodel import specialize
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.translator.platform import platform
from rpython.translator import cdir
from platform import machine
import py
import os
import sys
import ctypes
import ctypes.util
# maaaybe isinstance here would be better. Think
_MSVC = platform.name == "msvc"
_MINGW = platform.name == "mingw32"
_WIN32 = _MSVC or _MINGW
_WIN64 = _WIN32 and is_emulated_long
_MAC_OS = platform.name.startswith("darwin")
_LITTLE_ENDIAN = sys.byteorder == 'little'
_BIG_ENDIAN = sys.byteorder == 'big'
_ARM32 = rffi_platform.getdefined('__arm__', '')
_ARM64 = rffi_platform.getdefined('__aarch64', '')
_MAC_OS_ARM64 = _MAC_OS and _ARM64
if _WIN32:
from rpython.rlib import rwin32
separate_module_sources = ['''
#include <stdio.h>
#include <windows.h>
/* Get the module where the "fopen" function resides in */
RPY_EXTERN
HMODULE pypy_get_libc_handle(void) {
MEMORY_BASIC_INFORMATION mi;
char buf[1000];
memset(&mi, 0, sizeof(mi));
if( !VirtualQueryEx(GetCurrentProcess(), &fopen, &mi, sizeof(mi)) )
return (HMODULE)0;
GetModuleFileName((HMODULE)mi.AllocationBase, buf, 500);
return (HMODULE)mi.AllocationBase;
}
''']
post_include_bits = ['RPY_EXTERN HMODULE pypy_get_libc_handle(void);\n',]
else:
separate_module_sources = []
post_include_bits = []
if not _WIN32:
includes = ['ffi.h']
if _MAC_OS:
pre_include_bits = ['#define MACOSX\n#define USE_FFI_CLOSURE_ALLOC 1']
else:
pre_include_bits = []
library_dirs = platform.library_dirs_for_libffi()
libraries = ['ffi']
link_files = []
for libdir in library_dirs:
candidate = os.path.join(libdir, "libffi.a")
if os.path.exists(candidate):
link_files.append(candidate)
libraries = []
eci = ExternalCompilationInfo(
pre_include_bits = pre_include_bits,
includes = includes,
libraries = libraries,
separate_module_sources = separate_module_sources,
post_include_bits = post_include_bits,
include_dirs = platform.include_dirs_for_libffi(),
library_dirs = library_dirs,
link_files = link_files,
testonly_libraries = ['ffi'],
)
elif _MINGW:
includes = ['ffi.h']
libraries = ['libffi-5']
eci = ExternalCompilationInfo(
libraries = libraries,
includes = includes,
separate_module_sources = separate_module_sources,
post_include_bits = post_include_bits,
)
eci = rffi_platform.configure_external_library(
'ffi-5', eci,
[dict(prefix='libffi-',
include_dir='include', library_dir='.libs'),
dict(prefix=r'c:\\mingw64', include_dir='include', library_dir='lib'),
])
else:
eci = ExternalCompilationInfo(
includes = ['ffi.h', 'windows.h'],
libraries = ['kernel32', 'libffi-8'],
separate_module_sources = separate_module_sources,
post_include_bits = post_include_bits,
)
FFI_TYPE_P = lltype.Ptr(lltype.ForwardReference())
FFI_TYPE_PP = rffi.CArrayPtr(FFI_TYPE_P)
FFI_TYPE_NULL = lltype.nullptr(FFI_TYPE_P.TO)
class CConfig:
_compilation_info_ = eci
FFI_OK = rffi_platform.ConstantInteger('FFI_OK')
FFI_BAD_TYPEDEF = rffi_platform.ConstantInteger('FFI_BAD_TYPEDEF')
FFI_DEFAULT_ABI = rffi_platform.ConstantInteger('FFI_DEFAULT_ABI')
if _WIN32 and not _WIN64:
FFI_STDCALL = rffi_platform.ConstantInteger('FFI_STDCALL')
if _ARM32:
FFI_SYSV = rffi_platform.ConstantInteger('FFI_SYSV')
FFI_VFP = rffi_platform.ConstantInteger('FFI_VFP')
FFI_TYPE_STRUCT = rffi_platform.ConstantInteger('FFI_TYPE_STRUCT')
size_t = rffi_platform.SimpleType("size_t", rffi.ULONG)
ffi_abi = rffi_platform.SimpleType("ffi_abi", rffi.USHORT)
ffi_arg = rffi_platform.SimpleType("ffi_arg", lltype.Signed)
ffi_type = rffi_platform.Struct('ffi_type', [('size', rffi.ULONG),
('alignment', rffi.USHORT),
('type', rffi.USHORT),
('elements', FFI_TYPE_PP)])
ffi_cif = rffi_platform.Struct('ffi_cif', [])
ffi_closure = rffi_platform.Struct('ffi_closure',
[('user_data', rffi.VOIDP)])
def add_simple_type(type_name):
for name in ['size', 'alignment', 'type']:
setattr(CConfig, type_name + '_' + name,
rffi_platform.ConstantInteger(type_name + '.' + name))
def configure_simple_type(type_name):
l = lltype.malloc(FFI_TYPE_P.TO, flavor='raw', immortal=True)
for tp, name in [(size_t, 'size'),
(rffi.USHORT, 'alignment'),
(rffi.USHORT, 'type')]:
value = getattr(cConfig, '%s_%s' % (type_name, name))
setattr(l, 'c_' + name, rffi.cast(tp, value))
l.c_elements = lltype.nullptr(FFI_TYPE_PP.TO)
return l
base_names = ['double', 'uchar', 'schar', 'sshort', 'ushort', 'uint', 'sint',
# ffi_type_slong and ffi_type_ulong are omitted because
# their meaning changes too much from one libffi version to
# another. DON'T USE THEM! use cast_type_to_ffitype().
'float', 'longdouble', 'pointer', 'void',
# by size
'sint8', 'uint8', 'sint16', 'uint16', 'sint32', 'uint32',
'sint64', 'uint64']
type_names = ['ffi_type_%s' % name for name in base_names]
for i in type_names:
add_simple_type(i)
class cConfig:
pass
> for k, v in rffi_platform.configure(CConfig).items():
..\rpython\rlib\clibffi.py:184:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CConfig = <class rpython.rlib.clibffi.CConfig at 0x0000027170b91130>
ignore_errors = False
def configure(CConfig, ignore_errors=False):
"""Examine the local system by running the C compiler.
The CConfig class contains CConfigEntry attribues that describe
what should be inspected; configure() returns a dict mapping
names to the results.
"""
for attr in ['_includes_', '_libraries_', '_sources_', '_library_dirs_',
'_include_dirs_', '_header_']:
assert not hasattr(CConfig, attr), \
"Found legacy attribute %s on CConfig" % attr
eci = CConfig._compilation_info_
entries = {}
for key in dir(CConfig):
value = getattr(CConfig, key)
if isinstance(value, CConfigEntry):
entries[key] = value
res = {}
if entries: # can be empty if there are only CConfigSingleEntries
results = configure_entries(
entries.values(), eci, ignore_errors=ignore_errors)
> for name, result in zip(entries, results):
..\rpython\rtyper\tool\rffi_platform.py:216:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
entries = [<rpython.rtyper.tool.rffi_platform.ConstantInteger object at 0x0000027170b914b0>, <rpython.rtyper.tool.rffi_platform....leType object at 0x0000027170b91e88>, <rpython.rtyper.tool.rffi_platform.SimpleType object at 0x0000027170b91ec0>, ...]
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('ffi.h', 'windows.h')...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
ignore_errors = False
def configure_entries(entries, eci, ignore_errors=False):
writer = _CWriter(eci)
writer.write_header()
for i, entry in enumerate(entries):
writer.write_entry(str(i), entry)
writer.start_main()
for i, entry in enumerate(entries):
writer.write_entry_main(str(i))
writer.close()
infolist = list(run_example_code(
> writer.path, eci, ignore_errors=ignore_errors))
..\rpython\rtyper\tool\rffi_platform.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filepath = local('d:\\systemtemp\\pytest\\usession-py3.12-1602\\platcheck_88.c')
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('ffi.h', 'windows.h')...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
ignore_errors = False
def run_example_code(filepath, eci, ignore_errors=False):
eci = eci.convert_sources_to_files()
files = [filepath]
> output = build_executable_cache(files, eci, ignore_errors=ignore_errors)
..\rpython\rtyper\tool\rffi_platform.py:745:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
c_files = [local('d:\\systemtemp\\pytest\\usession-py3.12-1602\\platcheck_88.c')]
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('ffi.h', 'windows.h')...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
ignore_errors = False
def build_executable_cache(c_files, eci, ignore_errors=False):
"Builds and run a program; caches the result"
# Import 'platform' every time, the compiler may have been changed
from rpython.translator.platform import platform
path = cache_file_path(c_files, eci, 'build_executable_cache')
try:
return path.read()
except py.error.Error:
_previous = platform.log_errors
try:
if ignore_errors:
platform.log_errors = False
> result = platform.execute(platform.compile(c_files, eci))
..\rpython\tool\gcc_cache.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>
cfiles = [local('d:\\systemtemp\\pytest\\usession-py3.12-1602\\platcheck_88.c')]
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('ffi.h', 'windows.h')...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = None, standalone = True
def compile(self, cfiles, eci, outputfilename=None, standalone=True):
> ofiles = self._compile_o_files(cfiles, eci, standalone)
..\rpython\translator\platform\__init__.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>
cfiles = [local('d:\\systemtemp\\pytest\\usession-py3.12-1602\\platcheck_88.c'), local('d:\\systemtemp\\pytest\\usession-py3.12-1602\\module_cache\\module_7.c')]
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('ffi.h', 'windows.h')...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
standalone = True
def _compile_o_files(self, cfiles, eci, standalone=True):
cfiles = self._all_cfiles(cfiles, eci)
compile_args = self._compile_args_from_eci(eci, standalone)
ofiles = []
for cfile in cfiles:
# Windows hack: use masm for files ending in .asm
if str(cfile).lower().endswith('.asm'):
ofiles.append(self._compile_c_file(self.masm, cfile, []))
else:
> ofiles.append(self._compile_c_file(self.cc, cfile, compile_args))
..\rpython\translator\platform\__init__.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'cl.exe'
cfile = local('d:\\systemtemp\\pytest\\usession-py3.12-1602\\module_cache\\module_7.c')
compile_args = ['/MD', '/O2', '/Fdd:\\systemtemp\\pytest\\usession-py3.12-1602\\module_cache\\']
def _compile_c_file(self, cc, cfile, compile_args):
oname = self._make_o_file(cfile, ext='obj')
# notabene: (tismer)
# This function may be called for .c but also .asm files.
# The c compiler accepts any order of arguments, while
# the assembler still has the old behavior that all options
# must come first, and after the file name all options are ignored.
# So please be careful with the order of parameters! ;-)
pdb_dir = oname.dirname
if pdb_dir:
compile_args = compile_args + ['/Fd%s\\' % (pdb_dir,)]
args = ['/nologo', '/c'] + compile_args + ['/Fo%s' % (oname,), str(cfile)]
> self._execute_c_compiler(cc, args, oname)
..\rpython\translator\platform\windows.py:290:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'cl.exe'
args = ['/nologo', '/c', '/MD', '/O2', '/Fdd:\\systemtemp\\pytest\\usession-py3.12-1602\\module_cache\\', '/Fod:\\systemtemp\\pytest\\usession-py3.12-1602\\module_cache\\module_7.obj', ...]
outname = local('d:\\systemtemp\\pytest\\usession-py3.12-1602\\module_cache\\module_7.obj')
cwd = None
def _execute_c_compiler(self, cc, args, outname, cwd=None):
#log.execute(cc + ' ' + ' '.join(args))
# 'cc' can also contain some options for the C compiler;
# e.g. it can be "gcc -m32". We handle it by splitting on ' '.
cclist = cc.split()
cc = cclist[0]
args = cclist[1:] + args
returncode, stdout, stderr = _run_subprocess(cc, args, self.c_environ,
cwd)
> self._handle_error(returncode, stdout, stderr, outname)
..\rpython\translator\platform\__init__.py:143:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, returncode = 3221225477, stdout = ''
stderr = ''
outname = local('d:\\systemtemp\\pytest\\usession-py3.12-1602\\module_cache\\module_7.obj')
def _handle_error(self, returncode, stdout, stderr, outname):
if returncode != 0:
# Microsoft compilers write compilation errors to stdout
stderr = stdout + stderr
errorfile = outname.new(ext='errors')
errorfile.write(stderr, mode='wb')
if self.log_errors:
stderrlines = stderr.splitlines()
for line in stderrlines:
log.Error(line)
# ^^^ don't use ERROR, because it might actually be fine.
# Also, ERROR confuses lib-python/conftest.py.
> raise CompilationError(stdout, stderr)
E CompilationError: CompilationError(out="""
E """)
..\rpython\translator\platform\windows.py:319: CompilationError
(somefailed=True in module/cpyext/test/test_misc.py)
builder: own-win-x86-64 build #2404+
test: pypy/module/cpyext/test/test_misc.py::AppTestMisc::()::test_pyos_inputhook