pypy/module/pypyjit/test/test_jit_hook.py::AppTestJitHook::()::test_on_compile_exception
self = <CallInfo when='call' exception: CompilationError(out="""
""")>
func = <function <lambda> at 0x00000170a3ddc890>, 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, 1 meths, kwargs={'item': <AppTestMethod 'test_on_compile_exception'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_on_compile_exception'>}
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 0x000001709ecb1600>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000170a0624d20>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_on_compile_exception'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_on_compile_exception'>}
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 = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000170a0624d20>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_on_compile_exception'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_on_compile_exception'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
..\_pytest\vendored_packages\pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_on_compile_exception'>, '__multicall__': <_MultiCall 0 results, 1 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 0x00000170a3de39e8>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._exception'>, '__multicall__': <_MultiCall 0 results, 1 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 0x00000170a3dbeba0>
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 0x00000170a3dbeba0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._exception'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_on_compile_exception'>, '__multicall__': <_MultiCall 0 results, 1 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 0x00000170a3de3948>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._exception'>, '__multicall__': <_MultiCall 0 results, 1 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 0x00000170a3dbeb60>
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 0x00000170a3dbeb60>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._exception'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_on_compile_exception'>, '__multicall__': <_MultiCall 0 results, 1 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_on_compile_exception'>
def pytest_runtest_call(item):
try:
> item.runtest()
..\_pytest\runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_on_compile_exception'>
def runtest(self):
target = self.obj
if self.config.option.runappdirect:
return target()
space = target.im_self.space
filename = self._getdynfilename(target)
func = app2interp_temp(target.im_func, filename=filename)
w_instance = self.parent.w_instance
> self.execute_appex(space, func, space, w_instance)
tool\pytest\apptest.py:89:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_on_compile_exception'>, space = StdObjSpace
target = <function test_on_compile_exception at 0x00000170a3ddc980>
args = (StdObjSpace, <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x00000170a3c090c0>)
def execute_appex(self, space, target, *args):
self.space = space
try:
> target(*args)
tool\pytest\apptest.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x00000170a3c090c0>,)
w_func = <Function test_on_compile_exception>
args = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x00000170a3c090c0>
def appcaller(space, *args_w):
if not isinstance(space, ObjSpace):
raise TypeError("first argument must be a space instance.")
# the last argument can be an Arguments
w_func = self.wget(space, name)
if not args_w:
return space.call_function(w_func)
else:
args = args_w[-1]
assert args is not None
if not isinstance(args, Arguments):
> return space.call_function(w_func, *args_w)
interpreter\gateway.py:1227:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function test_on_compile_exception>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x00000170a3c090c0>,)
nargs = 1, Function = <class 'pypy.interpreter.function.Function'>
Method = <class 'pypy.interpreter.function.Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, Method
if isinstance(w_func, Method):
w_inst = w_func.w_instance
if w_inst is not None:
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_inst, *args_w)
elif args_w and (
self.abstract_isinstance_w(args_w[0], w_func.w_class)):
w_func = w_func.w_function
if isinstance(w_func, Function):
> return w_func.funccall(*args_w)
interpreter\baseobjspace.py:1210:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function test_on_compile_exception>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x00000170a3c090c0>,)
gateway = <module 'pypy.interpreter.gateway' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\interpreter\\gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <code object test_on_compile_exception, file '[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\pypyjit\test\test_jit_hook.py:174]', line 1>
def funccall(self, *args_w): # speed hack
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
nargs = len(args_w)
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, args_w[0])
elif nargs == 2:
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, args_w[0], args_w[1])
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
return code.fastcall_3(self.space, self, args_w[0],
args_w[1], args_w[2])
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
return code.fastcall_4(self.space, self, args_w[0],
args_w[1], args_w[2], args_w[3])
elif (nargs | PyCode.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
if nargs < 5:
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in funccallunrolling:
if i < nargs:
new_frame.locals_cells_stack_w[i] = args_w[i]
> return new_frame.run()
interpreter\function.py:118:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_on_compi...x86-64\build\pypy\module\pypyjit\test\test_jit_hook.py:174]', line 1> at line 9
def run(self):
"""Start this frame's execution."""
if self.getcode().co_flags & pycode.CO_GENERATOR:
from pypy.interpreter.generator import GeneratorIterator
return GeneratorIterator(self)
else:
> return self.execute_frame()
interpreter\pyframe.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_on_compi...x86-64\build\pypy\module\pypyjit\test\test_jit_hook.py:174]', line 1> at line 9
w_inputvalue = None, operr = None
def execute_frame(self, w_inputvalue=None, operr=None):
"""Execute this frame. Main entry point to the interpreter.
The optional arguments are there to handle a generator's frame:
w_inputvalue is for generator.send() and operr is for
generator.throw().
"""
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
try:
if operr is not None:
next_instr = self.handle_operation_error(
executioncontext, operr)
self.last_instr = intmask(next_instr - 1)
else:
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE instruction.
next_instr = r_uint(self.last_instr + 1)
if next_instr != 0:
self.pushvalue(w_inputvalue)
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:290:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_on_compi...x86-64\build\pypy\module\pypyjit\test\test_jit_hook.py:174]', line 1> at line 9
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:943:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_on_compi...x86-64\build\pypy\module\pypyjit\test\test_jit_hook.py:174]', line 1> at line 9
w_inputvalue = None, operr = None
def execute_frame(self, w_inputvalue=None, operr=None):
"""Execute this frame. Main entry point to the interpreter.
The optional arguments are there to handle a generator's frame:
w_inputvalue is for generator.send() and operr is for
generator.throw().
"""
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
try:
if operr is not None:
next_instr = self.handle_operation_error(
executioncontext, operr)
self.last_instr = intmask(next_instr - 1)
else:
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE instruction.
next_instr = r_uint(self.last_instr + 1)
if next_instr != 0:
self.pushvalue(w_inputvalue)
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:286:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_on_compi...x86-64\build\pypy\module\pypyjit\test\test_jit_hook.py:174]', line 1> at line 9
pycode = <code object test_on_compile_exception, file '[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\pypyjit\test\test_jit_hook.py:174]', line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x00000170a3a2d398>
def dispatch(self, pycode, next_instr, ec):
self = hint(self, access_directly=True)
next_instr = r_uint(next_instr)
is_being_profiled = self.get_is_being_profiled()
try:
while True:
pypyjitdriver.jit_merge_point(ec=ec,
frame=self, next_instr=next_instr, pycode=pycode,
is_being_profiled=is_being_profiled)
co_code = pycode.co_code
self.valuestackdepth = hint(self.valuestackdepth, promote=True)
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
module\pypyjit\interp_jit.py:90:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_on_compi...x86-64\build\pypy\module\pypyjit\test\test_jit_hook.py:174]', line 1> at line 9
co_code = 'd\x01\x00d\x00\x00l\x00\x00}\x01\x00d\x01\x00d\x00\x00l\x01\x00}\x02\x00d\x01\x00d\x00\x00l\x02\x00}\x03\x00d\x02\x00...x00\x82\x01\x00\xcc\x18\x00d\x04\x00|\x05\x00\xc9\x07\x00\xca\x00\x00k\x06\x00s\xa9\x00t\x08\x00\x82\x01\x00d\x00\x00S'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x00000170a3a2d398>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:71:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_on_compi...x86-64\build\pypy\module\pypyjit\test\test_jit_hook.py:174]', line 1> at line 9
co_code = 'd\x01\x00d\x00\x00l\x00\x00}\x01\x00d\x01\x00d\x00\x00l\x01\x00}\x02\x00d\x01\x00d\x00\x00l\x02\x00}\x03\x00d\x02\x00...x00\x82\x01\x00\xcc\x18\x00d\x04\x00|\x05\x00\xc9\x07\x00\xca\x00\x00k\x06\x00s\xa9\x00t\x08\x00\x82\x01\x00d\x00\x00S'
next_instr = 76L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x00000170a3a2d398>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
if self.debugdata:
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
next_instr += 1
if opcode >= HAVE_ARGUMENT:
lo = ord(co_code[next_instr])
hi = ord(co_code[next_instr+1])
next_instr += 2
oparg = (hi * 256) | lo
else:
oparg = 0
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into a switch().
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
lo = ord(co_code[next_instr+1])
hi = ord(co_code[next_instr+2])
next_instr += 3
oparg = (oparg * 65536) | (hi * 256) | lo
if opcode == opcodedesc.RETURN_VALUE.index:
if not self.blockstack_non_empty():
self.frame_finished_execution = True # for generators
raise Return
w_returnvalue = self.popvalue()
block = self.unrollstack(SReturnValue.kind)
if block is None:
self.pushvalue(w_returnvalue)
raise Return
else:
unroller = SReturnValue(w_returnvalue)
next_instr = block.handle(self, unroller)
return next_instr # now inside a 'finally' block
elif opcode == opcodedesc.END_FINALLY.index:
unroller = self.end_finally()
if isinstance(unroller, SuspendedUnroller):
# go on unrolling the stack
block = self.unrollstack(unroller.kind)
if block is None:
w_result = unroller.nomoreblocks()
self.pushvalue(w_result)
raise Return
else:
next_instr = block.handle(self, unroller)
return next_instr
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, ec)
elif opcode == opcodedesc.BREAK_LOOP.index:
next_instr = self.BREAK_LOOP(oparg, next_instr)
elif opcode == opcodedesc.CONTINUE_LOOP.index:
return self.CONTINUE_LOOP(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
next_instr = self.JUMP_IF_FALSE_OR_POP(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_DEBUG.index:
next_instr = self.JUMP_IF_NOT_DEBUG(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
next_instr = self.JUMP_IF_TRUE_OR_POP(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
next_instr = self.POP_JUMP_IF_FALSE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
next_instr = self.POP_JUMP_IF_TRUE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_DIVIDE.index:
self.BINARY_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CLASS.index:
self.BUILD_CLASS(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_VAR.index:
self.CALL_FUNCTION_VAR(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_VAR_KW.index:
self.CALL_FUNCTION_VAR_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
self.CALL_METHOD(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SLICE_0.index:
self.DELETE_SLICE_0(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SLICE_1.index:
self.DELETE_SLICE_1(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SLICE_2.index:
self.DELETE_SLICE_2(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SLICE_3.index:
self.DELETE_SLICE_3(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOPX.index:
self.DUP_TOPX(oparg, next_instr)
elif opcode == opcodedesc.EXEC_STMT.index:
self.EXEC_STMT(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
self.IMPORT_NAME(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_STAR.index:
self.IMPORT_STAR(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_ADD.index:
self.INPLACE_ADD(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_AND.index:
self.INPLACE_AND(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_DIVIDE.index:
self.INPLACE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_FLOOR_DIVIDE.index:
self.INPLACE_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_LSHIFT.index:
self.INPLACE_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_MODULO.index:
self.INPLACE_MODULO(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_MULTIPLY.index:
self.INPLACE_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_OR.index:
self.INPLACE_OR(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_POWER.index:
self.INPLACE_POWER(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_RSHIFT.index:
self.INPLACE_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_SUBTRACT.index:
self.INPLACE_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_TRUE_DIVIDE.index:
self.INPLACE_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.INPLACE_XOR.index:
self.INPLACE_XOR(oparg, next_instr)
elif opcode == opcodedesc.LIST_APPEND.index:
self.LIST_APPEND(oparg, next_instr)
elif opcode == opcodedesc.LOAD_ATTR.index:
> self.LOAD_ATTR(oparg, next_instr)
interpreter\pyopcode.py:354:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_on_compi...x86-64\build\pypy\module\pypyjit\test\test_jit_hook.py:174]', line 1> at line 9
nameindex = 5, next_instr = 76L
@always_inline
def LOAD_ATTR(self, nameindex, next_instr):
"obj.attributename"
w_obj = self.popvalue()
if not jit.we_are_jitted():
from pypy.objspace.std.mapdict import LOAD_ATTR_caching
> w_value = LOAD_ATTR_caching(self.getcode(), w_obj, nameindex)
interpreter\pyopcode.py:991:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pycode = <code object test_on_compile_exception, file '[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\pypyjit\test\test_jit_hook.py:174]', line 1>
w_obj = <pypy.module.sys.moduledef.Module object at 0x00000170a1773868>
nameindex = 5
@objectmodel.always_inline
def LOAD_ATTR_caching(pycode, w_obj, nameindex):
# this whole mess is to make the interpreter quite a bit faster; it's not
# used if we_are_jitted().
entry = pycode._mapdict_caches[nameindex]
map = w_obj._get_mapdict_map()
if entry.is_valid_for_map(map) and entry.w_method is None:
# everything matches, it's incredibly fast
attr = entry.attr_wref()
if attr is not None:
return attr._direct_read(w_obj)
> return LOAD_ATTR_slowpath(pycode, w_obj, nameindex, map)
objspace\std\mapdict.py:1420:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pycode = <code object test_on_compile_exception, file '[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\pypyjit\test\test_jit_hook.py:174]', line 1>
w_obj = <pypy.module.sys.moduledef.Module object at 0x00000170a1773868>
nameindex = 5, map = None
@objectmodel.dont_inline
def LOAD_ATTR_slowpath(pycode, w_obj, nameindex, map):
space = pycode.space
w_name = pycode.co_names_w[nameindex]
if map is not None:
w_type = map.terminator.w_cls
w_descr = w_type.getattribute_if_not_from_object()
if w_descr is not None:
return space._handle_getattribute(w_descr, w_obj, w_name)
version_tag = w_type.version_tag()
if version_tag is not None:
name = space.text_w(w_name)
# We need to care for obscure cases in which the w_descr is
# a MutableCell, which may change without changing the version_tag
_, w_descr = w_type._pure_lookup_where_with_method_cache(
name, version_tag)
#
attrname, attrkind = ("", INVALID)
if w_descr is None:
attrname, attrkind = (name, DICT) # common case: no such attr in the class
elif isinstance(w_descr, MutableCell):
pass # we have a MutableCell in the class: give up
elif space.is_data_descr(w_descr):
# we have a data descriptor, which means the dictionary value
# (if any) has no relevance.
from pypy.interpreter.typedef import Member
if isinstance(w_descr, Member): # it is a slot -- easy case
attrname, attrkind = ("slot", SLOTS_STARTING_FROM + w_descr.index)
elif not space.type(w_descr).is_heaptype():
# There is a non-data descriptor in the class. This would mean
# we use the dict entry, however, the class of w_descr could be
# changed to add a __get__/__set__ without the cache noticing,
# so we can only use the cache if w_descr is an instance of an
# immutable type. see
# test_load_attr_bug_class_name_turns_into_descriptor
attrname = name
attrkind = DICT
#
if attrkind != INVALID:
attr = map.find_map_attr(attrname, attrkind)
if attr is not None:
# Note that if map.terminator is a DevolvedDictTerminator
# or the class provides its own dict, not using mapdict, then:
# map.find_map_attr will always return None if attrkind==DICT.
_fill_cache(pycode, nameindex, map, version_tag, attr,
valid_for_store=w_type.setattr_if_not_from_object() is None)
return attr._direct_read(w_obj)
if space.config.objspace.std.withmethodcachecounter:
INVALID_CACHE_ENTRY.failure_counter += 1
> return space.getattr(w_obj, w_name)
objspace\std\mapdict.py:1471:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
w_obj = <pypy.module.sys.moduledef.Module object at 0x00000170a1773868>
w_name = W_BytesObject('stderr')
def getattr(self, w_obj, w_name):
# an optional shortcut for performance
w_type = self.type(w_obj)
w_descr = w_type.getattribute_if_not_from_object()
if w_descr is not None:
return self._handle_getattribute(w_descr, w_obj, w_name)
# fast path: XXX this is duplicating most of the logic
# from the default __getattribute__ and the getattr() method...
name = self.text_w(w_name)
w_descr = w_type.lookup(name)
e = None
if w_descr is not None:
w_get = None
is_data = self.is_data_descr(w_descr)
if is_data:
w_get = self.lookup(w_descr, "__get__")
if w_get is None:
w_value = w_obj.getdictvalue(self, name)
if w_value is not None:
return w_value
if not is_data:
w_get = self.lookup(w_descr, "__get__")
if w_get is not None:
# __get__ is allowed to raise an AttributeError to trigger
# use of __getattr__.
try:
return self.get_and_call_function(w_get, w_descr, w_obj,
w_type)
except OperationError as e:
if not e.match(self, self.w_AttributeError):
raise
else:
return w_descr
else:
> w_value = w_obj.getdictvalue(self, name)
objspace\std\objspace.py:655:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x00000170a1773868>
space = StdObjSpace, attr = 'stderr'
def getdictvalue(self, space, attr):
""" specialize access to dynamic exc_* attributes. """
> value = MixedModule.getdictvalue(self, space, attr)
module\sys\moduledef.py:145:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x00000170a1773868>
space = StdObjSpace, name = 'stderr'
def getdictvalue(self, space, name):
w_value = space.finditem_str(self.w_dict, name)
if self.lazy and w_value is None:
> return self._load_lazily(space, name)
interpreter\mixedmodule.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x00000170a1773868>
space = StdObjSpace, name = 'stderr'
def _load_lazily(self, space, name):
w_name = space.new_interned_str(name)
try:
loader = self.loaders[name]
except KeyError:
return None
else:
> w_value = loader(space)
interpreter\mixedmodule.py:103:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
def ifileloader(space):
d = {'space':space}
# EVIL HACK (but it works, and this is not RPython :-)
while 1:
try:
> value = eval(spec, d)
interpreter\mixedmodule.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
<string>:1:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
def getio(space):
> return space.fromcache(IOState)
module\sys\state.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'InternalSpaceCache' (24 items)>
key = <class pypy.module.sys.state.IOState at 0x00000170a36725d0>
def getorbuild(self, key):
if lock: lock.acquire()
try:
try:
return self.content[key]
except KeyError:
if key in self._building:
raise RuntimeError("%s recursive building of %r" %
(self, key))
self._building[key] = True
try:
> result = self._build(key)
..\rpython\rlib\cache.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'InternalSpaceCache' (24 items)>
callable = <class pypy.module.sys.state.IOState at 0x00000170a36725d0>
def _build(self, callable):
> return callable(self.space)
interpreter\baseobjspace.py:402:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.state.IOState instance at 0x00000170a3e93ca0>
space = StdObjSpace
def __init__(self, space):
from pypy.module._file.interp_file import W_File
self.space = space
w_stdin = W_File(space)
> w_stdin.file_fdopen(0, "r", 1)
module\sys\state.py:40:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._file.interp_file.W_File object at 0x00000170a3f23980>
fd = 0, mode = 'r', buffering = 1
def file_fdopen(self, fd, mode="r", buffering=-1):
try:
> self.direct_fdopen(fd, mode, buffering)
module\_file\interp_file.py:329:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._file.interp_file.W_File object at 0x00000170a3f23980>
fd = 0, mode = 'r', buffering = 1
def direct_fdopen(self, fd, mode='r', buffering=-1):
self.direct_close()
self.w_name = self.space.newtext('<fdopen>')
self.check_mode_ok(mode)
stream = streamio.fdopen_as_stream(fd, mode, buffering,
> signal_checker(self.space))
module\_file\interp_file.py:165:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
fd = 0, mode = 'r', buffering = 1
signal_checker = <function checksignals at 0x00000170a3eab088>
def fdopen_as_stream(fd, mode, buffering=-1, signal_checker=None):
os_flags, universal, reading, writing, basemode, binary = decode_mode(mode)
_check_fd_mode(fd, reading, writing)
> _setfd_binary(fd)
..\rpython\rlib\streamio.py:115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
fd = 0
def _setfd_binary(fd):
# Allow this to succeed on invalid fd's
> with rposix.SuppressIPH():
..\rpython\rlib\streamio.py:212:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.rlib.rposix.SuppressIPH object at 0x00000170a3f23b78>
def __enter__(self):
> self.invalid_param_hndlr = c_enter_suppress_iph()
..\rpython\rlib\rposix.py:259:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (), real_args = (), to_free = ()
def wrapper(*args):
assert len(args) == nb_args
real_args = ()
# XXX 'to_free' leaks if an allocation fails with MemoryError
# and was not the first in this function
to_free = ()
for i, TARGET in unrolling_arg_tps:
arg = args[i]
if TARGET == CCHARP or TARGET is VOIDP:
if arg is None:
from rpython.rtyper.annlowlevel import llstr
arg = lltype.nullptr(CCHARP.TO) # None => (char*)NULL
to_free = to_free + (arg, llstr(None), '\x04')
elif isinstance(arg, str):
tup = get_nonmovingbuffer_ll_final_null(arg)
to_free = to_free + tup
arg = tup[0]
elif isinstance(arg, unicode):
_oops()
elif TARGET == CWCHARP:
if arg is None:
arg = lltype.nullptr(CWCHARP.TO) # None => (wchar_t*)NULL
to_free = to_free + (arg,)
elif isinstance(arg, unicode):
arg = unicode2wcharp(arg)
to_free = to_free + (arg,)
elif _isfunctype(TARGET) and not _isllptr(arg):
# XXX pass additional arguments
use_gil = invoke_around_handlers
arg = llhelper(TARGET, _make_wrapper_for(TARGET, arg,
callbackholder,
use_gil))
else:
SOURCE = lltype.typeOf(arg)
if SOURCE != TARGET:
if TARGET is lltype.Float:
arg = float(arg)
elif ((isinstance(SOURCE, lltype.Number)
or SOURCE is lltype.Bool)
and (isinstance(TARGET, lltype.Number)
or TARGET is lltype.Bool)):
arg = cast(TARGET, arg)
real_args = real_args + (arg,)
> res = call_external_function(*real_args)
..\rpython\rtyper\lltypesystem\rffi.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def call_external_function():
rgil.release()
# NB. it is essential that no exception checking occurs here!
if 0:
from rpython.rlib import rposix
rposix._errno_before(0)
if we_are_translated():
res = funcptr()
else:
try: # only when non-translated
> res = funcptr()
<92-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py:217>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <* fn enter_suppress_iph>, args = ()
rffi = <module 'rpython.rtyper.lltypesystem.rffi' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\rtyper\\lltypesystem\\rffi.pyc'>
def __call__(self, *args):
from rpython.rtyper.lltypesystem import rffi
if isinstance(self._T, FuncType):
if len(args) != len(self._T.ARGS):
raise TypeError("calling %r with wrong argument number: %r" %
(self._T, args))
for i, a, ARG in zip(range(len(self._T.ARGS)), args, self._T.ARGS):
if typeOf(a) != ARG:
# ARG could be Void
if ARG == Void:
try:
value = getattr(self._obj, '_void' + str(i))
except AttributeError:
pass
else:
assert a == value
# None is acceptable for any pointer
elif isinstance(ARG, Ptr) and a is None:
pass
# Any pointer is convertible to void*
elif ARG is rffi.VOIDP and isinstance(typeOf(a), Ptr):
pass
# special case: ARG can be a container type, in which
# case a should be a pointer to it. This must also be
# special-cased in the backends.
elif (isinstance(ARG, ContainerType) and
typeOf(a) == Ptr(ARG)):
pass
else:
args_repr = [typeOf(arg) for arg in args]
raise TypeError("calling %r with wrong argument "
"types: %r" % (self._T, args_repr))
callb = self._obj._callable
if callb is None:
raise RuntimeError("calling undefined function")
> return callb(*args)
..\rpython\rtyper\lltypesystem\lltype.py:1384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.rtyper.lltypesystem.ll2ctypes.LL2CtypesCallable object at 0x000001709eea8870>
argvalues = ()
def __call__(self, *argvalues):
with rlock:
if self.trampoline is None:
# lazily build the corresponding ctypes function object
cfunc = get_ctypes_callable(self.funcptr, self.calling_conv,
> self.natural_arity)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1339:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
funcptr = <* fn enter_suppress_iph>, calling_conv = 'c', natural_arity = -1
def get_ctypes_callable(funcptr, calling_conv, natural_arity):
if not ctypes:
raise ImportError("ctypes is needed to use ll2ctypes")
def get_on_lib(lib, elem):
""" Wrapper to always use lib[func] instead of lib.func
"""
try:
return lib[elem]
except AttributeError:
pass
old_eci = funcptr._obj.compilation_info
funcname = funcptr._obj._name
if hasattr(old_eci, '_with_ctypes'):
old_eci = old_eci._with_ctypes
try:
eci = _eci_cache[old_eci]
except KeyError:
eci = old_eci.compile_shared_lib(ignore_a_files=True,
defines=['RPYTHON_LL2CTYPES'],
> symbolic=True)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1236:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-main-1867\\shared_cache\\externmod_2'
ignore_a_files = False, debug_mode = True, defines = ['RPYTHON_LL2CTYPES']
symbolic = True
def compile_shared_lib(self, outputfilename=None, ignore_a_files=False,
debug_mode=True, defines=[], symbolic=False):
self = self.convert_sources_to_files()
if ignore_a_files:
if not [fn for fn in self.link_files if fn.endswith('.a')]:
ignore_a_files = False # there are none
if not self.separate_module_files and not ignore_a_files:
return self # xxx there was some condition about win32 here
else:
#basepath = py.path.local(self.separate_module_files[0]).dirpath()
basepath = udir.join('shared_cache')
if outputfilename is None:
# find more or less unique name there
pth = basepath.join('externmod').new(ext=host.so_ext)
num = 0
while pth.check():
pth = basepath.join(
'externmod_%d' % (num,)).new(ext=host.so_ext)
num += 1
basepath.ensure(dir=1)
outputfilename = str(pth.dirpath().join(pth.purebasename))
d = self._copy_attributes()
if ignore_a_files:
d['link_files'] = [fn for fn in d['link_files']
if not fn.endswith('.a')]
if debug_mode and sys.platform != 'win32':
d['compile_extra'] = d['compile_extra'] + ('-g', '-O0')
d['compile_extra'] = d['compile_extra'] + (
'-DRPY_EXTERN=RPY_EXPORTED',)
for define in defines:
d['compile_extra'] += ('-D%s' % define,)
# On ELF platforms (Linux), prevent symbol interposition: when the host
# interpreter (e.g. pypy2.7) also exports symbols like pypysig_counter,
# the shared lib's own references would otherwise resolve to the host's
# copy via the GOT. -Bsymbolic makes the shared lib bind its own global
# symbol references to its own definitions. Only needed when running
# under a host interpreter (tests), not during translation.
if symbolic and sys.platform not in ('win32', 'darwin'):
d['link_extra'] = d['link_extra'] + ('-Wl,-Bsymbolic',)
self = ExternalCompilationInfo(**d)
lib = str(host.compile([], self, outputfilename=outputfilename,
> standalone=False))
..\rpython\translator\tool\cbuild.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cfiles = []
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-main-1867\\shared_cache\\externmod_2'
standalone = False
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-main-1867\\module_cache\\module_6.c')]
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
standalone = False
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-main-1867\\module_cache\\module_6.c')
compile_args = ['/MD', '/O2', '-DRPY_EXTERN=RPY_EXPORTED', '-DRPYTHON_LL2CTYPES', '/Fdd:\\systemtemp\\pytest\\usession-main-1867\\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', '-DRPY_EXTERN=RPY_EXPORTED', '-DRPYTHON_LL2CTYPES', ...]
outname = local('d:\\systemtemp\\pytest\\usession-main-1867\\module_cache\\module_6.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-main-1867\\module_cache\\module_6.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
builder: own-win-x86-64 build #2296+
test: pypy/module/pypyjit/test/test_jit_hook.py::AppTestJitHook::()::test_on_compile_exception