pypy/module/cpyext/test/test_frameobject.py::AppTestFrameObject::()::test_forge_frame
self = <CallInfo when='call' exception: Subprocess failed with exit code 1:
In file included from /build_dir/pypy-c-jit-linux...)
distutils.compilers.C.errors.CompileError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
>
func = <function <lambda> at 0xf42eeaac>, when = 'call'
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_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_forge_frame'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_forge_frame'>}
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 0xf79e498c>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_forge_frame'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_forge_frame'>}
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_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_forge_frame'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_forge_frame'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_forge_frame'>, '__multicall__': <_MultiCall 0 results, 0 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_call at 0xf42efcd4>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...orge_frame'>, '__multicall__': <_MultiCall 0 results, 0 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 0xf4308dec>
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 0xf4308dec>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...orge_frame'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_forge_frame'>, '__multicall__': <_MultiCall 0 results, 0 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_call at 0xf42eff2c>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...orge_frame'>, '__multicall__': <_MultiCall 0 results, 0 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 0xf43086ec>
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 0xf43086ec>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...orge_frame'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_forge_frame'>, '__multicall__': <_MultiCall 0 results, 0 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_forge_frame'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_forge_frame'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
> **appexec_definitions)
tool/pytest/apptest.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python_ = '/build_dir/pypy-c-jit-linux-x86-32/build/pypy/goal/pypy3.12-c'
target_ = <function test_forge_frame at 0xf481117c>
usemodules = ['cpyext', '_thread', '_struct', 'array', 'itertools', 'time', ...]
definitions = {'compile_module': <bound method AppTestFrameObject.w_compile_module of <pypy.module.cpyext.test.test_frameobject.AppT...eObject.w_import_extension of <pypy.module.cpyext.test.test_frameobject.AppTestFrameObject object at 0xf43089ec>>, ...}
defs = ['def w_compile_module(self, name,\n source_files=None, source_strings=None):\n from extbuild import get_sys...e=prologue,\n include_dirs=include_dirs, more_init=more_init,\n PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)', ...]
symbol = 'udir', value = u'/build_dir/tmp/pytest/usession-py3.12-163'
code = <py._code.code.Code object at 0xf4308bac>
def run_with_python(python_, target_, usemodules, **definitions):
if python_ is None:
py.test.skip("Cannot find the default python3 interpreter to run with -A")
defs = []
for symbol, value in sorted(definitions.items()):
if isinstance(value, tuple) and isinstance(value[0], py.code.Source):
code, args = value
defs.append(str(code))
arg_repr = []
for arg in args:
if isinstance(arg, types.FunctionType):
arg_repr.append(arg.__name__)
elif isinstance(arg, types.MethodType):
arg_repr.append(arg.__name__)
else:
arg_repr.append(py3k_repr(arg))
args = ', '.join(arg_repr)
defs.append("self.%s = anonymous(%s)\n" % (symbol, args))
elif isinstance(value, types.MethodType):
# "def w_method(self)"
code = py.code.Code(value)
defs.append(str(code.source()))
defs.append("type(self).%s = %s\n" % (symbol, value.__name__))
elif isinstance(value, types.ModuleType):
name = value.__name__
defs.append("import %s; self.%s = %s\n" % (name, symbol, name))
elif isinstance(value, (str, unicode, int, long, float, list, tuple,
dict)) or value is None:
defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
check_usemodules = ''
if usemodules:
usemodules = [_rename_module(name) for name in usemodules]
check_usemodules = """\
missing = set(%r).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
source.pop(0)
source = source[1:]
pyfile = udir.join('src.py')
if isinstance(target_, str):
# Special case of a docstring; the function name is the first word.
target_name = target_.split('(', 1)[0]
else:
target_name = target_.__name__
with pyfile.open('w') as f:
f.write(helpers % (pypyroot, check_usemodules))
f.write('\n'.join(defs))
f.write('def %s():\n' % target_name)
f.write('\n'.join(source))
f.write("\ntry:\n %s()\n" % target_name)
f.write('finally:\n print("===aefwuiheawiu===")')
helper_dir = os.path.join(pypydir, 'tool', 'cpyext')
env = os.environ.copy()
env['PYTHONPATH'] = helper_dir
res, stdout, stderr = run_subprocess(
python_, [str(pyfile)], env=env)
print pyfile.read()
print "from", str(pyfile)
print >> sys.stdout, stdout
print >> sys.stderr, stderr
if res == 81:
py.test.skip('%r was not compiled w/ required usemodules: %r' %
(python_, usemodules))
elif res != 0:
raise AssertionError(
> "Subprocess failed with exit code %s:\n%s" % (res, stderr))
E AssertionError: Subprocess failed with exit code 1:
E In file included from /build_dir/pypy-c-jit-linux-x86-32/build/include/pypy3.12/Python.h:110,
E from source_0.c:3:
E source_0.c: In function ‘foo_raise_exception’:
E /build_dir/pypy-c-jit-linux-x86-32/build/include/pypy3.12/pypy_decl.h:99:20: error: too few arguments to function ‘PyPyCode_New’
E 99 | #define PyCode_New PyPyCode_New
E | ^~~~~~~~~~~~
E source_0.c:18:44: note: in expansion of macro ‘PyCode_New’
E 18 | py_code = (PyCodeObject *)PyCode_New(
E | ^~~~~~~~~~
E /build_dir/pypy-c-jit-linux-x86-32/build/include/pypy3.12/pypy_decl.h:99:20: note: declared here
E 99 | #define PyCode_New PyPyCode_New
E | ^~~~~~~~~~~~
E /build_dir/pypy-c-jit-linux-x86-32/build/include/pypy3.12/pypy_decl.h:100:24: note: in expansion of macro ‘PyCode_New’
E 100 | PyAPI_FUNC(PyObject *) PyCode_New(int arg0, int arg1, int arg2, int arg3, int arg4, PyObject * arg5, PyObject * arg6, PyObject * arg7, PyObject * arg8, PyObject * arg9, PyObject * arg10, PyObject * arg11, PyObject * arg12, PyObject * arg13, int arg14, PyObject * arg15, PyObject * arg16);
E | ^~~~~~~~~~
E Traceback (most recent call last):
E File "/build_dir/pypy-c-jit-linux-x86-32/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 83, in spawn
E subprocess.check_call(cmd, env=_inject_macos_ver(env))
E ^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-32/build/lib-python/3/subprocess.py", line 413, in check_call
E raise CalledProcessError(retcode, cmd)
E subprocess.CalledProcessError: Command '['/opt/rh/devtoolset-10/root/usr/bin/gcc', '-pthread', '-DNDEBUG', '-O2', '-fPIC', '-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC', '-I/build_dir/pypy-c-jit-linux-x86-32/build/include/pypy3.12', '-c', 'source_0.c', '-o', 'source_0.o']' returned non-zero exit status 1.
E
E The above exception was the direct cause of the following exception:
E
E Traceback (most recent call last):
E File "/build_dir/pypy-c-jit-linux-x86-32/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 221, in _compile
E self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
E ^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-32/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 1152, in spawn
E spawn(cmd, **kwargs)
E File "/build_dir/pypy-c-jit-linux-x86-32/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 89, in spawn
E raise DistutilsExecError(
E distutils.errors.DistutilsExecError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
E
E During handling of the above exception, another exception occurred:
E
E Traceback (most recent call last):
E File "/build_dir/tmp/pytest/usession-py3.12-163/src.py", line 189, in <module>
E test_forge_frame()
E File "/build_dir/tmp/pytest/usession-py3.12-163/src.py", line 121, in test_forge_frame
E module = self.import_extension('foo', [
E ^^^^^^^^^^^^^^^^
E File "/build_dir/tmp/pytest/usession-py3.12-163/src.py", line 95, in w_import_extension
E return sys_info.import_extension(
E ^^^^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-32/build/pypy/tool/cpyext/extbuild.py", line 96, in import_extension
E return self.import_module(
E ^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-32/build/pypy/tool/cpyext/extbuild.py", line 82, in import_module
E mod = self.compile_extension_module(
E ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-32/build/pypy/tool/cpyext/extbuild.py", line 50, in compile_extension_module
E soname = c_compile(source_files, outputfilename=str(dirname / modname),
E ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-32/build/pypy/tool/cpyext/extbuild.py", line 199, in c_compile
E _build(
E File "/build_dir/pypy-c-jit-linux-x86-32/build/pypy/tool/cpyext/extbuild.py", line 233, in _build
E res = compiler.compile([cfile.basename],
E ^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-32/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 649, in compile
E self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
E ^^^^^^^^
E File "/build_dir/pypy-c-jit-linux-x86-32/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 223, in _compile
E raise CompileError(msg)
E distutils.compilers.C.errors.CompileError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
tool/pytest/apptest.py:239: AssertionError
---------- Captured stdout call ----------
# -*- encoding: utf-8 -*-
if 1:
import sys
sys.path.append('/build_dir/pypy-c-jit-linux-x86-32/build')
missing = set(['cpyext', '_thread', '_struct', 'array', 'itertools', 'time', 'binascii', 'mmap', '_signal', '_cffi_backend']).difference(sys.builtin_module_names)
if missing:
if not hasattr(sys, 'pypy_version_info'):
# They may be extension modules on CPython
name = None
for name in missing.copy():
if name in ['cpyext', '_cffi_backend', '_rawffi']:
missing.remove(name)
continue
try:
__import__(name)
except ImportError:
pass
else:
missing.remove(name)
del name
if missing:
sys.exit(81)
del missing
def skip(message):
print(message)
raise SystemExit(0)
__builtins__.skip = skip
__builtins__.py3k_skip = skip
class ExceptionWrapper:
pass
def raises(exc, *args, **kwargs):
if not args:
return RaisesContext(exc)
func = args[0]
args = args[1:]
import os
try:
if isinstance(func, str):
if func.startswith((' ', os.linesep, '\n')):
# it's probably an indented block, so we prefix if True:
# to avoid SyntaxError
func = "if True:\n" + func
frame = sys._getframe(1)
exec(func, frame.f_globals, frame.f_locals)
else:
func(*args, **kwargs)
except exc as e:
res = ExceptionWrapper()
res.value = e
res.traceback = e.__traceback__
return res
else:
raise AssertionError("DID NOT RAISE")
class RaisesContext(object):
def __init__(self, expected_exception):
self.expected_exception = expected_exception
self.excinfo = None
def __enter__(self):
return self
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
raise AssertionError("DID NOT RAISE")
self.value = tp[1]
return issubclass(tp[0], self.expected_exception)
__builtins__.raises = raises
class Test:
pass
self = Test()
def w_compile_module(self, name,
source_files=None, source_strings=None):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.compile_extension_module(name,
source_files=source_files, source_strings=source_strings)
type(self).compile_module = w_compile_module
def w_debug_collect(self):
import gc
gc.collect()
gc.collect()
gc.collect()
type(self).debug_collect = w_debug_collect
self.here = '/build_dir/pypy-c-jit-linux-x86-32/build/pypy/module/cpyext/test'
def w_import_extension(self, modname, functions, prologue="",
include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_extension(
modname, functions, prologue=prologue,
include_dirs=include_dirs, more_init=more_init,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
type(self).import_extension = w_import_extension
def w_import_module(self, name, init=None, body='', filename=None,
include_dirs=None, PY_SSIZE_T_CLEAN=False, use_imp=False):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_module(
name, init=init, body=body, filename=filename,
include_dirs=include_dirs,
PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
type(self).import_module = w_import_module
def w_load_module(self, mod, name):
from extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.load_module(mod, name)
type(self).load_module = w_load_module
self.runappdirect = True
self.udir = '/build_dir/tmp/pytest/usession-py3.12-163'
def test_forge_frame():
module = self.import_extension('foo', [
("raise_exception", "METH_NOARGS",
"""
PyObject *py_srcfile = PyUnicode_FromString("filename");
PyObject *py_funcname = PyUnicode_FromString("funcname");
PyObject *py_globals = PyDict_New();
PyObject *py_locals = PyDict_New();
PyObject *empty_bytes = PyBytes_FromString("");
PyObject *empty_tuple = PyTuple_New(0);
PyCodeObject *py_code;
PyFrameObject *py_frame = NULL;
py_code = (PyCodeObject *)PyCode_New(
0, /*int argcount,*/
#if PY_MAJOR_VERSION >= 3
0, /*int kwonlyargcount,*/
#endif
0, /*int nlocals,*/
0, /*int stacksize,*/
0, /*int flags,*/
empty_bytes, /*PyObject *code,*/
empty_tuple, /*PyObject *consts,*/
empty_tuple, /*PyObject *names,*/
empty_tuple, /*PyObject *varnames,*/
empty_tuple, /*PyObject *freevars,*/
empty_tuple, /*PyObject *cellvars,*/
py_srcfile, /*PyObject *filename,*/
py_funcname, /*PyObject *qualname,*/
py_funcname, /*PyObject *name,*/
42, /*int firstlineno,*/
empty_bytes /*PyObject *lnotab*/
);
if (!py_code) goto bad;
py_frame = PyFrame_New(
PyThreadState_Get(), /*PyThreadState *tstate,*/
py_code, /*PyCodeObject *code,*/
py_globals, /*PyObject *globals,*/
py_locals /*PyObject *locals*/
);
if (!py_frame) goto bad;
py_frame->f_lineno = 48; /* Does not work with CPython */
PyErr_SetString(PyExc_ValueError, "error message");
PyTraceBack_Here(py_frame);
bad:
Py_XDECREF(py_srcfile);
Py_XDECREF(py_funcname);
Py_XDECREF(empty_bytes);
Py_XDECREF(empty_tuple);
Py_XDECREF(py_globals);
Py_XDECREF(py_locals);
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
return NULL;
"""),
], prologue='#include "frameobject.h"')
exc = raises(ValueError, module.raise_exception)
exc.value.args[0] == 'error message'
frame = exc.traceback.tb_frame
if not self.runappdirect:
frame = exc.traceback.tb_frame
assert frame.f_code.co_filename == "filename"
assert frame.f_code.co_name == "funcname"
# Cython does not work on CPython as well...
assert exc.traceback.tb_lineno in (-1, 42, 48) # should be 48
assert frame.f_lineno in (-1, 42, 48)
try:
test_forge_frame()
finally:
print("===aefwuiheawiu===")
from /build_dir/tmp/pytest/usession-py3.12-163/src.py
===aefwuiheawiu===
---------- Captured stderr call ----------
In file included from /build_dir/pypy-c-jit-linux-x86-32/build/include/pypy3.12/Python.h:110,
from source_0.c:3:
source_0.c: In function ‘foo_raise_exception’:
/build_dir/pypy-c-jit-linux-x86-32/build/include/pypy3.12/pypy_decl.h:99:20: error: too few arguments to function ‘PyPyCode_New’
99 | #define PyCode_New PyPyCode_New
| ^~~~~~~~~~~~
source_0.c:18:44: note: in expansion of macro ‘PyCode_New’
18 | py_code = (PyCodeObject *)PyCode_New(
| ^~~~~~~~~~
/build_dir/pypy-c-jit-linux-x86-32/build/include/pypy3.12/pypy_decl.h:99:20: note: declared here
99 | #define PyCode_New PyPyCode_New
| ^~~~~~~~~~~~
/build_dir/pypy-c-jit-linux-x86-32/build/include/pypy3.12/pypy_decl.h:100:24: note: in expansion of macro ‘PyCode_New’
100 | PyAPI_FUNC(PyObject *) PyCode_New(int arg0, int arg1, int arg2, int arg3, int arg4, PyObject * arg5, PyObject * arg6, PyObject * arg7, PyObject * arg8, PyObject * arg9, PyObject * arg10, PyObject * arg11, PyObject * arg12, PyObject * arg13, int arg14, PyObject * arg15, PyObject * arg16);
| ^~~~~~~~~~
Traceback (most recent call last):
File "/build_dir/pypy-c-jit-linux-x86-32/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 83, in spawn
subprocess.check_call(cmd, env=_inject_macos_ver(env))
^^^^^^^^^^
File "/build_dir/pypy-c-jit-linux-x86-32/build/lib-python/3/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/opt/rh/devtoolset-10/root/usr/bin/gcc', '-pthread', '-DNDEBUG', '-O2', '-fPIC', '-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC', '-I/build_dir/pypy-c-jit-linux-x86-32/build/include/pypy3.12', '-c', 'source_0.c', '-o', 'source_0.o']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/build_dir/pypy-c-jit-linux-x86-32/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 221, in _compile
self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
^^^^^
File "/build_dir/pypy-c-jit-linux-x86-32/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 1152, in spawn
spawn(cmd, **kwargs)
File "/build_dir/pypy-c-jit-linux-x86-32/build/lib/pypy3.12/site-packages/setuptools/_distutils/spawn.py", line 89, in spawn
raise DistutilsExecError(
distutils.errors.DistutilsExecError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/build_dir/tmp/pytest/usession-py3.12-163/src.py", line 189, in <module>
test_forge_frame()
File "/build_dir/tmp/pytest/usession-py3.12-163/src.py", line 121, in test_forge_frame
module = self.import_extension('foo', [
^^^^^^^^^^^^^^^^
File "/build_dir/tmp/pytest/usession-py3.12-163/src.py", line 95, in w_import_extension
return sys_info.import_extension(
^^^^^^^^^^^^^^^^
File "/build_dir/pypy-c-jit-linux-x86-32/build/pypy/tool/cpyext/extbuild.py", line 96, in import_extension
return self.import_module(
^^^^^^^^^^^^^
File "/build_dir/pypy-c-jit-linux-x86-32/build/pypy/tool/cpyext/extbuild.py", line 82, in import_module
mod = self.compile_extension_module(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/build_dir/pypy-c-jit-linux-x86-32/build/pypy/tool/cpyext/extbuild.py", line 50, in compile_extension_module
soname = c_compile(source_files, outputfilename=str(dirname / modname),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/build_dir/pypy-c-jit-linux-x86-32/build/pypy/tool/cpyext/extbuild.py", line 199, in c_compile
_build(
File "/build_dir/pypy-c-jit-linux-x86-32/build/pypy/tool/cpyext/extbuild.py", line 233, in _build
res = compiler.compile([cfile.basename],
^^^^^^^
File "/build_dir/pypy-c-jit-linux-x86-32/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/base.py", line 649, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
^^^^^^^^
File "/build_dir/pypy-c-jit-linux-x86-32/build/lib/pypy3.12/site-packages/setuptools/_distutils/compilers/C/unix.py", line 223, in _compile
raise CompileError(msg)
distutils.compilers.C.errors.CompileError: command '/opt/rh/devtoolset-10/root/usr/bin/gcc' failed with exit code 1
builder: pypy-c-jit-linux-x86-32 build #8377+
test: pypy/module/cpyext/test/test_frameobject.py::AppTestFrameObject::()::test_forge_frame