pypy/module/cpyext/test/test_bytearrayobject.py::AppTestStringObject::()::test_AsByteArray
self = <CallInfo when='setup' exception: CompilationError(out="""
""")>
func = <function <lambda> at 0x00000234314859e8>, 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, 2 meths, kwargs={'item': <AppTestMethod 'test_AsByteArray'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_AsByteArray'>}
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 0x0000023426593440>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_AsByteArray'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_AsByteArray'>}
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 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_AsByteArray'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_AsByteArray'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
..\_pytest\vendored_packages\pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_AsByteArray'>, '__multicall__': <_MultiCall 0 results, 2 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 0x000002342ff97b78>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...sByteArray'>, '__multicall__': <_MultiCall 0 results, 2 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 0x0000023430a50c20>
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 0x0000023430a50c20>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...sByteArray'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_AsByteArray'>, '__multicall__': <_MultiCall 0 results, 2 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_AsByteArray'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
..\_pytest\runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_AsByteArray'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
> py.builtin._reraise(*col._prepare_exc)
..\_pytest\runner.py:404:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_basic'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
py.builtin._reraise(*col._prepare_exc)
for col in needed_collectors[len(self.stack):]:
self.stack.append(col)
try:
> col.setup()
..\_pytest\runner.py:408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
> super(AppClassCollector, self).setup()
tool\pytest\apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
setup_class = xunitsetup(self.obj, 'setup_class')
if setup_class is not None:
setup_class = getattr(setup_class, 'im_func', setup_class)
setup_class = getattr(setup_class, '__func__', setup_class)
> setup_class(self.obj)
..\_pytest\python.py:671:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'pypy.module.cpyext.test.test_bytearrayobject.AppTestStringObject'>
def setup_class(cls):
space = cls.space
cls.w_here = space.wrap(str(HERE))
cls.w_udir = space.wrap(str(udir))
cls.w_runappdirect = space.wrap(cls.runappdirect)
if not cls.runappdirect:
cls.sys_info = get_cpyext_info(space)
cls.w_debug_collect = space.wrap(interp2app(debug_collect))
cls.preload_builtins(space)
# Flush stdout once here to pre-create any file lock objects
# before we start counting allocations (moved from setup_method).
> space.call_method(space.sys.get("stdout"), "flush")
module\cpyext\test\test_cpyext.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
name = 'stdout'
def get(self, name):
space = self.space
> w_value = self.getdictvalue(space, name)
interpreter\mixedmodule.py:86:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
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:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
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:119:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
def afileloader(space):
> return app.wget(space, attrname)
interpreter\mixedmodule.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace, name = 'stdout'
def wget(self, space, name):
> w_globals = self.getwdict(space)
interpreter\gateway.py:1393:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
def getwdict(self, space):
> return space.fromcache(ApplevelCache).getorbuild(self)
interpreter\gateway.py:1386:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
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 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def _build(self, key):
> return self.build(key)
interpreter\baseobjspace.py:400:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
app = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
@not_rpython
def build(self, app):
"Called indirectly by Applevel.getwdict()."
> return build_applevel_dict(app, self.space)
interpreter\gateway.py:1437:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
@not_rpython
def build_applevel_dict(self, space):
w_glob = space.newdict(module=True)
space.setitem(w_glob, space.newtext('__name__'), space.newtext(self.modname))
space.exec_(self.source, w_glob, w_glob,
hidden_applevel=self.hidden_applevel,
> filename=self.filename)
interpreter\gateway.py:1448:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
statement = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
hidden_applevel = True
filename = 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'
@not_rpython
def exec_(self, statement, w_globals, w_locals, hidden_applevel=False,
filename=None):
"For internal debugging."
if filename is None:
filename = '?'
from pypy.interpreter.pycode import PyCode
if isinstance(statement, str):
statement = self._cached_compile(filename, statement, 'exec', 0, hidden_applevel)
if not isinstance(statement, PyCode):
raise TypeError('space.exec_(): expected a string, code or PyCode object')
w_key = self.newtext('__builtins__')
if not self.contains_w(w_globals, w_key):
self.setitem(w_globals, w_key, self.builtin)
> return statement.exec_code(self, w_globals, w_locals)
interpreter\baseobjspace.py:1408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
space = StdObjSpace
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_closure = None
def exec_code(self, space, w_globals, w_locals, w_closure=None):
"Implements the 'exec' statement."
# this should be on PyCode?
frame = space.createframe(self, w_globals, w_closure)
frame.setdictscope(w_locals, skip_free_vars=w_closure is not None)
> return frame.run()
interpreter\eval.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
name = None, qualname = None
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
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:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
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:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
pycode = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 24L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
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])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(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:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(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_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(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_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(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_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
self.CALL_METHOD(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD_KW.index:
> self.CALL_METHOD_KW(oparg, next_instr)
interpreter\pyopcode.py:315:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
n_arguments = 2, ignored = (24L,)
W_AbstractTupleObject = <class 'pypy.objspace.std.tupleobject.W_AbstractTupleObject'>
w_self = None, space = StdObjSpace
@jit.unroll_safe
def CALL_METHOD_KW(f, n_arguments, *ignored):
from pypy.objspace.std.tupleobject import W_AbstractTupleObject
# opargs contains the arg + kwarg count, excluding the implicit 'self'
w_self = f.peekvalue_maybe_none(n_arguments + 1)
space = f.space
# like in BUILD_CONST_KEY_MAP we can't use space.fixedview because then
# the immutability of the tuple is lost
w_tup_varnames = space.interp_w(W_AbstractTupleObject, f.popvalue())
n_keywords = space.len_w(w_tup_varnames)
keyword_names_w = [None] * n_keywords
keywords_w = [None] * n_keywords
for i in range(n_keywords):
keyword_names_w[i] = w_tup_varnames.getitem(space, i)
w_value = f.peekvalue(n_keywords - 1 - i)
keywords_w[i] = w_value
f.dropvalues(n_keywords)
n_arguments -= n_keywords
n = n_arguments + (w_self is not None)
arguments = f.popvalues(n) # includes w_self if it is not None
if w_self is None:
f.popvalue_maybe_none() # removes w_self, which is None
w_callable = f.popvalue()
args = f.argument_factory(
arguments, keyword_names_w, keywords_w, None, None,
methodcall=w_self is not None, w_function=w_callable)
if f.get_is_being_profiled() and function.is_builtin_code(w_callable):
w_result = f.space.call_args_and_c_profile(f, w_callable, args)
else:
> w_result = f.space.call_args(w_callable, args)
objspace\std\callmethod.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_text_int_text_or_none_text_or_none_text_or_none_int_W_Root object at 0x000002342f57f558>
space = StdObjSpace
scope_w = [W_IntObject(0), W_UnicodeObject('r'), W_IntObject(-1), W_UnicodeObject('utf-8'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, ...]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], space.text_w(scope_w[1]), space.gateway_int_w(scope_w[2]), space.text_or_none_w(scope_w[3]), space.text_or_none_w(scope_w[4]), space.text_or_none_w(scope_w[5]), space.gateway_int_w(scope_w[6]), scope_w[7])
<2604-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = 8192
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
space.newbool(bool(closefd)), w_opener)
else:
w_raw = W_FileIO(space)
w_raw.descr_init(space, w_file, rawmode, bool(closefd), w_opener)
w_result = w_raw
isatty = space.is_true(space.call_method(w_raw, "isatty"))
line_buffering = buffering == 1 or (buffering < 0 and isatty)
if line_buffering:
buffering = -1
if buffering < 0:
buffering = space.c_int_w(space.getattr(
w_raw, space.newtext("_blksize")))
if buffering < 0:
raise oefmt(space.w_ValueError, "invalid buffering size")
if buffering == 0:
if not binary:
raise oefmt(space.w_ValueError,
"can't have unbuffered text I/O")
return w_result
if updating:
w_buffer = W_BufferedRandom(space)
w_buffer.descr_init(space, w_raw, buffering)
elif writing or creating or appending:
w_buffer = W_BufferedWriter(space)
w_buffer.descr_init(space, w_raw, buffering)
elif reading:
w_buffer = W_BufferedReader(space)
w_buffer.descr_init(space, w_raw, buffering)
else:
raise oefmt(space.w_ValueError, "unknown mode: '%s'", mode)
w_result = w_buffer
if binary:
return w_result
w_wrapper = W_TextIOWrapper(space)
w_wrapper.descr_init(space, w_buffer, encoding,
space.newtext_or_none(errors),
space.newtext_or_none(newline),
> line_buffering)
module\_io\interp_io.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
space = StdObjSpace
w_buffer = <pypy.module._io.interp_bufferedio.W_BufferedReader object at 0x000002342f446758>
encoding = 'utf-8', w_errors = W_UnicodeObject('strict')
w_newline = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
line_buffering = True, write_through = 0
@unwrap_spec(encoding="text0_or_none", line_buffering=int, write_through=int)
def descr_init(self, space, w_buffer, encoding=None,
w_errors=None, w_newline=None, line_buffering=0,
write_through=0):
self.state = STATE_ZERO
self.w_buffer = w_buffer
self.w_encoding = w_encoding = _determine_encoding(space, encoding, w_buffer)
if space.is_none(w_errors) or w_errors is None:
w_errors = space.newtext("strict")
if not space.isinstance_w(w_errors, space.w_text):
raise oefmt(space.w_TypeError, "TextIOWrapper() argument 'errors' "
"must be str or None, not %N", w_errors)
io_check_errors(space, w_errors)
self.w_errors = w_errors
newline = unwrap_newline(space, w_newline)
self.line_buffering = bool(line_buffering)
self.write_through = bool(write_through)
self._set_newline(newline)
> self._set_encoder_decoder(w_encoding, w_errors)
module\_io\interp_textio.py:605:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
w_encoding = W_UnicodeObject('utf-8'), w_errors = W_UnicodeObject('strict')
def _set_encoder_decoder(self, w_encoding, w_errors):
space = self.space
w_codec = interp_codecs.lookup_codec(space,
> space.text_w(w_encoding))
module\_io\interp_textio.py:634:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8'
@unwrap_spec(encoding='text0')
def lookup_codec(space, encoding):
"""lookup(encoding) -> (encoder, decoder, stream_reader, stream_writer)
Looks up a codec tuple in the Python codec registry and returns
a tuple of functions.
"""
assert not (space.config.translating and not we_are_translated()), \
"lookup_codec() should not be called during translation"
state = space.fromcache(CodecState)
normalized_encoding = normalize(encoding)
w_result = state.get_codec_from_cache(normalized_encoding)
if w_result is not None:
return w_result
> return _lookup_codec_loop(space, encoding, normalized_encoding)
module\_codecs\interp_codecs.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8', normalized_encoding = 'utf_8'
def _lookup_codec_loop(space, encoding, normalized_encoding):
state = space.fromcache(CodecState)
if state.codec_need_encodings:
# registers new codecs.
# This import uses the "builtin" import method, and is needed
# to bootstrap the full importlib module.
w_import = space.getattr(space.builtin, space.newtext("__import__"))
> space.call_function(w_import, space.newtext("encodings"))
module\_codecs\interp_codecs.py:221:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),), 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):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
> return w_func.funccall(*args_w)
interpreter\baseobjspace.py:1237:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),)
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 = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
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(self.name, self.qualname)
elif nargs >= 1 and fast_natural_arity == Code.PASSTHROUGHARGS1:
assert isinstance(code, gateway.BuiltinCodePassThroughArguments1)
return code.funcrun_obj(self, args_w[0],
Arguments(self.space,
list(args_w[1:])))
> return self.call_args(Arguments(self.space, list(args_w)))
interpreter\function.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_W_Root_W_Root_W_Root_W_Root object at 0x000002342c151be8>
space = StdObjSpace
scope_w = [W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], scope_w[1], scope_w[2], scope_w[3], scope_w[4])
<2115-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('encodings')
w_globals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_fromlist = W_TupleObject(), w_level = W_IntObject(0)
@unwrap_spec(w_globals=WrappedDefault(None), w_locals=WrappedDefault(None), w_fromlist=WrappedDefault(()),
w_level=WrappedDefault(0))
def interp___import__(space, w_name, w_globals, w_locals, w_fromlist,
w_level):
"""
Import a module. Because this function is meant for use by the Python
interpreter and not for general use, it is better to use
importlib.import_module() to programmatically import a module.
The globals argument is only used to determine the context;
they are not modified. The locals argument is unused. The fromlist
should be a list of names to emulate ``from name import ...'', or an
empty list to emulate ``import name''.
When importing a module from a package, note that __import__('A.B', ...)
returns package A when fromlist is empty, but its submodule B when
fromlist is not empty. The level argument is used to determine whether to
perform absolute or relative imports: 0 is absolute, while a positive number
is the number of parent directories to search relative to the current module."""
level = space.int_w(w_level)
if level == 0:
# fast path only for absolute imports without a "from" list, for now
# fromlist can be supported if we are importing from a module, not a
# package. to check that, look for the existence of __path__ attribute
# in w_mod
try:
name = space.text_w(w_name)
w_mod = _gcd_import(space, name)
have_fromlist = space.is_true(w_fromlist)
if not have_fromlist:
dotindex = name.find(".")
if dotindex < 0:
return w_mod
return _gcd_import(space, name[:dotindex])
except FastPathGiveUp:
pass
else:
assert have_fromlist
w_path = space.findattr(w_mod, space.newtext("__path__"))
if w_path is not None:
# hard case, a package! Call back into importlib
w_importlib = space.getbuiltinmodule('_frozen_importlib')
return space.call_method(w_importlib, "_handle_fromlist",
w_mod, w_fromlist,
space.w_default_importlib_import)
else:
return w_mod
try:
return space.call_function(
space.fromcache(FrozenCache).w_frozen_import, w_name, w_globals, w_locals, w_fromlist,
> w_level)
module\_frozen_importlib\interp_import.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function __import__>
args_w = (W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0))
nargs = 5
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):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
func = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def funcrun(self, func, args):
frame = self.space.createframe(self, func.w_func_globals,
func)
sig = self._signature
# speed hack
fresh_frame = jit.hint(frame, access_directly=True,
fresh_virtualizable=True)
args.parse_into_scope(None, fresh_frame.locals_cells_stack_w, func.qualname,
sig, func.defs_w, func.w_kw_defs)
fresh_frame.init_cells()
> return frame.run(func.name, func.qualname)
interpreter\pycode.py:280:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
name = '__import__', qualname = '__import__'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
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:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
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:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
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])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(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:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(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_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(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_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(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)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
oparg = 1, next_instr = 14L
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
return self._flat_pycall(code, nargs, frame, dropvalues)
elif fast_natural_arity & Code.FLATPYCALL:
natural_arity = fast_natural_arity & 0xff
if natural_arity > nargs >= natural_arity - len(self.defs_w):
assert isinstance(code, PyCode)
return self._flat_pycall_defaults(code, nargs, frame,
> natural_arity - nargs, dropvalues)
interpreter\function.py:193:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
defs_to_load = 2, dropvalues = 2
@jit.unroll_safe
def _flat_pycall_defaults(self, code, nargs, frame, defs_to_load, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
ndefs = len(self.defs_w)
start = ndefs - defs_to_load
i = nargs
for j in xrange(start, ndefs):
new_frame.locals_cells_stack_w[i] = self.defs_w[j]
i += 1
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:231:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
name = '_gcd_import', qualname = '_gcd_import'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
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:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
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:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 40
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
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])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(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:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(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_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(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_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(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)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
oparg = 2, next_instr = 40
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
name = '_find_and_load', qualname = '_find_and_load'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
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:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
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:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 82
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
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])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(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:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(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_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(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_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(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)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
oparg = 2, next_instr = 82
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>
code = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
name = '_find_and_load_unlocked', qualname = '_find_and_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
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:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
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:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
pycode = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 216
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
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])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(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:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(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_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(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_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(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)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
oparg = 1, next_instr = 216
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>
code = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
name = '_load_unlocked', qualname = '_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
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:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
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:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
pycode = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 132
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
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])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(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:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(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_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(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_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(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_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
oparg = 1, ignored = (132,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>
code = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
name = 'exec_module', qualname = '_LoaderBasics.exec_module'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
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:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
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:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
pycode = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 10L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
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])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(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:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(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_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(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_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(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_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
oparg = 1, ignored = (10L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>
code = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
name = 'get_code', qualname = 'SourceLoader.get_code'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
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:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
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:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
pycode = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 74L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
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])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(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:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(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_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(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_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(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_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
oparg = 1, ignored = (74L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>
code = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
name = 'get_data', qualname = 'FileLoader.get_data'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
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:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
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:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# 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)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
pycode = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 26L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
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])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(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:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(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_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(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_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(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_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
oparg = 1, ignored = (26L,), n_args = 1, w_self = None, n = 1
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
> return code.fastcall_1(self.space, self, f_0)
interpreter\function.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
w_result = self.fastfunc_1(space, w1)
except DescrMismatch:
return self._type_unwrap_mismatch(space,
Arguments(space, [w1]))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:982:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
> w_result = self.fastfunc_1(space, w1)
interpreter\gateway.py:977:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
def open_code(space, w_file):
> return open(space, w_file, "rb")
module\_io\interp_io.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
> space.newbool(bool(closefd)), w_opener)
module\_io\interp_io.py:120:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args_w = (W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None)
nargs = 4, 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):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
return w_obj.call_args(args)
if isinstance(w_obj, Method):
return w_obj.call_args(args)
w_descr = space.lookup(w_obj, '__call__')
if w_descr is None:
raise oefmt(space.w_TypeError,
"'%T' object is not callable", w_obj)
> return space.get_and_call_args(w_descr, w_obj, args)
objspace\descroperation.py:199:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
w_result = self.func__args__(space, w_obj, args)
except DescrMismatch:
return self._type_unwrap_mismatch(space, args.prepend(w_obj))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:941:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
> w_result = self.func__args__(space, w_obj, args)
interpreter\gateway.py:937:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def _call(space, w_obj, args):
self = space.descr_self_interp_w(self_type, w_obj)
> return func(self, space, args)
<282-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:4:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <W_TypeObject '_io.FileIO' at 0x2342f626d78>, space = StdObjSpace
__args__ = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def descr_call(self, space, __args__):
promote(self)
# invoke the __new__ of the type
if not we_are_jitted():
# note that the annotator will figure out that self.w_new_function
# can only be None if the newshortcut config option is not set
w_newfunc = self.w_new_function
else:
# for the JIT it is better to take the slow path because normal lookup
# is nicely optimized, but the self.w_new_function attribute is not
# known to the JIT
w_newfunc = None
if w_newfunc is None:
w_newtype, w_newdescr = self.lookup_where('__new__')
if w_newdescr is None: # see test_crash_mro_without_object_1
raise oefmt(space.w_TypeError, "cannot create '%N' instances",
self)
#
# issue #2666
if space.config.objspace.usemodules.cpyext:
w_newtype, w_newdescr = self.hack_which_new_to_call(
w_newtype, w_newdescr)
#
w_newfunc = space.get(w_newdescr, space.w_None, w_type=self)
if (space.config.objspace.std.newshortcut and
not we_are_jitted() and space._side_effects_ok() and
isinstance(w_newtype, W_TypeObject)):
self.w_new_function = w_newfunc
w_newobject = space.call_obj_args(w_newfunc, self, __args__)
call_init = space.isinstance_w(w_newobject, self)
# maybe invoke the __init__ of the type
if (call_init and not (space.is_w(self, space.w_type) and
not __args__.keyword_names_w and len(__args__.arguments_w) == 1)):
w_descr = space.lookup(w_newobject, '__init__')
if w_descr is not None: # see test_crash_mro_without_object_2
w_result = space.get_and_call_args(w_descr, w_newobject,
> __args__)
objspace\std\typeobject.py:743:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_W_FileIO_ObjSpace_W_Root_text_int_W_Root object at 0x000002342e1b8db0>
space = StdObjSpace
scope_w = [<pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>, W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\s...\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None]
def _run(self, space, scope_w):
> return self.behavior(space.interp_w(W_FileIO, scope_w[0]), space, scope_w[1], space.text_w(scope_w[2]), space.gateway_int_w(scope_w[3]), scope_w[4])
<2459-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'r', closefd = 1, w_opener = None
@unwrap_spec(mode='text', closefd=int)
def descr_init(self, space, w_name, mode='r', closefd=True, w_opener=None):
if self.fd >= 0:
if self.closefd:
self._close(space)
else:
self.fd = -1
if space.isinstance_w(w_name, space.w_float):
raise oefmt(space.w_TypeError,
"integer argument expected, got float")
fd = -1
try:
fd = space.c_int_w(w_name)
except OperationError as e:
pass
else:
if fd < 0:
raise oefmt(space.w_ValueError, "negative file descriptor")
self.readable, self.writable, self.created, self.appending, flags = decode_mode(space, mode)
if rposix.O_CLOEXEC is not None:
flags |= rposix.O_CLOEXEC
fd_is_own = False
try:
if fd >= 0:
self.fd = fd
self.closefd = bool(closefd)
space.audit("open", [space.newint(fd), space.newtext(mode), space.newint(closefd)])
else:
space.audit("open", [w_name, space.newtext(mode), space.newint(1)])
self.closefd = True
if not closefd:
raise oefmt(space.w_ValueError,
"Cannot use closefd=False with file name")
if space.is_none(w_opener):
> self.fd = _open_fd(space, w_name, flags)
module\_io\interp_fileio.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
flags = 32768
def _open_fd(space, w_name, flags):
from pypy.module.posix.interp_posix import dispatch_filename, fspath
w_path = fspath(space, w_name)
while True:
try:
fd = dispatch_filename(rposix.open)(
> space, w_path, flags, 0666)
module\_io\interp_fileio.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_fname = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
args = (32768, 438)
fname = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
@specialize.argtype(1)
def dispatch(space, w_fname, *args):
if allow_fd_fn is not None:
try:
fd = space.c_int_w(w_fname)
except OperationError:
pass
else:
return allow_fd_fn(fd, *args)
if space.isinstance_w(w_fname, space.w_unicode):
fname = FileEncoder(space, w_fname)
> return func(fname, *args)
module\posix\interp_posix.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
flags = 32768, mode = 438
@replace_os_function('open')
@specialize.argtype(0)
@enforceargs(NOT_CONSTANT, int, int, typecheck=False)
def open(path, flags, mode):
if _WIN32:
utf8 = _as_utf80(path)
with rffi.scoped_utf82wcharp(utf8) as buf:
> fd = c_wopen(buf, flags, mode)
..\rpython\rlib\rposix.py:468:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<* DEAD Array of UniChar {'nolength': True} >, 32768, 438)
real_args = (<* DEAD Array of UniChar {'nolength': True} >, 32768L, 438L)
to_free = (), i = 2
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:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a0 = <* DEAD Array of UniChar {'nolength': True} >, a1 = 32768L, a2 = 438L
def call_external_function(a0, a1, a2):
rgil.release()
# NB. it is essential that no exception checking occurs here!
if 1:
from rpython.rlib import rposix
rposix._errno_before(1)
if we_are_translated():
res = funcptr(a0, a1, a2)
else:
try: # only when non-translated
res = funcptr(a0, a1, a2)
except:
rgil.acquire()
raise
if 1:
from rpython.rlib import rposix
> rposix._errno_after(1)
<91-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py:217>:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
save_err = 1
@specialize.call_location()
def _errno_after(save_err):
if _WIN32:
if save_err & rffi.RFFI_SAVE_LASTERROR:
err = rwin32._GetLastError()
# careful, setraw() overwrites GetLastError.
# We must read it first, before the errno handling.
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
elif save_err & rffi.RFFI_SAVE_WSALASTERROR:
from rpython.rlib import _rsocket_rffi
err = _rsocket_rffi._WSAGetLastError()
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
if save_err & rffi.RFFI_SAVE_ERRNO:
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_errno.setraw(_get_errno())
else:
> rthread.tlfield_rpy_errno.setraw(_get_errno())
..\rpython\rlib\rposix.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <* fn get_errno>, 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 0x0000023428d928a8>
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 get_errno>, 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-py3.11-340\\shared_cache\\externmod_9'
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-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def compile(self, cfiles, eci, outputfilename=None, standalone=True):
ofiles = self._compile_o_files(cfiles, eci, standalone)
> return self._finish_linking(ofiles, eci, outputfilename, standalone)
..\rpython\translator\platform\__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
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-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def _finish_linking(self, ofiles, eci, outputfilename, standalone):
if outputfilename is None:
outputfilename = ofiles[0].purebasename
if ofiles:
dirname = ofiles[0].dirpath()
else:
dirname = udir.join('module_cache')
exe_name = dirname.join(outputfilename, abs=True)
if standalone:
if self.exe_ext:
exe_name += '.' + self.exe_ext
else:
exe_name += '.' + self.so_ext
if eci.use_cpp_linker:
cc_link = 'g++' # XXX hard-coded so far
else:
cc_link = self.cc
largs = self._link_args_from_eci(eci, standalone)
> return self._link(cc_link, ofiles, largs, standalone, exe_name)
..\rpython\translator\platform\__init__.py:235:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'cl.exe'
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
link_args = ['/nologo', '/LARGEADDRESSAWARE', '/STACK:3145728', '/MANIFEST:EMBED', 'kernel32.lib']
standalone = False
exe_name = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _link(self, cc, ofiles, link_args, standalone, exe_name):
args = ['/nologo'] + [str(ofile) for ofile in ofiles] + link_args
args += ['/out:%s' % (exe_name,), '/incremental:no']
if not standalone:
args = self._args_for_shared(args)
# Tell the linker to embed a manifest with the default
# UAC level asInvoker (Visual Studio 2008 +)
args += ["/MANIFEST:EMBED"]
> self._execute_c_compiler(self.link, args, exe_name)
..\rpython\translator\platform\windows.py:303:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'link.exe'
args = ['/dll', '/nologo', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj', '/nologo', '/LARGEADDRESSAWARE', ...]
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
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.11-340\\shared_cache\\externmod_9.dll')
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 #2314+
test: pypy/module/cpyext/test/test_bytearrayobject.py::AppTestStringObject::()::test_AsByteArray