virt_test/bin/python testrunner/runner.py --logfile=testrun.log --config=pypy/testrunner_cfg.py '--config=~/machine_cfg.py' --root=pypy --timeout=4000
in dir /build_dir/own-linux-x86-64/build (timeout 4000 secs)
watching logfiles {'pytestLog': 'testrun.log'}
argv: ['virt_test/bin/python', 'testrunner/runner.py', '--logfile=testrun.log', '--config=pypy/testrunner_cfg.py', '--config=~/machine_cfg.py', '--root=pypy', '--timeout=4000']
environment:
AUDITWHEEL_ARCH=x86_64
AUDITWHEEL_PLAT=manylinux2014_x86_64
AUDITWHEEL_POLICY=manylinux2014
DEVTOOLSET_ROOTPATH=/opt/rh/devtoolset-10/root
HOME=/home/buildslave
HOSTNAME=a58a84039819
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LD_LIBRARY_PATH=/usr/local/lib:/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib:/opt/rh/devtoolset-10/root/usr/lib64/dyninst:/opt/rh/devtoolset-10/root/usr/lib/dyninst:/usr/local/lib64
LOGNAME=buildslave
PATH=/python27_virt/bin:/opt/rh/devtoolset-10/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig
PWD=/build_dir/own-linux-x86-64/build
PYPYCHERRYPICK=
PYPY_LOCALBASE=/usr/local
PYPY_MAKE_PORTABLE=1
PYPY_USESSION_DIR=/tmp/pytest
PYTHONPATH=.:
SHELL=/bin/bash
SHLVL=2
SSL_CERT_FILE=/opt/_internal/certs.pem
TERM=xterm
TMPDIR=/tmp/pytest
USER=buildslave
USE_CURL=1
_=/python27_virt/bin/buildslave
using PTY: False
using config pypy/testrunner_cfg.py
using config /home/buildslave/machine_cfg.py
running 4 parallel test workers
setting MAKEFLAGS to ' ' (space)
-- config/test
-- interpreter/astcompiler/test
-- interpreter/pyparser/test
-- interpreter/test
-- module/__builtin__/test
-- module/__pypy__/test
-- module/_abc/test
-- module/_ast/test
-- module/_cffi_backend/test
-- module/_codecs/test
-- module/_collections/test
-- module/_continuation/test
-- module/_cppyy/test
-- module/_csv/test
-- module/_demo/test
-- module/_hpy_universal/test/_vendored
-- module/_hpy_universal/test/pypy
-- module/_io/test
-- module/_jitlog/test
-- module/_locale/test
-- module/_lsprof/test
-- module/_md5/test
-- module/_minimal_curses/test
-- module/_multibytecodec/test
-- module/_multiprocessing/test
-- module/_opcode/test
-- module/_pickle/test
-- module/_pickle_support/test
-- module/_posixsubprocess/test
-- module/_pypyjson/test
-- module/_random/test
-- module/_rawffi/alt/test
-- module/_rawffi/test
-- module/_socket/test
-- module/_sre/test
-- module/_vmprof/test
-- module/_warnings/test
-- module/_weakref/test
-- module/_winreg/test
-- module/array/test
-- module/atexit/test
-- module/binascii/test
-- module/bz2/test
-- module/cmath/test
-- module/cpyext/test/test_api.py
-- module/cpyext/test/test_arraymodule.py
-- module/cpyext/test/test_async_iter.py
-- module/cpyext/test/test_boolobject.py
-- module/cpyext/test/test_borrow.py
-- module/cpyext/test/test_buffer.py
-- module/cpyext/test/test_bytearrayobject.py
-- module/cpyext/test/test_bytesobject.py
-- module/cpyext/test/test_capsule.py
-- module/cpyext/test/test_cell.py
-- module/cpyext/test/test_classobject.py
-- module/cpyext/test/test_codecs.py
-- module/cpyext/test/test_complexobject.py
-- module/cpyext/test/test_contextvars.py
-- module/cpyext/test/test_cpyext.py
-- module/cpyext/test/test_datetime.py
-- module/cpyext/test/test_dictobject.py
-- module/cpyext/test/test_eval.py
-- module/cpyext/test/test_exception.py
-- module/cpyext/test/test_fileobject.py
-- module/cpyext/test/test_floatobject.py
-- module/cpyext/test/test_frameobject.py
-- module/cpyext/test/test_funcobject.py
-- module/cpyext/test/test_genobject.py
-- module/cpyext/test/test_getargs.py
-- module/cpyext/test/test_import.py
-- module/cpyext/test/test_iterator.py
-- module/cpyext/test/test_listobject.py
-- module/cpyext/test/test_longobject.py
-- module/cpyext/test/test_mapping.py
-- module/cpyext/test/test_marshal.py
-- module/cpyext/test/test_memoryobject.py
-- module/cpyext/test/test_methodobject.py
-- module/cpyext/test/test_misc.py
-- module/cpyext/test/test_module.py
-- module/cpyext/test/test_namespaceobject.py
-- module/cpyext/test/test_ndarrayobject.py
-- module/cpyext/test/test_number.py
-- module/cpyext/test/test_object.py
-- module/cpyext/test/test_pyerrors.py
-- module/cpyext/test/test_pyfile.py
-- module/cpyext/test/test_pymem.py
-- module/cpyext/test/test_pysignals.py
-- module/cpyext/test/test_pystate.py
-- module/cpyext/test/test_pystrhex.py
-- module/cpyext/test/test_pystrtod.py
-- module/cpyext/test/test_sequence.py
-- module/cpyext/test/test_setobject.py
-- module/cpyext/test/test_sliceobject.py
-- module/cpyext/test/test_structseq.py
-- module/cpyext/test/test_sysmodule.py
-- module/cpyext/test/test_thread.py
-- module/cpyext/test/test_traceback.py
-- module/cpyext/test/test_translate.py
-- module/cpyext/test/test_tupleobject.py
-- module/cpyext/test/test_typeobject.py
-- module/cpyext/test/test_unicodeobject.py
-- module/cpyext/test/test_userslots.py
-- module/cpyext/test/test_version.py
-- module/cpyext/test/test_weakref.py
-- module/crypt/test
-- module/errno/test
-- module/exceptions/test
-- module/faulthandler/test
-- module/fcntl/test
-- module/gc/test
-- module/imp/test
-- module/itertools/test
-- module/marshal/test
-- module/math/test
-- module/micronumpy/test
-- module/mmap/test
-- module/operator/test
-- module/posix/test
-- module/pwd/test
-- module/pyexpat/test
-- module/pypyjit/test
-- module/select/test
-- module/signal/test
-- module/struct/test
-- module/sys/test
-- module/termios/test
-- module/test_lib_pypy
-- module/thread/test
-- module/time/test
-- module/token/test
-- module/unicodedata/test
-- module/zipimport/test
-- module/zlib/test
-- objspace/fake/test
-- objspace/std/test
-- objspace/test
-- sandbox/test
-- tool/bench/test
-- tool/memusage/test
-- tool/pytest/fake_pytest/test
-- tool/pytest/test
-- tool/release/test
-- tool/test
-- total: 143 to run
++ 14:51:22 starting config/test [1 started in total]
++ 14:51:22 starting interpreter/astcompiler/test [2 started in total]
++ 14:51:22 starting interpreter/pyparser/test [3 started in total]
++ 14:51:22 starting interpreter/test [4 started in total]
__ config/test [1 done in total, somefailed=False] ____________________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 161 items / 1 skipped
config/test/test_pypyoption.py .................................................................................................................................................................
==================== 161 passed, 1 skipped in 5.34 seconds =====================
++ 14:51:29 starting module/__builtin__/test [5 started in total]
__ interpreter/pyparser/test [2 done in total, somefailed=True] _______________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 242 items
interpreter/pyparser/test/apptest_parsestring.py ....F.
interpreter/pyparser/test/test_automata.py ...
interpreter/pyparser/test/test_future.py ...................................
interpreter/pyparser/test/test_gendfa.py ....
interpreter/pyparser/test/test_parsestring.py ............
interpreter/pyparser/test/test_pylexer.py .
interpreter/pyparser/test/test_pyparse.py .......................................................................................F........................
interpreter/pyparser/test/test_pytokenizer.py ............................................F.F............F.........
=================================== FAILURES ===================================
____________________ test_invalid_escape_syntax_error_span _____________________
def test_invalid_escape_syntax_error_span():
# When -Werror promotes the SyntaxWarning to a SyntaxError, the
# error should highlight the full string token, not just one character.
# E.g. for '"""\q"""' (8 chars) the end offset must be start+8.
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('error', category=SyntaxWarning)
with raises(SyntaxError) as excinfo:
eval('"""\\q"""')
assert not w
exc = excinfo.value
# offset is 1-based column of opening quote; end_offset covers
# the full token '"""\q"""' (8 chars).
> assert exc.end_offset - exc.offset == len('"""\\q"""')
E (application-level) AssertionError: assert (8 != 1) == 8
E + where 8 = SyntaxError("invalid escape sequence '\\q'", ('<string>', 1, 1, '"""\\q"""', 1, 8)).end_offset
E + and 1 = SyntaxError("invalid escape sequence '\\q'", ('<string>', 1, 1, '"""\\q"""', 1, 8)).offset
E + and 8 = len('"""\\q"""')
interpreter/pyparser/test/apptest_parsestring.py:69: AssertionError
____________________ TestFString.test_exception_precedence _____________________
self = <pypy.interpreter.pyparser.test.test_pyparse.TestFString instance at 0x7f9af5ed6780>
def test_exception_precedence(self):
# Tests for f-string-related error messages even under tokenization errors
with pytest.raises(SyntaxError) as excinfo:
self.parse("f'{3!:'")
assert excinfo.value.msg == "f-string: missing conversion character"
with pytest.raises(SyntaxError) as excinfo:
self.parse("f'{\n3!:'")
assert excinfo.value.msg == "'{' was never closed"
with pytest.raises(SyntaxError) as excinfo:
self.parse("f'{3!:")
assert excinfo.value.msg == "f-string: missing conversion character"
with pytest.raises(SyntaxError) as excinfo:
self.parse("f'{\n3!:")
assert excinfo.value.msg == "f-string: missing conversion character"
exc = pytest.raises(SyntaxError, self.parse, '\n\nf"{$}"').value
assert exc.msg == "f-string: expecting a valid expression after '{'"
> assert exc.text == 'f"{$}"\n'
E assert 'f"{$}"' == 'f"{$}"\n'
E f"{$}"
interpreter/pyparser/test/test_pyparse.py:591: AssertionError
________________ test_f_string[format specifier: interpolation] ________________
source = 'f"result: {value:{width}.{precision}}"\n'
expected = [(7, 'f"', 1, 0, 1, 2), (8, 'result: ', 1, 2, 1, 10), (29, '{', 1, 10, 1, 11), (1, 'value', 1, 11, 1, 16), (14, ':', 1, 16, 1, 17), (8, '', 1, 17, 1, 17), ...]
@_parametrize("source, expected", _fstring_tests)
def test_f_string(source, expected):
lines = source.splitlines(True)
tks = tokenize(source)
assert tks[: len(expected)] == [
Token(
tk_type,
value,
lineno,
col_offset,
lines[end_lineno - 1],
end_lineno,
end_col_offset,
)
> for tk_type, value, lineno, col_offset, end_lineno, end_col_offset in expected
]
E assert [Token(FSTRIN...RACE, {), ...] == [Token(FSTRING...IDDLE, ), ...]
E At index 5 diff: Token(LBRACE, {) != Token(FSTRING_MIDDLE, )
E Use -v to get the full diff
interpreter/pyparser/test/test_pytokenizer.py:796: AssertionError
________________ test_f_string[format specifier: double braces] ________________
source = 'f"{x:{{}}b"}\n'
expected = [(7, 'f"', 1, 0, 1, 2), (29, '{', 1, 2, 1, 3), (1, 'x', 1, 3, 1, 4), (14, ':', 1, 4, 1, 5), (8, '', 1, 5, 1, 5), (29, '{', 1, 5, 1, 6), ...]
@_parametrize("source, expected", _fstring_tests)
def test_f_string(source, expected):
lines = source.splitlines(True)
tks = tokenize(source)
assert tks[: len(expected)] == [
Token(
tk_type,
value,
lineno,
col_offset,
lines[end_lineno - 1],
end_lineno,
end_col_offset,
)
> for tk_type, value, lineno, col_offset, end_lineno, end_col_offset in expected
]
E assert [Token(FSTRIN...RACE, {), ...] == [Token(FSTRING...RACE, {), ...]
E At index 4 diff: Token(LBRACE, {) != Token(FSTRING_MIDDLE, )
E Use -v to get the full diff
interpreter/pyparser/test/test_pytokenizer.py:796: AssertionError
____________________ test_f_string[format specifier bug 2] _____________________
source = "f'result: {value:{width:0}.{precision:1}}'\n"
expected = [(7, "f'", 1, 0, 1, 2), (8, 'result: ', 1, 2, 1, 10), (29, '{', 1, 10, 1, 11), (1, 'value', 1, 11, 1, 16), (14, ':', 1, 16, 1, 17), (8, '', 1, 17, 1, 17), ...]
@_parametrize("source, expected", _fstring_tests)
def test_f_string(source, expected):
lines = source.splitlines(True)
tks = tokenize(source)
assert tks[: len(expected)] == [
Token(
tk_type,
value,
lineno,
col_offset,
lines[end_lineno - 1],
end_lineno,
end_col_offset,
)
> for tk_type, value, lineno, col_offset, end_lineno, end_col_offset in expected
]
E assert [Token(FSTRIN...RACE, {), ...] == [Token(FSTRING...IDDLE, ), ...]
E At index 5 diff: Token(LBRACE, {) != Token(FSTRING_MIDDLE, )
E Use -v to get the full diff
interpreter/pyparser/test/test_pytokenizer.py:796: AssertionError
=========================== short test summary info ============================
FAIL interpreter/pyparser/test/apptest_parsestring.py::test_invalid_escape_syntax_error_span
FAIL interpreter/pyparser/test/test_pyparse.py::TestFString::()::test_exception_precedence
FAIL interpreter/pyparser/test/test_pytokenizer.py::test_f_string[format specifier: interpolation]
FAIL interpreter/pyparser/test/test_pytokenizer.py::test_f_string[format specifier: double braces]
FAIL interpreter/pyparser/test/test_pytokenizer.py::test_f_string[format specifier bug 2]
==================== 5 failed, 237 passed in 48.33 seconds =====================
++ 14:52:14 starting module/__pypy__/test [6 started in total]
__ module/__builtin__/test [3 done in total, somefailed=False] ________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 319 items
module/__builtin__/test/apptest_compile.py .....................
module/__builtin__/test/apptest_descriptor.py .....
module/__builtin__/test/apptest_operator.py ...
module/__builtin__/test/apptest_print.py ...
module/__builtin__/test/test_abstractinst.py ..........s..
module/__builtin__/test/test_breakpoint.py ........
module/__builtin__/test/test_builtin.py .......................................................................
module/__builtin__/test/test_compile.py ..
module/__builtin__/test/test_construct_singletons.py .
module/__builtin__/test/test_descriptor.py ...................................
module/__builtin__/test/test_dir.py ...........
module/__builtin__/test/test_filter.py ........
module/__builtin__/test/test_filter_pickle.py .....
module/__builtin__/test/test_format.py .
module/__builtin__/test/test_functional.py ........................................................................................
module/__builtin__/test/test_map_pickle.py ...
module/__builtin__/test/test_minmax.py .......................
module/__builtin__/test/test_rawinput.py ..
module/__builtin__/test/test_sum.py .
module/__builtin__/test/test_vars.py ...
module/__builtin__/test/test_zip.py ...........
module/__builtin__/test/test_zip_pickle.py .
==================== 318 passed, 1 skipped in 85.83 seconds ====================
++ 14:52:56 starting module/_abc/test [7 started in total]
__ module/_abc/test [4 done in total, somefailed=False] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module/_abc/test/apptest_abc.py ...
module/_abc/test/test_abc.py ...
========================== 6 passed in 31.07 seconds ===========================
++ 14:53:29 starting module/_ast/test [8 started in total]
__ module/__pypy__/test [5 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 81 items
module/__pypy__/test/apptest_picklebuffer.py ......
module/__pypy__/test/test_builders.py .....
module/__pypy__/test/test_bytebuffer.py ...
module/__pypy__/test/test_debug.py .......
module/__pypy__/test/test_identitydict.py ......
module/__pypy__/test/test_intop.py ...........
module/__pypy__/test/test_locals2fast.py .....
module/__pypy__/test/test_magic.py .......s..
module/__pypy__/test/test_newmemoryview.py ........
module/__pypy__/test/test_os.py .
module/__pypy__/test/test_signal.py ..s.s
module/__pypy__/test/test_special.py ............s.
==================== 77 passed, 4 skipped in 93.87 seconds =====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fb8690a9850>> ignored
++ 14:53:48 starting module/_cffi_backend/test [9 started in total]
__ module/_ast/test [6 done in total, somefailed=True] ________________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 55 items
module/_ast/test/apptest_ast.py ...
module/_ast/test/test_ast.py .........................F.....................F....
=================================== FAILURES ===================================
_________________________ AppTestAST.test_functiondef __________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f3195f4d410>
def test_functiondef(self):
import ast as ast_utils
import _ast as ast
fAst = ast.FunctionDef(
name="foo",
args=ast.arguments(
args=[], vararg=None, kwarg=None, defaults=[],
kwonlyargs=[], kw_defaults=[], posonlyargs=[]),
body=[ast.Expr(ast.Constant('docstring', None))],
decorator_list=[], lineno=5, col_offset=0)
exprAst = ast.Interactive(body=[fAst])
ast_utils.fix_missing_locations(exprAst)
> compiled = compile(exprAst, "<foo>", "single")
E (application-level) TypeError: required field 'type_params' missing from FunctionDef
[/build_dir/own-linux-x86-64/build/pypy/module/_ast/test/test_ast.py:349]:13: TypeError
___________ AppTestAST.test_fstring_self_documenting_feature_version ___________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f3195f4d410>
def test_fstring_self_documenting_feature_version(self):
> raises(SyntaxError, self.get_ast, "f'{x=}'", feature_version=7)
E (application-level) AssertionError: DID NOT RAISE
[/build_dir/own-linux-x86-64/build/pypy/module/_ast/test/test_ast.py:602]:2: AssertionError
=========================== short test summary info ============================
FAIL module/_ast/test/test_ast.py::AppTestAST::()::test_functiondef
FAIL module/_ast/test/test_ast.py::AppTestAST::()::test_fstring_self_documenting_feature_version
==================== 2 failed, 53 passed in 113.66 seconds =====================
++ 14:55:25 starting module/_codecs/test [10 started in total]
__ interpreter/astcompiler/test [7 done in total, somefailed=True] ____________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.py
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1550 items
interpreter/astcompiler/test/apptest_compiler.py ...F..
interpreter/astcompiler/test/apptest_exceptiongroup.py F...................F.F..
interpreter/astcompiler/test/apptest_fstring.py ........................
interpreter/astcompiler/test/apptest_misc.py ...............
interpreter/astcompiler/test/apptest_patma.py ...............................FFFFFFF
interpreter/astcompiler/test/test_assemble.py .......................
interpreter/astcompiler/test/test_ast.py ............
interpreter/astcompiler/test/test_astbuilder.py .......FF.................................................................................................x......
interpreter/astcompiler/test/test_compiler.py .......................................................................................................................................................................................................................................................................................................................................................................................................................................................................FF..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F.....................................................
interpreter/astcompiler/test/test_misc.py ...............
interpreter/astcompiler/test/test_symtable.py .................................................
interpreter/astcompiler/test/test_unparse.py ................................
interpreter/astcompiler/test/test_validate.py .....................................................
=================================== FAILURES ===================================
___________________________ test_elim_jump_to_return ___________________________
def test_elim_jump_to_return():
# CPython 3.11 keeps JUMP_FORWARD for "return x if cond else y".
# We check that no JUMP_ABSOLUTE is emitted, matching CPython.
import dis
def f():
return true_value if cond else false_value # noqa: F821
> instrs = list(dis.get_instructions(f))
interpreter/astcompiler/test/apptest_compiler.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('t\x00r\x04t\x01n\x01t\x02S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('cond'), W_UnicodeObject('true_value'), W_UnicodeObject('false_value'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
line_offset = W_IntObject(0), exception_entries = W_TupleObject()
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...upleObject(W_IntObject(67), W_IntObject(67), W_IntObject(8), W_IntObject(50))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
_______________________ test_with_try_except_as_reraise ________________________
def test_with_try_except_as_reraise():
"""with + try/except T as name where the handler raises: the new exception
must propagate through the with block's __exit__ without crashing.
Mirrors import_helper.import_module: with CM(): try: ... except E as msg: raise Other"""
class CM:
def __init__(self): self.exited = False; self.exc_type = None
def __enter__(self): return self
def __exit__(self, tp, val, tb):
self.exited = True
self.exc_type = tp
return False # do not suppress
cm = CM()
# normal_return=True exercises the normal-exit path so POP_BLOCK fires,
# mirroring import_helper.import_module which also has a normal return.
def inner(cm, raise_in_handler):
with cm:
try:
if raise_in_handler:
raise ValueError("original")
return "ok"
except ValueError as e:
raise TypeError("new")
print("=== dis(inner) ===")
> dis.dis(inner)
interpreter/astcompiler/test/apptest_exceptiongroup.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object inner, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/astcompiler/test/apptest_exceptiongroup.py", line 21>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object inner, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/astcompiler/test/apptest_exceptiongroup.py", line 21>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object inner, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/astcompiler/test/apptest_exceptiongroup.py", line 21>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x005\x00\x01\x00\t\x00|\x01r\nt\x00d\x01\x83\x01\x82\x01\t\x0...0w\x01#\x001\x00s*w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x00S\x00')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('ValueError'), W_UnicodeObject('TypeError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>, W_UnicodeObject('original'), W_UnicodeObject('ok'), W_UnicodeObject('new'))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x005\x00\x01\x00\t\x00|\x01r\nt\x00d\x01\x83\x01\x82\x01\t\x0...0w\x01#\x001\x00s*w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x00S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('ValueError'), W_UnicodeObject('TypeError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>, W_UnicodeObject('original'), W_UnicodeObject('ok'), W_UnicodeObject('new'))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...ct(84), W_IntObject(86), W_IntObject(78), W_IntObject(3), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...upleObject(W_IntObject(22), W_IntObject(28), W_IntObject(8), W_IntObject(38))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
----------------------------- Captured stdout call -----------------------------
=== dis(inner) ===
_______________________ test_except_star_cleanup_lineno ________________________
def test_except_star_cleanup_lineno():
"""Cleanup opcodes (LIST_APPEND) after except* must not be attributed to a
line before the except* clause (e.g. co_firstlineno of the function) — that
would misreport where the cleanup runs."""
def func():
try:
raise KeyError
except* Exception as e:
pass
> except_star_line = _except_star_clause_line(func)
interpreter/astcompiler/test/apptest_exceptiongroup.py:372:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
func = <Function func>
def _except_star_clause_line(func):
"""Return the line number of the except* clause in func via CHECK_EG_MATCH."""
> instrs = list(dis.get_instructions(func))
interpreter/astcompiler/test/apptest_exceptiongroup.py:357:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00t\x00\x82\x01#\x00&\x01g\x00c\x02t\x01%\x00&\x01\x9a\x0b}...1\x9e\x07\x01\x00Y\x00d\x00S\x00c\x02Y\x00w\x00c\x02Y\x00w\x00&\x03Y\x00w\x01')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('KeyError'), W_UnicodeObject('Exception'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
line_offset = W_IntObject(0), exception_entries = W_TupleObject()
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...61dd0>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>)])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
_____________________ test_except_star_trace_return_lineno _____________________
def test_except_star_trace_return_lineno():
"""The 'return' trace event after an except* block should report the except*
clause line, not co_firstlineno (which was the wrong pre-fix behaviour)."""
events = []
def tracer(frame, event, arg):
if frame.f_code.co_name == 'func':
events.append((event, frame.f_lineno))
return tracer
def func():
try:
raise KeyError
except* Exception as e:
pass
> except_star_line = _except_star_clause_line(func)
interpreter/astcompiler/test/apptest_exceptiongroup.py:425:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
func = <Function func>
def _except_star_clause_line(func):
"""Return the line number of the except* clause in func via CHECK_EG_MATCH."""
> instrs = list(dis.get_instructions(func))
interpreter/astcompiler/test/apptest_exceptiongroup.py:357:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00t\x00\x82\x01#\x00&\x01g\x00c\x02t\x01%\x00&\x01\x9a\x0b}...1\x9e\x07\x01\x00Y\x00d\x00S\x00c\x02Y\x00w\x00c\x02Y\x00w\x00&\x03Y\x00w\x01')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('KeyError'), W_UnicodeObject('Exception'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
line_offset = W_IntObject(0), exception_entries = W_TupleObject()
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...61dd0>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>)])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
_______________ test_match_mapping_codegen_uses_unpack_sequence ________________
def test_match_mapping_codegen_uses_unpack_sequence():
"""MATCH_KEYS result should be unpacked with UNPACK_SEQUENCE, not
with DUP_TOP+BINARY_SUBSCR+rotation. CPython emits:
MATCH_KEYS / COPY 1 / POP_JUMP_FORWARD_IF_NONE / UNPACK_SEQUENCE n
PyPy must match that pattern to avoid emitting SWAP instructions."""
import dis
def f(x):
match x:
case {'a': a, 'b': b, 'c': _}:
return a, b
> instrs = list(dis.get_instructions(f))
interpreter/astcompiler/test/apptest_patma.py:372:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00\x1f\x00r\x19\x1e\x00d\x01k\x05r\x19d\x02!\x00&\x01d\x00u\...x01\x00\x01\x00\x01\x00|\x01|\x02f\x02S\x00\x01\x00\x01\x00\x01\x00d\x00S\x00')
varname_from_oparg = bound method _varname_from_oparg, names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761..._TupleObject(W_UnicodeObject('a'), W_UnicodeObject('b'), W_UnicodeObject('c')))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
line_offset = W_IntObject(0), exception_entries = W_TupleObject()
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...eObject(W_IntObject(369), W_IntObject(369), W_IntObject(17), W_IntObject(41))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
_________________ test_match_class_no_swap_wildcard_b_wildcard _________________
def test_match_class_no_swap_wildcard_b_wildcard():
> _check_match_class_no_swap("C(_, b, _)")
interpreter/astcompiler/test/apptest_patma.py:411:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pattern = W_UnicodeObject('C(_, b, _)')
def _check_match_class_no_swap(pattern):
"""Check that MatchClass codegen for pattern emits no SWAP or BINARY_SUBSCR.
CPython emits MATCH_CLASS / POP_JUMP_IF_FALSE / UNPACK_SEQUENCE / stores.
PyPy currently uses DUP_TOP+BINARY_SUBSCR+SWAP rotation which the peephole
optimizer cannot always eliminate."""
import dis
src = (
"def f(x):\n"
" match x:\n"
" case %s:\n"
" pass\n"
) % pattern
ns = {}
exec(compile(src, "<test>", "exec"), ns)
f = ns["f"]
> instrs = list(dis.get_instructions(f))
interpreter/astcompiler/test/apptest_patma.py:401:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00t\x00d\x01\x98\x03r\x0b\\\x03\x01\x00}\x01\x01\x00d\x00S\x00\x01\x00d\x00S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('C'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>, W_TupleObject())
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
line_offset = W_IntObject(0), exception_entries = W_TupleObject()
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...TupleObject(W_IntObject(3), W_IntObject(3), W_IntObject(13), W_IntObject(23))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
_________________ test_match_class_no_swap_a_wildcard_wildcard _________________
def test_match_class_no_swap_a_wildcard_wildcard():
> _check_match_class_no_swap("C(a, _, _)")
interpreter/astcompiler/test/apptest_patma.py:414:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pattern = W_UnicodeObject('C(a, _, _)')
def _check_match_class_no_swap(pattern):
"""Check that MatchClass codegen for pattern emits no SWAP or BINARY_SUBSCR.
CPython emits MATCH_CLASS / POP_JUMP_IF_FALSE / UNPACK_SEQUENCE / stores.
PyPy currently uses DUP_TOP+BINARY_SUBSCR+SWAP rotation which the peephole
optimizer cannot always eliminate."""
import dis
src = (
"def f(x):\n"
" match x:\n"
" case %s:\n"
" pass\n"
) % pattern
ns = {}
exec(compile(src, "<test>", "exec"), ns)
f = ns["f"]
> instrs = list(dis.get_instructions(f))
interpreter/astcompiler/test/apptest_patma.py:401:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00t\x00d\x01\x98\x03r\x0b\\\x03}\x01\x01\x00\x01\x00d\x00S\x00\x01\x00d\x00S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('C'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>, W_TupleObject())
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
line_offset = W_IntObject(0), exception_entries = W_TupleObject()
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...TupleObject(W_IntObject(3), W_IntObject(3), W_IntObject(13), W_IntObject(23))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
____________________ test_match_class_no_swap_a_b_wildcard _____________________
def test_match_class_no_swap_a_b_wildcard():
> _check_match_class_no_swap("C(a, b, _)")
interpreter/astcompiler/test/apptest_patma.py:417:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pattern = W_UnicodeObject('C(a, b, _)')
def _check_match_class_no_swap(pattern):
"""Check that MatchClass codegen for pattern emits no SWAP or BINARY_SUBSCR.
CPython emits MATCH_CLASS / POP_JUMP_IF_FALSE / UNPACK_SEQUENCE / stores.
PyPy currently uses DUP_TOP+BINARY_SUBSCR+SWAP rotation which the peephole
optimizer cannot always eliminate."""
import dis
src = (
"def f(x):\n"
" match x:\n"
" case %s:\n"
" pass\n"
) % pattern
ns = {}
exec(compile(src, "<test>", "exec"), ns)
f = ns["f"]
> instrs = list(dis.get_instructions(f))
interpreter/astcompiler/test/apptest_patma.py:401:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00t\x00d\x01\x98\x03r\x0b\\\x03}\x01}\x02\x01\x00d\x00S\x00\x01\x00d\x00S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('C'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>, W_TupleObject())
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
line_offset = W_IntObject(0), exception_entries = W_TupleObject()
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...TupleObject(W_IntObject(3), W_IntObject(3), W_IntObject(13), W_IntObject(23))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
____________________ test_match_class_no_swap_a_wildcard_c _____________________
def test_match_class_no_swap_a_wildcard_c():
> _check_match_class_no_swap("C(a, _, c)")
interpreter/astcompiler/test/apptest_patma.py:420:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pattern = W_UnicodeObject('C(a, _, c)')
def _check_match_class_no_swap(pattern):
"""Check that MatchClass codegen for pattern emits no SWAP or BINARY_SUBSCR.
CPython emits MATCH_CLASS / POP_JUMP_IF_FALSE / UNPACK_SEQUENCE / stores.
PyPy currently uses DUP_TOP+BINARY_SUBSCR+SWAP rotation which the peephole
optimizer cannot always eliminate."""
import dis
src = (
"def f(x):\n"
" match x:\n"
" case %s:\n"
" pass\n"
) % pattern
ns = {}
exec(compile(src, "<test>", "exec"), ns)
f = ns["f"]
> instrs = list(dis.get_instructions(f))
interpreter/astcompiler/test/apptest_patma.py:401:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00t\x00d\x01\x98\x03r\x0b\\\x03}\x01\x01\x00}\x02d\x00S\x00\x01\x00d\x00S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('C'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>, W_TupleObject())
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
line_offset = W_IntObject(0), exception_entries = W_TupleObject()
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...TupleObject(W_IntObject(3), W_IntObject(3), W_IntObject(13), W_IntObject(23))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
____________________ test_match_class_no_swap_wildcard_b_c _____________________
def test_match_class_no_swap_wildcard_b_c():
> _check_match_class_no_swap("C(_, b, c)")
interpreter/astcompiler/test/apptest_patma.py:423:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pattern = W_UnicodeObject('C(_, b, c)')
def _check_match_class_no_swap(pattern):
"""Check that MatchClass codegen for pattern emits no SWAP or BINARY_SUBSCR.
CPython emits MATCH_CLASS / POP_JUMP_IF_FALSE / UNPACK_SEQUENCE / stores.
PyPy currently uses DUP_TOP+BINARY_SUBSCR+SWAP rotation which the peephole
optimizer cannot always eliminate."""
import dis
src = (
"def f(x):\n"
" match x:\n"
" case %s:\n"
" pass\n"
) % pattern
ns = {}
exec(compile(src, "<test>", "exec"), ns)
f = ns["f"]
> instrs = list(dis.get_instructions(f))
interpreter/astcompiler/test/apptest_patma.py:401:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00t\x00d\x01\x98\x03r\x0b\\\x03\x01\x00}\x01}\x02d\x00S\x00\x01\x00d\x00S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('C'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>, W_TupleObject())
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
line_offset = W_IntObject(0), exception_entries = W_TupleObject()
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...TupleObject(W_IntObject(3), W_IntObject(3), W_IntObject(13), W_IntObject(23))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
________________________ test_match_class_no_swap_a_b_c ________________________
def test_match_class_no_swap_a_b_c():
> _check_match_class_no_swap("C(a, b, c)")
interpreter/astcompiler/test/apptest_patma.py:426:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pattern = W_UnicodeObject('C(a, b, c)')
def _check_match_class_no_swap(pattern):
"""Check that MatchClass codegen for pattern emits no SWAP or BINARY_SUBSCR.
CPython emits MATCH_CLASS / POP_JUMP_IF_FALSE / UNPACK_SEQUENCE / stores.
PyPy currently uses DUP_TOP+BINARY_SUBSCR+SWAP rotation which the peephole
optimizer cannot always eliminate."""
import dis
src = (
"def f(x):\n"
" match x:\n"
" case %s:\n"
" pass\n"
) % pattern
ns = {}
exec(compile(src, "<test>", "exec"), ns)
f = ns["f"]
> instrs = list(dis.get_instructions(f))
interpreter/astcompiler/test/apptest_patma.py:401:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00t\x00d\x01\x98\x03r\x0b\\\x03}\x01}\x02}\x03d\x00S\x00\x01\x00d\x00S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('C'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>, W_TupleObject())
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
line_offset = W_IntObject(0), exception_entries = W_TupleObject()
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...TupleObject(W_IntObject(3), W_IntObject(3), W_IntObject(13), W_IntObject(23))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
_________________________ TestAstBuilding.test_import __________________________
self = <pypy.interpreter.astcompiler.test.test_astbuilder.TestAstBuilding instance at 0x7fd368a26550>
def test_import(self):
im = self.get_first_stmt("import x")
assert isinstance(im, ast.Import)
assert len(im.names) == 1
alias = im.names[0]
assert isinstance(alias, ast.alias)
assert alias.name == "x"
assert alias.asname is None
im = self.get_first_stmt("import x.y")
assert len(im.names) == 1
alias = im.names[0]
assert alias.name == "x.y"
assert alias.asname is None
im = self.get_first_stmt("import x as y")
assert len(im.names) == 1
alias = im.names[0]
assert alias.name == "x"
assert alias.asname == "y"
im = self.get_first_stmt("import x, y as w")
assert len(im.names) == 2
a1, a2 = im.names
assert a1.name == "x"
assert a1.asname is None
assert a2.name == "y"
assert a2.asname == "w"
with pytest.raises(SyntaxError) as excinfo:
self.get_ast("import x a b")
> assert excinfo.value.text == "import x a b\n"
E assert 'import x a b' == 'import x a b\n'
E import x a b
interpreter/astcompiler/test/test_astbuilder.py:151: AssertionError
_______________________ TestAstBuilding.test_from_import _______________________
self = <pypy.interpreter.astcompiler.test.test_astbuilder.TestAstBuilding instance at 0x7fd368e22f00>
def test_from_import(self):
im = self.get_first_stmt("from x import y")
assert isinstance(im, ast.ImportFrom)
assert im.module == "x"
assert im.level == 0
assert len(im.names) == 1
a = im.names[0]
assert isinstance(a, ast.alias)
assert a.name == "y"
assert a.asname is None
im = self.get_first_stmt("from . import y")
assert im.level == 1
assert im.module is None
im = self.get_first_stmt("from ... import y")
assert im.level == 3
assert im.module is None
im = self.get_first_stmt("from .x import y")
assert im.level == 1
assert im.module == "x"
im = self.get_first_stmt("from ..x.y import m")
assert im.level == 2
assert im.module == "x.y"
im = self.get_first_stmt("from x import *")
assert len(im.names) == 1
a = im.names[0]
assert a.name == "*"
assert a.asname is None
for input in ("from x import x, y", "from x import (x, y)"):
im = self.get_first_stmt(input)
assert len(im.names) == 2
a1, a2 = im.names
assert a1.name == "x"
assert a1.asname is None
assert a2.name == "y"
assert a2.asname is None
for input in ("from x import a as b, w", "from x import (a as b, w)"):
im = self.get_first_stmt(input)
assert len(im.names) == 2
a1, a2 = im.names
assert a1.name == "a"
assert a1.asname == "b"
assert a2.name == "w"
assert a2.asname is None
input = "from x import y a b"
with pytest.raises(SyntaxError) as excinfo:
self.get_ast(input)
> assert excinfo.value.text == input + "\n"
E assert 'from x import y a b' == 'from x import y a b\n'
E from x import y a b
interpreter/astcompiler/test/test_astbuilder.py:200: AssertionError
_____________ TestCompiler.test_load_method_position_multiline[0] ______________
self = <pypy.interpreter.astcompiler.test.test_compiler.TestCompiler instance at 0x7fd36a2154b0>
source = " def fmeth(): # line 1\n ( # line 2\n o. # li... positions = list(co.co_positions())\n result = positions[opcodes.index('LOAD_METHOD')]\n "
evalexpr = 'result', expected = (4, 4, 8, 9)
def simple_test(self, source, evalexpr, expected):
> w_g = self.run(source)
interpreter/astcompiler/test/test_compiler.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
interpreter/astcompiler/test/test_compiler.py:55: in run
code.exec_code(space, w_dict, w_dict)
interpreter/eval.py:33: in exec_code
return frame.run()
interpreter/pyframe.py:257: in run
return self.execute_frame()
interpreter/pyframe.py:350: in execute_frame
executioncontext)
interpreter/pyopcode.py:68: in dispatch
next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:91: in handle_bytecode
next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:74: in handle_bytecode
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:307: in dispatch_bytecode
self.CALL_FUNCTION(oparg, next_instr)
interpreter/pyopcode.py:1462: in CALL_FUNCTION
w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter/baseobjspace.py:1264: in call_valuestack
nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter/function.py:188: in funccall_valuestack
return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter/function.py:215: in _flat_pycall
return new_frame.run(self.name, self.qualname)
interpreter/pyframe.py:257: in run
return self.execute_frame()
interpreter/pyframe.py:350: in execute_frame
executioncontext)
interpreter/pyopcode.py:68: in dispatch
next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:91: in handle_bytecode
next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:74: in handle_bytecode
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:247: in dispatch_bytecode
next_instr = self.FOR_ITER(oparg, next_instr)
interpreter/pyopcode.py:1369: in FOR_ITER
w_nextitem = self.space.next(w_iterator)
interpreter/typedef.py:266: in call_shortcut
return getattr(self, shortcut_name)(space, *args_w)
<1120-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:2: in shortcut___next__
w_res = func(self)
interpreter/generator.py:334: in descr_next
return self.send_ex(self.space.w_None)
interpreter/generator.py:67: in send_ex
return self._send_ex(w_arg_or_err)
interpreter/generator.py:90: in _send_ex
w_result = self._invoke_execute_frame(w_arg_or_err)
interpreter/generator.py:131: in _invoke_execute_frame
w_result = frame.execute_frame(w_arg_or_err)
interpreter/pyframe.py:350: in execute_frame
executioncontext)
interpreter/pyopcode.py:68: in dispatch
next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:91: in handle_bytecode
next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:74: in handle_bytecode
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:307: in dispatch_bytecode
self.CALL_FUNCTION(oparg, next_instr)
interpreter/pyopcode.py:1462: in CALL_FUNCTION
w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter/baseobjspace.py:1264: in call_valuestack
nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter/function.py:169: in funccall_valuestack
return code.fastcall_2(self.space, self, f_1, f_0)
interpreter/gateway.py:1006: in fastcall_2
self.handle_exception(space, e)
interpreter/gateway.py:1001: in fastcall_2
w_result = self.fastfunc_2(space, w1, w2)
module/__builtin__/operation.py:167: in next
return space.next(w_iterator)
interpreter/typedef.py:266: in call_shortcut
return getattr(self, shortcut_name)(space, *args_w)
interpreter/typedef.py:260: in shortcut_fallback
return func(space, self, *args_w)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_obj = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...W_TupleObject(W_IntObject(4), W_IntObject(4), W_IntObject(8), W_IntObject(9))])
@use_special_method_shortcut('__next__')
def next(space, w_obj):
w_descr = space.lookup(w_obj, '__next__')
if w_descr is None:
raise oefmt(space.w_TypeError,
> "'%T' object is not an iterator", w_obj)
E OpErrFmt: [<W_TypeObject 'TypeError' at 0x7fd36dc63390>: 'list' object is not an iterator]
objspace/descroperation.py:353: OpErrFmt
_________ TestCompiler.test_augassign_attribute_position_multiline[0] __________
self = <pypy.interpreter.astcompiler.test.test_compiler.TestCompiler instance at 0x7fd36a215f50>
source = " def faug(): # line 1\n ( # line 2\n o. # li... store_idx = opcodes.index('STORE_ATTR')\n result = (positions[load_idx], positions[store_idx])\n "
evalexpr = 'result', expected = ((4, 4, 8, 9), (4, 4, 8, 9))
def simple_test(self, source, evalexpr, expected):
> w_g = self.run(source)
interpreter/astcompiler/test/test_compiler.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
interpreter/astcompiler/test/test_compiler.py:55: in run
code.exec_code(space, w_dict, w_dict)
interpreter/eval.py:33: in exec_code
return frame.run()
interpreter/pyframe.py:257: in run
return self.execute_frame()
interpreter/pyframe.py:350: in execute_frame
executioncontext)
interpreter/pyopcode.py:68: in dispatch
next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:91: in handle_bytecode
next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:74: in handle_bytecode
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:307: in dispatch_bytecode
self.CALL_FUNCTION(oparg, next_instr)
interpreter/pyopcode.py:1462: in CALL_FUNCTION
w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter/baseobjspace.py:1264: in call_valuestack
nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter/function.py:188: in funccall_valuestack
return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter/function.py:215: in _flat_pycall
return new_frame.run(self.name, self.qualname)
interpreter/pyframe.py:257: in run
return self.execute_frame()
interpreter/pyframe.py:350: in execute_frame
executioncontext)
interpreter/pyopcode.py:68: in dispatch
next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:91: in handle_bytecode
next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:74: in handle_bytecode
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:247: in dispatch_bytecode
next_instr = self.FOR_ITER(oparg, next_instr)
interpreter/pyopcode.py:1369: in FOR_ITER
w_nextitem = self.space.next(w_iterator)
interpreter/typedef.py:266: in call_shortcut
return getattr(self, shortcut_name)(space, *args_w)
<1120-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:2: in shortcut___next__
w_res = func(self)
interpreter/generator.py:334: in descr_next
return self.send_ex(self.space.w_None)
interpreter/generator.py:67: in send_ex
return self._send_ex(w_arg_or_err)
interpreter/generator.py:90: in _send_ex
w_result = self._invoke_execute_frame(w_arg_or_err)
interpreter/generator.py:131: in _invoke_execute_frame
w_result = frame.execute_frame(w_arg_or_err)
interpreter/pyframe.py:350: in execute_frame
executioncontext)
interpreter/pyopcode.py:68: in dispatch
next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:91: in handle_bytecode
next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:74: in handle_bytecode
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:307: in dispatch_bytecode
self.CALL_FUNCTION(oparg, next_instr)
interpreter/pyopcode.py:1462: in CALL_FUNCTION
w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter/baseobjspace.py:1264: in call_valuestack
nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter/function.py:169: in funccall_valuestack
return code.fastcall_2(self.space, self, f_1, f_0)
interpreter/gateway.py:1006: in fastcall_2
self.handle_exception(space, e)
interpreter/gateway.py:1001: in fastcall_2
w_result = self.fastfunc_2(space, w1, w2)
module/__builtin__/operation.py:167: in next
return space.next(w_iterator)
interpreter/typedef.py:266: in call_shortcut
return getattr(self, shortcut_name)(space, *args_w)
interpreter/typedef.py:260: in shortcut_fallback
return func(space, self, *args_w)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_obj = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...W_TupleObject(W_IntObject(4), W_IntObject(4), W_IntObject(8), W_IntObject(9))])
@use_special_method_shortcut('__next__')
def next(space, w_obj):
w_descr = space.lookup(w_obj, '__next__')
if w_descr is None:
raise oefmt(space.w_TypeError,
> "'%T' object is not an iterator", w_obj)
E OpErrFmt: [<W_TypeObject 'TypeError' at 0x7fd36dc63390>: 'list' object is not an iterator]
objspace/descroperation.py:353: OpErrFmt
__________________ AppTestCompiler.test_docstring_not_loaded ___________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fd365000e90>
def test_docstring_not_loaded(self):
import io, dis, sys
ns = {}
exec("def f():\n 'hi'", ns)
f = ns["f"]
save = sys.stdout
sys.stdout = output = io.StringIO()
try:
> dis.dis(f)
[/build_dir/own-linux-x86-64/build/pypy/interpreter/astcompiler/test/test_compiler.py:2758]:9:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object f, file "<string>", line 1>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object f, file "<string>", line 1>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object f, file "<string>", line 1>, lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('d\x01S\x00'), lasti = W_IntObject(-1)
varname_from_oparg = bound method _varname_from_oparg, names = W_TupleObject()
co_consts = W_TupleObject(W_UnicodeObject('hi'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('d\x01S\x00')
varname_from_oparg = bound method _varname_from_oparg, names = W_TupleObject()
co_consts = W_TupleObject(W_UnicodeObject('hi'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fd36d96e0d0>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.EmptyListStrategy object at 0x7fd36dac11d0>, None)
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fd3...61dd0>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fd36e761dd0>)])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
=========================== short test summary info ============================
FAIL interpreter/astcompiler/test/apptest_compiler.py::test_elim_jump_to_return
FAIL interpreter/astcompiler/test/apptest_exceptiongroup.py::test_with_try_except_as_reraise
FAIL interpreter/astcompiler/test/apptest_exceptiongroup.py::test_except_star_cleanup_lineno
FAIL interpreter/astcompiler/test/apptest_exceptiongroup.py::test_except_star_trace_return_lineno
FAIL interpreter/astcompiler/test/apptest_patma.py::test_match_mapping_codegen_uses_unpack_sequence
FAIL interpreter/astcompiler/test/apptest_patma.py::test_match_class_no_swap_wildcard_b_wildcard
FAIL interpreter/astcompiler/test/apptest_patma.py::test_match_class_no_swap_a_wildcard_wildcard
FAIL interpreter/astcompiler/test/apptest_patma.py::test_match_class_no_swap_a_b_wildcard
FAIL interpreter/astcompiler/test/apptest_patma.py::test_match_class_no_swap_a_wildcard_c
FAIL interpreter/astcompiler/test/apptest_patma.py::test_match_class_no_swap_wildcard_b_c
FAIL interpreter/astcompiler/test/apptest_patma.py::test_match_class_no_swap_a_b_c
FAIL interpreter/astcompiler/test/test_astbuilder.py::TestAstBuilding::()::test_import
FAIL interpreter/astcompiler/test/test_astbuilder.py::TestAstBuilding::()::test_from_import
FAIL interpreter/astcompiler/test/test_compiler.py::TestCompiler::()::test_load_method_position_multiline::[0]
FAIL interpreter/astcompiler/test/test_compiler.py::TestCompiler::()::test_augassign_attribute_position_multiline::[0]
FAIL interpreter/astcompiler/test/test_compiler.py::AppTestCompiler::()::test_docstring_not_loaded
============= 16 failed, 1533 passed, 1 xfailed in 246.49 seconds ==============
++ 14:55:35 starting module/_collections/test [11 started in total]
__ module/_collections/test [8 done in total, somefailed=False] _______________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 66 items
module/_collections/test/apptest_defaultdict.py ..............
module/_collections/test/apptest_deque.py ..........................................
module/_collections/test/apptest_ordereddict.py ..........
========================== 66 passed in 75.84 seconds ==========================
++ 14:56:55 starting module/_continuation/test [12 started in total]
__ module/_codecs/test [9 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 98 items
module/_codecs/test/apptest_codecs.py ..
module/_codecs/test/test_codecs.py ....................sss...........................................................s......
module/_codecs/test/test_locale.py ...ss.
module/_codecs/test/test_ztranslation.py .
==================== 92 passed, 6 skipped in 142.76 seconds ====================
++ 14:57:50 starting module/_cppyy/test [13 started in total]
__ module/_continuation/test [10 done in total, somefailed=False] _____________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 72 items / 2 skipped
module/_continuation/test/test_generator.py ....
module/_continuation/test/test_greenlet.py ............................
module/_continuation/test/test_stacklet.py ...................................s....
==================== 71 passed, 3 skipped in 77.97 seconds =====================
++ 14:58:15 starting module/_csv/test [14 started in total]
__ module/_csv/test [11 done in total, somefailed=True] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 34 items
module/_csv/test/test_dialect.py ..............
module/_csv/test/test_reader.py ....F........
module/_csv/test/test_writer.py ....F.
module/_csv/test/test_ztranslation.py .
=================================== FAILURES ===================================
_________________________ AppTestReader.test_read_eol __________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f53a2b25410>
def test_read_eol(self):
> import csv
[/build_dir/own-linux-x86-64/build/pypy/module/_csv/test/test_reader.py:44]:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
"""
csv.py - read/write/investigate CSV files
"""
import re
import types
> from _csv import Error, __version__, writer, reader, register_dialect, \
unregister_dialect, get_dialect, list_dialects, \
field_size_limit, \
QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONNUMERIC, QUOTE_NONE, \
QUOTE_STRINGS, QUOTE_NOTNULL, \
__doc__
E (application-level) ImportError: cannot import name 'QUOTE_STRINGS' from '_csv' (unknown location)
../lib-python/3/csv.py:8: ImportError
___________________ AppTestWriter.test_write_lineterminator ____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f53a20697d0>
def test_write_lineterminator(self):
from io import StringIO
> import csv
[/build_dir/own-linux-x86-64/build/pypy/module/_csv/test/test_writer.py:93]:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
"""
csv.py - read/write/investigate CSV files
"""
import re
import types
> from _csv import Error, __version__, writer, reader, register_dialect, \
unregister_dialect, get_dialect, list_dialects, \
field_size_limit, \
QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONNUMERIC, QUOTE_NONE, \
QUOTE_STRINGS, QUOTE_NOTNULL, \
__doc__
E (application-level) ImportError: cannot import name 'QUOTE_STRINGS' from '_csv' (unknown location)
../lib-python/3/csv.py:8: ImportError
=========================== short test summary info ============================
FAIL module/_csv/test/test_reader.py::AppTestReader::()::test_read_eol
FAIL module/_csv/test/test_writer.py::AppTestWriter::()::test_write_lineterminator
===================== 2 failed, 32 passed in 51.30 seconds =====================
++ 14:59:14 starting module/_demo/test [15 started in total]
__ module/_cffi_backend/test [12 done in total, somefailed=False] _____________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 467 items
module/_cffi_backend/test/test_c.py ....................................................................................s....................................................s.....s.......................s.............................s........................s......
module/_cffi_backend/test/test_fastpath.py ..................
module/_cffi_backend/test/test_ffi_obj.py ..............................................
module/_cffi_backend/test/test_file.py s..
module/_cffi_backend/test/test_parse_c_type.py ..............s...
module/_cffi_backend/test/test_re_python.py ....................
module/_cffi_backend/test/test_recompiler.py .........................................................................................s..s...............................
module/_cffi_backend/test/test_unicode_literals.py .......
module/_cffi_backend/test/test_wchar_helper.py .
module/_cffi_backend/test/test_ztranslation.py s
=================== 456 passed, 11 skipped in 348.59 seconds ===================
++ 14:59:42 starting module/_hpy_universal/test/_vendored [16 started in total]
__ module/_demo/test [13 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module/_demo/test/test_import.py ..
module/_demo/test/test_sieve.py .
========================== 3 passed in 27.91 seconds ===========================
++ 14:59:46 starting module/_hpy_universal/test/pypy [17 started in total]
__ module/_hpy_universal/test/pypy [14 done in total, somefailed=False] _______
('warning: setuptools.command.build does not exist in setuptools', '44.1.1', 'on', '2.7.18 (default, Jan 29 2025, 22:16:55) \n[GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]')
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 34 items
module/_hpy_universal/test/pypy/test_apiset.py .......
module/_hpy_universal/test/pypy/test_handlemanager.py ..................s......
module/_hpy_universal/test/pypy/test_storage.py .
module/_hpy_universal/test/pypy/test_ztranslation.py s
==================== 32 passed, 2 skipped in 12.12 seconds =====================
++ 15:00:04 starting module/_io/test [18 started in total]
__ module/_cppyy/test [15 done in total, somefailed=True] _____________________
[platform:WARNING] cc1plus: warning: command-line option ‘-Wno-discarded-qualifiers’ is valid for C/ObjC but not for C++
[platform:WARNING] cc1plus: warning: command-line option ‘-Wno-duplicate-decl-specifier’ is valid for C/ObjC but not for C++
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 191 items
module/_cppyy/test/test_advancedcpp.py sssssssssssssssssssssssss
module/_cppyy/test/test_boost.py sssss
module/_cppyy/test/test_cpp11features.py sEs
module/_cppyy/test/test_cppyy.py .EEEEEEEEEE
module/_cppyy/test/test_crossing.py ssss
module/_cppyy/test/test_datatypes.py EEEEEEEsssssssssssssss
module/_cppyy/test/test_fragile.py sssssssssssss
module/_cppyy/test/test_helper.py ......
module/_cppyy/test/test_operators.py sssssss
module/_cppyy/test/test_overloads.py sssssss
module/_cppyy/test/test_pythonify.py EEEEEsssssssssssss
module/_cppyy/test/test_pythonization.py Essssss
module/_cppyy/test/test_regression.py ss
module/_cppyy/test/test_stltypes.py sssssssssssssssssssssssss
module/_cppyy/test/test_templates.py sssssssssssssssssssssssssssssssss
module/_cppyy/test/test_zjit.py sss
==================================== ERRORS ====================================
____________ ERROR at setup of AppTestCPP11FEATURES.test02_nullptr _____________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf957b5050>, 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 'test02_nullptr'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test02_nullptr'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test02_nullptr'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test02_nullptr'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test02_nullptr'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test02_nullptr'>}
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 'test02_nullptr'>, '__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 0x7fcf9589dc30>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...02_nullptr'>, '__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 0x7fcf9589d050>
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 0x7fcf9589d050>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...02_nullptr'>, '__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 'test02_nullptr'>, '__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 'test02_nullptr'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test02_nullptr'>
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 'AppTestCPP11FEATURES'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestCPP11FEATURES'>
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._cppyy.test.test_cpp11features.AppTestCPP11FEATURES at 0x7fcf966b6fa0>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_example01 = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_cpp11features.py:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/cpp11featuresDict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf92cf3d10...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf92cf3d10...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf92cf3d10>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf92cf3d10...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
_______________ ERROR at setup of AppTestCPPYY.test01_static_int _______________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf957b52d0>, 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 'test01_static_int'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test01_static_int'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test01_static_int'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test01_static_int'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test01_static_int'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test01_static_int'>}
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 'test01_static_int'>, '__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 0x7fcf8fc65690>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...static_int'>, '__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 0x7fcf8fc65960>
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 0x7fcf8fc65960>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...static_int'>, '__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 'test01_static_int'>, '__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 'test01_static_int'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_static_int'>
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 'AppTestCPPYY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestCPPYY'>
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._cppyy.test.test_cppyy.AppTestCPPYY at 0x7fcf962c4130>
def setup_class(cls):
cls.w_lib, cls.w_instantiate, cls.w_example01, cls.w_payload = \
cls.space.unpackiterable(cls.space.appexec([], """():
import _cppyy, ctypes
_cppyy._post_import_startup()
lib = ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)
def cpp_instantiate(tt, *args):
inst = _cppyy._bind_object(0, tt, True)
ol = tt.get_overload("__init__").__get__(inst)
ol(*args)
return inst
return lib, cpp_instantiate, _cppyy._scope_byname('example01'),\
> _cppyy._scope_byname('payload')""" % (test_dct, )))
module/_cppyy/test/test_cppyy.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import _cppyy, ctypes\n _cppyy._post_import_startup()\n lib = ctypes.CDLL('/bu...turn lib, cpp_instantiate, _cppyy._scope_byname('example01'), _cppyy._scope_byname('payload')"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 1, next_instr = 14L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
_____________ ERROR at setup of AppTestCPPYY.test02_static_double ______________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf90725050>, 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 'test02_static_double'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test02_static_double'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test02_static_double'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test02_static_double'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test02_static_double'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test02_static_double'>}
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 'test02_static_double'>, '__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 0x7fcf8fe4aa00>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...tic_double'>, '__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 0x7fcf8fe4a960>
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 0x7fcf8fe4a960>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...tic_double'>, '__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 'test02_static_double'>, '__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 'test02_static_double'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test02_static_double'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_static_int'>
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 'AppTestCPPYY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestCPPYY'>
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._cppyy.test.test_cppyy.AppTestCPPYY at 0x7fcf962c4130>
def setup_class(cls):
cls.w_lib, cls.w_instantiate, cls.w_example01, cls.w_payload = \
cls.space.unpackiterable(cls.space.appexec([], """():
import _cppyy, ctypes
_cppyy._post_import_startup()
lib = ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)
def cpp_instantiate(tt, *args):
inst = _cppyy._bind_object(0, tt, True)
ol = tt.get_overload("__init__").__get__(inst)
ol(*args)
return inst
return lib, cpp_instantiate, _cppyy._scope_byname('example01'),\
> _cppyy._scope_byname('payload')""" % (test_dct, )))
module/_cppyy/test/test_cppyy.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import _cppyy, ctypes\n _cppyy._post_import_startup()\n lib = ctypes.CDLL('/bu...turn lib, cpp_instantiate, _cppyy._scope_byname('example01'), _cppyy._scope_byname('payload')"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 1, next_instr = 14L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
___________ ERROR at setup of AppTestCPPYY.test03_static_constcharp ____________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8f6bd750>, 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 'test03_static_constcharp'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test03_static_constcharp'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test03_static_constcharp'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test03_static_constcharp'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test03_static_constcharp'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test03_static_constcharp'>}
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 'test03_static_constcharp'>, '__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 0x7fcf8f5b1640>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...constcharp'>, '__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 0x7fcf8f5b15a0>
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 0x7fcf8f5b15a0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...constcharp'>, '__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 'test03_static_constcharp'>, '__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 'test03_static_constcharp'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test03_static_constcharp'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_static_int'>
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 'AppTestCPPYY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestCPPYY'>
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._cppyy.test.test_cppyy.AppTestCPPYY at 0x7fcf962c4130>
def setup_class(cls):
cls.w_lib, cls.w_instantiate, cls.w_example01, cls.w_payload = \
cls.space.unpackiterable(cls.space.appexec([], """():
import _cppyy, ctypes
_cppyy._post_import_startup()
lib = ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)
def cpp_instantiate(tt, *args):
inst = _cppyy._bind_object(0, tt, True)
ol = tt.get_overload("__init__").__get__(inst)
ol(*args)
return inst
return lib, cpp_instantiate, _cppyy._scope_byname('example01'),\
> _cppyy._scope_byname('payload')""" % (test_dct, )))
module/_cppyy/test/test_cppyy.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import _cppyy, ctypes\n _cppyy._post_import_startup()\n lib = ctypes.CDLL('/bu...turn lib, cpp_instantiate, _cppyy._scope_byname('example01'), _cppyy._scope_byname('payload')"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 1, next_instr = 14L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
_______________ ERROR at setup of AppTestCPPYY.test04_method_int _______________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8f6bd550>, 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 'test04_method_int'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test04_method_int'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test04_method_int'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test04_method_int'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test04_method_int'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test04_method_int'>}
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 'test04_method_int'>, '__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 0x7fcf8f1def00>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...method_int'>, '__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 0x7fcf8f1deeb0>
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 0x7fcf8f1deeb0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...method_int'>, '__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 'test04_method_int'>, '__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 'test04_method_int'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test04_method_int'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_static_int'>
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 'AppTestCPPYY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestCPPYY'>
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._cppyy.test.test_cppyy.AppTestCPPYY at 0x7fcf962c4130>
def setup_class(cls):
cls.w_lib, cls.w_instantiate, cls.w_example01, cls.w_payload = \
cls.space.unpackiterable(cls.space.appexec([], """():
import _cppyy, ctypes
_cppyy._post_import_startup()
lib = ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)
def cpp_instantiate(tt, *args):
inst = _cppyy._bind_object(0, tt, True)
ol = tt.get_overload("__init__").__get__(inst)
ol(*args)
return inst
return lib, cpp_instantiate, _cppyy._scope_byname('example01'),\
> _cppyy._scope_byname('payload')""" % (test_dct, )))
module/_cppyy/test/test_cppyy.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import _cppyy, ctypes\n _cppyy._post_import_startup()\n lib = ctypes.CDLL('/bu...turn lib, cpp_instantiate, _cppyy._scope_byname('example01'), _cppyy._scope_byname('payload')"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 1, next_instr = 14L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
_________________ ERROR at setup of AppTestCPPYY.test05_memory _________________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf90725050>, 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 'test05_memory'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test05_memory'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test05_memory'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test05_memory'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test05_memory'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test05_memory'>}
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 'test05_memory'>, '__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 0x7fcf8f63ec30>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...t05_memory'>, '__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 0x7fcf8f63eb90>
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 0x7fcf8f63eb90>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...t05_memory'>, '__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 'test05_memory'>, '__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 'test05_memory'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test05_memory'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_static_int'>
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 'AppTestCPPYY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestCPPYY'>
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._cppyy.test.test_cppyy.AppTestCPPYY at 0x7fcf962c4130>
def setup_class(cls):
cls.w_lib, cls.w_instantiate, cls.w_example01, cls.w_payload = \
cls.space.unpackiterable(cls.space.appexec([], """():
import _cppyy, ctypes
_cppyy._post_import_startup()
lib = ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)
def cpp_instantiate(tt, *args):
inst = _cppyy._bind_object(0, tt, True)
ol = tt.get_overload("__init__").__get__(inst)
ol(*args)
return inst
return lib, cpp_instantiate, _cppyy._scope_byname('example01'),\
> _cppyy._scope_byname('payload')""" % (test_dct, )))
module/_cppyy/test/test_cppyy.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import _cppyy, ctypes\n _cppyy._post_import_startup()\n lib = ctypes.CDLL('/bu...turn lib, cpp_instantiate, _cppyy._scope_byname('example01'), _cppyy._scope_byname('payload')"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 1, next_instr = 14L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
________________ ERROR at setup of AppTestCPPYY.test05a_memory2 ________________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf905dd6d0>, 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 'test05a_memory2'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test05a_memory2'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test05a_memory2'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test05a_memory2'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test05a_memory2'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test05a_memory2'>}
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 'test05a_memory2'>, '__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 0x7fcf8f426b90>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...5a_memory2'>, '__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 0x7fcf8f426b40>
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 0x7fcf8f426b40>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...5a_memory2'>, '__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 'test05a_memory2'>, '__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 'test05a_memory2'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test05a_memory2'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_static_int'>
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 'AppTestCPPYY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestCPPYY'>
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._cppyy.test.test_cppyy.AppTestCPPYY at 0x7fcf962c4130>
def setup_class(cls):
cls.w_lib, cls.w_instantiate, cls.w_example01, cls.w_payload = \
cls.space.unpackiterable(cls.space.appexec([], """():
import _cppyy, ctypes
_cppyy._post_import_startup()
lib = ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)
def cpp_instantiate(tt, *args):
inst = _cppyy._bind_object(0, tt, True)
ol = tt.get_overload("__init__").__get__(inst)
ol(*args)
return inst
return lib, cpp_instantiate, _cppyy._scope_byname('example01'),\
> _cppyy._scope_byname('payload')""" % (test_dct, )))
module/_cppyy/test/test_cppyy.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import _cppyy, ctypes\n _cppyy._post_import_startup()\n lib = ctypes.CDLL('/bu...turn lib, cpp_instantiate, _cppyy._scope_byname('example01'), _cppyy._scope_byname('payload')"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 1, next_instr = 14L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
_____________ ERROR at setup of AppTestCPPYY.test06_method_double ______________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8efc30d0>, 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 'test06_method_double'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test06_method_double'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test06_method_double'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test06_method_double'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test06_method_double'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test06_method_double'>}
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 'test06_method_double'>, '__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 0x7fcf8eb450f0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...hod_double'>, '__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 0x7fcf8eb45320>
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 0x7fcf8eb45320>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...hod_double'>, '__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 'test06_method_double'>, '__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 'test06_method_double'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test06_method_double'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_static_int'>
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 'AppTestCPPYY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestCPPYY'>
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._cppyy.test.test_cppyy.AppTestCPPYY at 0x7fcf962c4130>
def setup_class(cls):
cls.w_lib, cls.w_instantiate, cls.w_example01, cls.w_payload = \
cls.space.unpackiterable(cls.space.appexec([], """():
import _cppyy, ctypes
_cppyy._post_import_startup()
lib = ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)
def cpp_instantiate(tt, *args):
inst = _cppyy._bind_object(0, tt, True)
ol = tt.get_overload("__init__").__get__(inst)
ol(*args)
return inst
return lib, cpp_instantiate, _cppyy._scope_byname('example01'),\
> _cppyy._scope_byname('payload')""" % (test_dct, )))
module/_cppyy/test/test_cppyy.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import _cppyy, ctypes\n _cppyy._post_import_startup()\n lib = ctypes.CDLL('/bu...turn lib, cpp_instantiate, _cppyy._scope_byname('example01'), _cppyy._scope_byname('payload')"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 1, next_instr = 14L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
___________ ERROR at setup of AppTestCPPYY.test07_method_constcharp ____________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf9051b0d0>, 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 'test07_method_constcharp'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test07_method_constcharp'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test07_method_constcharp'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test07_method_constcharp'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test07_method_constcharp'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test07_method_constcharp'>}
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 'test07_method_constcharp'>, '__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 0x7fcf8f2b45f0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...constcharp'>, '__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 0x7fcf8f2b4e10>
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 0x7fcf8f2b4e10>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...constcharp'>, '__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 'test07_method_constcharp'>, '__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 'test07_method_constcharp'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test07_method_constcharp'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_static_int'>
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 'AppTestCPPYY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestCPPYY'>
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._cppyy.test.test_cppyy.AppTestCPPYY at 0x7fcf962c4130>
def setup_class(cls):
cls.w_lib, cls.w_instantiate, cls.w_example01, cls.w_payload = \
cls.space.unpackiterable(cls.space.appexec([], """():
import _cppyy, ctypes
_cppyy._post_import_startup()
lib = ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)
def cpp_instantiate(tt, *args):
inst = _cppyy._bind_object(0, tt, True)
ol = tt.get_overload("__init__").__get__(inst)
ol(*args)
return inst
return lib, cpp_instantiate, _cppyy._scope_byname('example01'),\
> _cppyy._scope_byname('payload')""" % (test_dct, )))
module/_cppyy/test/test_cppyy.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import _cppyy, ctypes\n _cppyy._post_import_startup()\n lib = ctypes.CDLL('/bu...turn lib, cpp_instantiate, _cppyy._scope_byname('example01'), _cppyy._scope_byname('payload')"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 1, next_instr = 14L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
_________ ERROR at setup of AppTestCPPYY.test08_pass_object_by_pointer _________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf9051bc50>, 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 'test08_pass_object_by_pointer'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test08_pass_object_by_pointer'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test08_pass_object_by_pointer'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test08_pass_object_by_pointer'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test08_pass_object_by_pointer'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test08_pass_object_by_pointer'>}
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 'test08_pass_object_by_pointer'>, '__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 0x7fcf905f7d20>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...by_pointer'>, '__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 0x7fcf905f7eb0>
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 0x7fcf905f7eb0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...by_pointer'>, '__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 'test08_pass_object_by_pointer'>, '__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 'test08_pass_object_by_pointer'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test08_pass_object_by_pointer'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_static_int'>
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 'AppTestCPPYY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestCPPYY'>
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._cppyy.test.test_cppyy.AppTestCPPYY at 0x7fcf962c4130>
def setup_class(cls):
cls.w_lib, cls.w_instantiate, cls.w_example01, cls.w_payload = \
cls.space.unpackiterable(cls.space.appexec([], """():
import _cppyy, ctypes
_cppyy._post_import_startup()
lib = ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)
def cpp_instantiate(tt, *args):
inst = _cppyy._bind_object(0, tt, True)
ol = tt.get_overload("__init__").__get__(inst)
ol(*args)
return inst
return lib, cpp_instantiate, _cppyy._scope_byname('example01'),\
> _cppyy._scope_byname('payload')""" % (test_dct, )))
module/_cppyy/test/test_cppyy.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import _cppyy, ctypes\n _cppyy._post_import_startup()\n lib = ctypes.CDLL('/bu...turn lib, cpp_instantiate, _cppyy._scope_byname('example01'), _cppyy._scope_byname('payload')"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 1, next_instr = 14L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
________ ERROR at setup of AppTestCPPYY.test09_return_object_by_pointer ________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf9054e6d0>, 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 'test09_return_object_by_pointer'>, '...lticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test09_return_object_by_pointer'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test09_return_object_by_pointer'>, '...lticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test09_return_object_by_pointer'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test09_return_object_by_pointer'>, '...lticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test09_return_object_by_pointer'>}
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 'test09_return_object_by_pointer'>, '__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 0x7fcf8ec56f50>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...by_pointer'>, '__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 0x7fcf8ec56140>
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 0x7fcf8ec56140>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...by_pointer'>, '__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 'test09_return_object_by_pointer'>, '__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 'test09_return_object_by_pointer'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test09_return_object_by_pointer'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_static_int'>
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 'AppTestCPPYY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestCPPYY'>
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._cppyy.test.test_cppyy.AppTestCPPYY at 0x7fcf962c4130>
def setup_class(cls):
cls.w_lib, cls.w_instantiate, cls.w_example01, cls.w_payload = \
cls.space.unpackiterable(cls.space.appexec([], """():
import _cppyy, ctypes
_cppyy._post_import_startup()
lib = ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)
def cpp_instantiate(tt, *args):
inst = _cppyy._bind_object(0, tt, True)
ol = tt.get_overload("__init__").__get__(inst)
ol(*args)
return inst
return lib, cpp_instantiate, _cppyy._scope_byname('example01'),\
> _cppyy._scope_byname('payload')""" % (test_dct, )))
module/_cppyy/test/test_cppyy.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import _cppyy, ctypes\n _cppyy._post_import_startup()\n lib = ctypes.CDLL('/bu...turn lib, cpp_instantiate, _cppyy._scope_byname('example01'), _cppyy._scope_byname('payload')"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00\x8a\x00d\x01d\x00l\x01}\x00\x89\x00\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02}\x01\x88\x00f\x01d\x03\x84\x08}\x02|\x01|\x02\x89\x00\xa0\x05d\x04\xa1\x01\x89\x00\xa0\x05d\x05\xa1\x01f\x04S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 1, next_instr = 14L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8fc63510...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
_____ ERROR at setup of AppTestDATATYPES.test01_instance_data_read_access ______
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8eb46d50>, 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 'test01_instance_data_read_access'>, ...ticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test01_instance_data_read_access'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test01_instance_data_read_access'>, ...ticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test01_instance_data_read_access'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test01_instance_data_read_access'>, ...ticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test01_instance_data_read_access'>}
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 'test01_instance_data_read_access'>, '__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 0x7fcf8fe3daa0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ead_access'>, '__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 0x7fcf8fe3dd70>
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 0x7fcf8fe3dd70>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ead_access'>, '__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 'test01_instance_data_read_access'>, '__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 'test01_instance_data_read_access'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_instance_data_read_access'>
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 'AppTestDATATYPES'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestDATATYPES'>
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._cppyy.test.test_datatypes.AppTestDATATYPES at 0x7fcf95f4b130>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_datatypes = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_datatypes.py:20:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/datatypesDict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
_____ ERROR at setup of AppTestDATATYPES.test02_instance_data_write_access _____
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf90e0a450>, 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 'test02_instance_data_write_access'>,...icall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test02_instance_data_write_access'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test02_instance_data_write_access'>,...icall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test02_instance_data_write_access'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test02_instance_data_write_access'>,...icall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test02_instance_data_write_access'>}
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 'test02_instance_data_write_access'>, '__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 0x7fcf8f5913c0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ite_access'>, '__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 0x7fcf8f591280>
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 0x7fcf8f591280>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ite_access'>, '__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 'test02_instance_data_write_access'>, '__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 'test02_instance_data_write_access'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test02_instance_data_write_access'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_instance_data_read_access'>
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 'AppTestDATATYPES'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestDATATYPES'>
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._cppyy.test.test_datatypes.AppTestDATATYPES at 0x7fcf95f4b130>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_datatypes = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_datatypes.py:20:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/datatypesDict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
___________ ERROR at setup of AppTestDATATYPES.test03_array_passing ____________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8ed00150>, 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 'test03_array_passing'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test03_array_passing'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test03_array_passing'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test03_array_passing'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test03_array_passing'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test03_array_passing'>}
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 'test03_array_passing'>, '__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 0x7fcf8f4b38c0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ay_passing'>, '__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 0x7fcf8f4b3d20>
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 0x7fcf8f4b3d20>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ay_passing'>, '__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 'test03_array_passing'>, '__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 'test03_array_passing'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test03_array_passing'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_instance_data_read_access'>
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 'AppTestDATATYPES'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestDATATYPES'>
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._cppyy.test.test_datatypes.AppTestDATATYPES at 0x7fcf95f4b130>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_datatypes = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_datatypes.py:20:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/datatypesDict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
_________ ERROR at setup of AppTestDATATYPES.test04_class_read_access __________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8e821ad0>, 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 'test04_class_read_access'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test04_class_read_access'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test04_class_read_access'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test04_class_read_access'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test04_class_read_access'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test04_class_read_access'>}
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 'test04_class_read_access'>, '__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 0x7fcf8e88d870>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ead_access'>, '__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 0x7fcf8e88d8c0>
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 0x7fcf8e88d8c0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ead_access'>, '__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 'test04_class_read_access'>, '__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 'test04_class_read_access'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test04_class_read_access'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_instance_data_read_access'>
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 'AppTestDATATYPES'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestDATATYPES'>
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._cppyy.test.test_datatypes.AppTestDATATYPES at 0x7fcf95f4b130>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_datatypes = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_datatypes.py:20:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/datatypesDict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
______ ERROR at setup of AppTestDATATYPES.test05_class_data_write_access _______
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8f1e0e50>, 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 'test05_class_data_write_access'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test05_class_data_write_access'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test05_class_data_write_access'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test05_class_data_write_access'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test05_class_data_write_access'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test05_class_data_write_access'>}
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 'test05_class_data_write_access'>, '__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 0x7fcf902381e0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ite_access'>, '__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 0x7fcf90238050>
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 0x7fcf90238050>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ite_access'>, '__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 'test05_class_data_write_access'>, '__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 'test05_class_data_write_access'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test05_class_data_write_access'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_instance_data_read_access'>
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 'AppTestDATATYPES'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestDATATYPES'>
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._cppyy.test.test_datatypes.AppTestDATATYPES at 0x7fcf95f4b130>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_datatypes = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_datatypes.py:20:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/datatypesDict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
____________ ERROR at setup of AppTestDATATYPES.test06_range_access ____________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8ec2b750>, 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 'test06_range_access'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test06_range_access'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test06_range_access'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test06_range_access'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test06_range_access'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test06_range_access'>}
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 'test06_range_access'>, '__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 0x7fcf907cfb90>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...nge_access'>, '__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 0x7fcf907cfaf0>
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 0x7fcf907cfaf0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...nge_access'>, '__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 'test06_range_access'>, '__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 'test06_range_access'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test06_range_access'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_instance_data_read_access'>
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 'AppTestDATATYPES'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestDATATYPES'>
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._cppyy.test.test_datatypes.AppTestDATATYPES at 0x7fcf95f4b130>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_datatypes = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_datatypes.py:20:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/datatypesDict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
__________ ERROR at setup of AppTestDATATYPES.test07_type_conversions __________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8eaf1c50>, 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 'test07_type_conversions'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test07_type_conversions'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test07_type_conversions'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test07_type_conversions'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test07_type_conversions'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test07_type_conversions'>}
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 'test07_type_conversions'>, '__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 0x7fcf901ab370>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...onversions'>, '__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 0x7fcf901ab4b0>
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 0x7fcf901ab4b0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...onversions'>, '__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 'test07_type_conversions'>, '__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 'test07_type_conversions'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test07_type_conversions'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_instance_data_read_access'>
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 'AppTestDATATYPES'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestDATATYPES'>
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._cppyy.test.test_datatypes.AppTestDATATYPES at 0x7fcf95f4b130>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_datatypes = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_datatypes.py:20:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/datatypesDict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf90cff2d0...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
__________ ERROR at setup of AppTestPYTHONIFY.test01_finding_classes ___________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8ebeed50>, 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 'test01_finding_classes'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test01_finding_classes'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test01_finding_classes'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test01_finding_classes'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test01_finding_classes'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test01_finding_classes'>}
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 'test01_finding_classes'>, '__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 0x7fcf8ef17370>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ng_classes'>, '__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 0x7fcf8ebaa320>
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 0x7fcf8ebaa320>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ng_classes'>, '__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 'test01_finding_classes'>, '__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 'test01_finding_classes'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_finding_classes'>
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 'AppTestPYTHONIFY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestPYTHONIFY'>
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._cppyy.test.test_pythonify.AppTestPYTHONIFY at 0x7fcf95efe130>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_example01 = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_pythonify.py:21:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/example01Dict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
______ ERROR at setup of AppTestPYTHONIFY.test02_calling_static_functions ______
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8ecee9d0>, 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 'test02_calling_static_functions'>, '...lticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test02_calling_static_functions'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test02_calling_static_functions'>, '...lticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test02_calling_static_functions'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test02_calling_static_functions'>, '...lticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test02_calling_static_functions'>}
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 'test02_calling_static_functions'>, '__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 0x7fcf8ef6f870>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i..._functions'>, '__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 0x7fcf8ef6f9b0>
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 0x7fcf8ef6f9b0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i..._functions'>, '__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 'test02_calling_static_functions'>, '__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 'test02_calling_static_functions'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test02_calling_static_functions'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_finding_classes'>
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 'AppTestPYTHONIFY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestPYTHONIFY'>
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._cppyy.test.test_pythonify.AppTestPYTHONIFY at 0x7fcf95efe130>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_example01 = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_pythonify.py:21:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/example01Dict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
______ ERROR at setup of AppTestPYTHONIFY.test03_constructing_and_calling ______
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8e91abd0>, 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 'test03_constructing_and_calling'>, '...lticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test03_constructing_and_calling'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test03_constructing_and_calling'>, '...lticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test03_constructing_and_calling'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test03_constructing_and_calling'>, '...lticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test03_constructing_and_calling'>}
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 'test03_constructing_and_calling'>, '__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 0x7fcf8f106f50>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...nd_calling'>, '__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 0x7fcf8f106870>
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 0x7fcf8f106870>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...nd_calling'>, '__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 'test03_constructing_and_calling'>, '__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 'test03_constructing_and_calling'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test03_constructing_and_calling'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_finding_classes'>
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 'AppTestPYTHONIFY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestPYTHONIFY'>
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._cppyy.test.test_pythonify.AppTestPYTHONIFY at 0x7fcf95efe130>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_example01 = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_pythonify.py:21:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/example01Dict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
_____ ERROR at setup of AppTestPYTHONIFY.test04_passing_object_by_pointer ______
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8ebee050>, 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 'test04_passing_object_by_pointer'>, ...ticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test04_passing_object_by_pointer'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test04_passing_object_by_pointer'>, ...ticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test04_passing_object_by_pointer'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test04_passing_object_by_pointer'>, ...ticall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test04_passing_object_by_pointer'>}
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 'test04_passing_object_by_pointer'>, '__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 0x7fcf901cb960>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...by_pointer'>, '__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 0x7fcf901cb8c0>
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 0x7fcf901cb8c0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...by_pointer'>, '__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 'test04_passing_object_by_pointer'>, '__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 'test04_passing_object_by_pointer'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test04_passing_object_by_pointer'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_finding_classes'>
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 'AppTestPYTHONIFY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestPYTHONIFY'>
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._cppyy.test.test_pythonify.AppTestPYTHONIFY at 0x7fcf95efe130>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_example01 = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_pythonify.py:21:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/example01Dict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
____ ERROR at setup of AppTestPYTHONIFY.test05_returning_object_by_pointer _____
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf90781f50>, 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 'test05_returning_object_by_pointer'>...call__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test05_returning_object_by_pointer'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test05_returning_object_by_pointer'>...call__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test05_returning_object_by_pointer'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test05_returning_object_by_pointer'>...call__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test05_returning_object_by_pointer'>}
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 'test05_returning_object_by_pointer'>, '__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 0x7fcf90545d70>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...by_pointer'>, '__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 0x7fcf90545fa0>
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 0x7fcf90545fa0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...by_pointer'>, '__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 'test05_returning_object_by_pointer'>, '__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 'test05_returning_object_by_pointer'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test05_returning_object_by_pointer'>
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 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test01_finding_classes'>
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 'AppTestPYTHONIFY'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestPYTHONIFY'>
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._cppyy.test.test_pythonify.AppTestPYTHONIFY at 0x7fcf95efe130>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_example01 = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_pythonify.py:21:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n return ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/example01Dict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00|\x00\xa0\x03d\x02|\x00j\x04\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf907afa50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
______________ ERROR at setup of AppTestPYTHONIZATION.test00_api _______________
self = <CallInfo when='setup' exception: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]>
func = <function <lambda> at 0x7fcf8e818ed0>, 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 'test00_api'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test00_api'>}
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 0x7fcf9b80ff50>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test00_api'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test00_api'>}
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 0x7fcf96871a50>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x7fcf99e82be0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test00_api'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test00_api'>}
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 'test00_api'>, '__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 0x7fcf8f159d20>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...test00_api'>, '__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 0x7fcf8f159dc0>
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 0x7fcf8f159dc0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...test00_api'>, '__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 'test00_api'>, '__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 'test00_api'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
../_pytest/runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x7fcf967ea1d0>
colitem = <AppTestMethod 'test00_api'>
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 'AppTestPYTHONIZATION'>
def setup(self):
> super(AppClassCollector, self).setup()
tool/pytest/apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestPYTHONIZATION'>
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._cppyy.test.test_pythonization.AppTestPYTHONIZATION at 0x7fcf95efeec0>
def setup_class(cls):
cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_datatypes = cls.space.appexec([], """():
import ctypes, _cppyy
_cppyy._post_import_startup()
class py(object):
pass
py.add_pythonization = _cppyy.add_pythonization
py.remove_pythonization = _cppyy.remove_pythonization
py.pin_type = _cppyy._pin_type
_cppyy.py = py
> return ctypes.CDLL(%r, ctypes.RTLD_GLOBAL)""" % (test_dct, ))
module/_cppyy/test/test_pythonization.py:26:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, posargs_w = []
source = "():\n import ctypes, _cppyy\n _cppyy._post_import_startup()\n class py(object):\n ...turn ctypes.CDLL('/build_dir/own-linux-x86-64/build/pypy/module/_cppyy/test/pythonizablesDict.so', ctypes.RTLD_GLOBAL)"
cache = True
@specialize.arg(2)
def appexec(self, posargs_w, source, cache=True):
""" return value from executing given source at applevel.
The source must look like
'''(x, y):
do_stuff...
return result
'''
"""
if cache:
w_func = self.fromcache(AppExecCache).getorbuild(source)
else:
# NB: since appdef() is not-RPython, using cache=False also is.
w_func = self.appdef(source)
args = Arguments(self, list(posargs_w))
> return self.call_args(w_func, args)
interpreter/baseobjspace.py:1483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function anonymous>, args = Arguments([])
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 anonymous>, args = Arguments([])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object anonymous, file "?", line 1>, func = <Function anonymous>
args = Arguments([])
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 anonymous, file "?", line 1> at line 2
name = 'anonymous', qualname = 'anonymous'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
pycode = <code object anonymous, file "?", line 1>, next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00G\x00d\x02\x84\x00d\x03t\x03\x83\x03}\x02|\x01j\x04|\x02_\x04|\x01j\x05|\x02_\x05|\x01j\x06|\x02_\x07|\x02|\x01_\x08|\x00\xa0\td\x04|\x00j\n\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00G\x00d\x02\x84\x00d\x03t\x03\x83\x03}\x02|\x01j\x04|\x02_\x04|\x01j\x05|\x02_\x05|\x01j\x06|\x02_\x07|\x02|\x01_\x08|\x00\xa0\td\x04|\x00j\n\xa1\x02S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 anonymous, file "?", line 1> at line 2
co_code = 'd\x01d\x00l\x00}\x00d\x01d\x00l\x01}\x01|\x01\xa0\x02\xa1\x00\x01\x00G\x00d\x02\x84\x00d\x03t\x03\x83\x03}\x02|\x01j\x04|\x02_\x04|\x01j\x05|\x02_\x05|\x01j\x06|\x02_\x07|\x02|\x01_\x08|\x00\xa0\td\x04|\x00j\n\xa1\x02S\x00'
next_instr = 6L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
elif opcode == opcodedesc.CHECK_EG_MATCH.index:
self.CHECK_EG_MATCH(oparg, next_instr)
elif opcode == opcodedesc.CHECK_EXC_MATCH.index:
self.CHECK_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.COMPARE_OP.index:
self.COMPARE_OP(oparg, next_instr)
elif opcode == opcodedesc.IS_OP.index:
self.IS_OP(oparg, next_instr)
elif opcode == opcodedesc.CONTAINS_OP.index:
self.CONTAINS_OP(oparg, next_instr)
elif opcode == opcodedesc.DELETE_ATTR.index:
self.DELETE_ATTR(oparg, next_instr)
elif opcode == opcodedesc.DELETE_DEREF.index:
self.DELETE_DEREF(oparg, next_instr)
elif opcode == opcodedesc.DELETE_FAST.index:
self.DELETE_FAST(oparg, next_instr)
elif opcode == opcodedesc.SETUP_ANNOTATIONS.index:
self.SETUP_ANNOTATIONS(oparg, next_instr)
elif opcode == opcodedesc.DELETE_GLOBAL.index:
self.DELETE_GLOBAL(oparg, next_instr)
elif opcode == opcodedesc.DELETE_NAME.index:
self.DELETE_NAME(oparg, next_instr)
elif opcode == opcodedesc.DELETE_SUBSCR.index:
self.DELETE_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP.index:
self.DUP_TOP(oparg, next_instr)
elif opcode == opcodedesc.DUP_TOP_TWO.index:
self.DUP_TOP_TWO(oparg, next_instr)
elif opcode == opcodedesc.GET_ITER.index:
self.GET_ITER(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_FROM.index:
self.IMPORT_FROM(oparg, next_instr)
elif opcode == opcodedesc.IMPORT_NAME.index:
> self.IMPORT_NAME(oparg, next_instr)
interpreter/pyopcode.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object anonymous, file "?", line 1> at line 2
nameindex = 0, next_instr = 6L
def IMPORT_NAME(self, nameindex, next_instr):
space = self.space
w_modulename = self.getname_w(nameindex)
w_fromlist = self.popvalue()
w_flag = self.popvalue()
w_import = self.get_builtin().getdictvalue(space, '__import__')
if w_import is None:
raise oefmt(space.w_ImportError, "__import__ not found")
d = self.getdebug()
if d is None:
w_locals = None
else:
w_locals = d.w_locals
if w_locals is None: # CPython does this
w_locals = space.w_None
w_globals = self.get_w_globals()
w_obj = space.call_function(w_import, w_modulename, w_globals,
> w_locals, w_fromlist, w_flag)
interpreter/pyopcode.py:1192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8f494f50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441a50>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
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 0x7fcf93441bd0>
space = StdObjSpace
scope_w = [W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8f494f50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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])
<2857-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('ctypes')
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8f494f50>)
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
w_fromlist = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>
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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x7fcf8f494f50...Object object at 0x7fcf952fe190>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
func = <Function __import__>
args = Arguments([W_UnicodeObject('ctypes'), W_ModuleDictObject(<pypy.objspace.std.ce...bjspace.std.noneobject.W_NoneObject object at 0x7fcf952fe190>, 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 1454> at line 1466
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1454>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 0x7fcf9465f590>
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 1454> at line 1466
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 0x7fcf9465f590>
@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 1454> at line 1466
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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 1454> at line 1466
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:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1454> at line 1466
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:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
> next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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 0x7fcf9465f590>
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 1375> at line 1387
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 0x7fcf9465f590>
@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 1375> at line 1387
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:1462:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 1375> at line 1387
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 1375> at line 1387
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:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1375> at line 1387
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:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349>
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
def handle_bytecode(self, co_code, next_instr, ec):
try:
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
except OperationError as operr:
try:
operr.record_context(self.space, ec)
except OperationError as operr2:
# this should be unreachable! but we don't want to crash if it
# still happens
w_value = operr.normalize_exception(self.space)
w_value2 = operr2.normalize_exception(self.space)
# NB: don't *raise* it, it's handled by the
# handle_operation_error call below (otherwise some higher up
# except block handles it)
operr = oefmt(
self.space.w_TypeError,
"couldn't record exception context for exception '%T', got: %R",
w_value,
w_value2)
next_instr = self.handle_operation_error(ec, operr)
except RaiseWithExplicitTraceback as e:
next_instr = self.handle_operation_error(ec, e.operr,
attach_tb=False,
> reraise_lasti=e.lasti)
interpreter/pyopcode.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 116L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
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 1349> at line 1360
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...x00\x83\x01\x01\x00|\x02d\x02u\x00rUd\x05|\x00\x9b\x00d\x06\x9d\x03}\x03t\x08|\x03|\x00d\x07\xaa\x02\x82\x01|\x02S\x00'
next_instr = 122L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7fcf9465f590>
@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)
interpreter/pyopcode.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fcf94e4f990>: W_ImportError([W_UnicodeObject("cannot import name 'SIZEOF_TIME_T' from '_ctypes' (/build_dir/own-linux-x86-64/build/lib_pypy/_ctypes/__init__.py)")])]
interpreter/pyopcode.py:1456: OperationError
============== 7 passed, 160 skipped, 24 error in 136.33 seconds ===============
++ 15:00:15 starting module/_jitlog/test [19 started in total]
__ module/_jitlog/test [16 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/_jitlog/test/test__jitlog.py .
========================== 1 passed in 14.64 seconds ===========================
++ 15:00:32 starting module/_locale/test [20 started in total]
__ module/_locale/test [17 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 15 items
module/_locale/test/test_locale.py sssssssssssssss
========================= 15 skipped in 10.95 seconds ==========================
++ 15:00:44 starting module/_lsprof/test [21 started in total]
__ module/_lsprof/test [18 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module/_lsprof/test/test_cprofile.py ......
========================== 6 passed in 12.48 seconds ===========================
++ 15:00:59 starting module/_md5/test [22 started in total]
__ module/_md5/test [19 done in total, somefailed=False] ______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 8 items
module/_md5/test/test_md5.py ........
========================== 8 passed in 11.08 seconds ===========================
++ 15:01:11 starting module/_minimal_curses/test [23 started in total]
__ module/_minimal_curses/test [20 done in total, somefailed=False] ___________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module/_minimal_curses/test/test_curses.py ......
========================== 6 passed in 74.95 seconds ===========================
++ 15:02:31 starting module/_multibytecodec/test [24 started in total]
__ module/_multibytecodec/test [21 done in total, somefailed=False] ___________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 67 items
module/_multibytecodec/test/apptest_codecs.py ...................
module/_multibytecodec/test/apptest_incremental.py ....................
module/_multibytecodec/test/apptest_stream.py .....
module/_multibytecodec/test/test_c_codecs.py ..................s
module/_multibytecodec/test/test_multibtye_codecs.py ...
module/_multibytecodec/test/test_translation.py s
==================== 65 passed, 2 skipped in 53.78 seconds =====================
++ 15:03:30 starting module/_multiprocessing/test [25 started in total]
__ interpreter/test [22 done in total, somefailed=True] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
PYTHON3: /usr/local/bin/python3.12
(Version 3.12.5 (main, Aug 19 2024, 06:45:53) [GCC 10.2.1 20210130 (Red Hat 10.2.1-11)])
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1373 items
interpreter/test/apptest_annotations.py ..........................
interpreter/test/apptest_annotations_string.py ......
interpreter/test/apptest_buffer.py .....
interpreter/test/apptest_class.py ................
interpreter/test/apptest_coroutine.py .....................................................
interpreter/test/apptest_descrtypecheck.py ..
interpreter/test/apptest_exceptions.py ....................F...F.
interpreter/test/apptest_exctable_dis.py FFFFFF..F
interpreter/test/apptest_exec.py .........................
interpreter/test/apptest_extcall.py .....
interpreter/test/apptest_function.py .....................................s.....................................................
interpreter/test/apptest_generator.py ...................................................................
interpreter/test/apptest_nestedscope.py ..................
interpreter/test/apptest_pep695.py ...............................
interpreter/test/apptest_pycode.py ....
interpreter/test/apptest_pyframe.py ................................................................
interpreter/test/apptest_raise.py ..........F.......F..................................
interpreter/test/apptest_settrace_jump.py .
interpreter/test/apptest_sys_settrace.py ..............................................................................................................................................
interpreter/test/apptest_traceback.py ...FFFF.
interpreter/test/apptest_unraisable.py ....
interpreter/test/apptest_with_leak.py .....FFFF
interpreter/test/test_app_main.py ....................s....................s...s.......................s....X.s...s..........
interpreter/test/test_appinterp.py .............
interpreter/test/test_argument.py ..............................................
interpreter/test/test_buffer.py ...
interpreter/test/test_cellfamily.py .......
interpreter/test/test_code.py ............
interpreter/test/test_compiler.py ...................................................................F.................F.......F.FF..F........F
interpreter/test/test_error.py ..............
interpreter/test/test_exceptcomp.py .........
interpreter/test/test_executioncontext.py ................
interpreter/test/test_extmodules.py .
interpreter/test/test_fsencode.py ...
interpreter/test/test_function.py .............
interpreter/test/test_gateway.py .........................................ss.........................
interpreter/test/test_generator.py .
interpreter/test/test_interpreter.py .................................................
interpreter/test/test_location.py ..........
interpreter/test/test_main.py .....
interpreter/test/test_mixedmodule.py ......
interpreter/test/test_module.py .......FF.F............
interpreter/test/test_objspace.py ............................................
interpreter/test/test_pycode.py ..
interpreter/test/test_pyframe.py ................................
interpreter/test/test_reverse_debugging.py ..
interpreter/test/test_special.py ...
interpreter/test/test_syntax.py ............................FFF..........................
interpreter/test/test_targetpypy.py ..
interpreter/test/test_typedef.py ...................
interpreter/test/test_unicodehelper.py ..........
interpreter/test/test_zpy.py .......F
interpreter/test/test_zzpickle_and_slow.py s.....s..s..sss........ss...s.
=================================== FAILURES ===================================
_______________________ test_nested_except_raise_stored ________________________
def test_nested_except_raise_stored():
# CPython 3.11 exception table for this pattern:
# try body -> outer_handler
# inner try body -> inner_handler
# inner handler check+STORE -> inner outer_cleanup
# inner handler body (incl RAISE_VARARGS) -> inner cleanup_end
# inner cleanup_end -> inner outer_cleanup
# outer handler check -> outer outer_cleanup
import dis
def f():
try:
z = 0
try:
"x" + 1
except TypeError as e:
z = 5
raise e
except TypeError:
return z
print()
> dis.dis(f)
interpreter/test/apptest_exceptions.py:320:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object f, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exceptions.py", line 309>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object f, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exceptions.py", line 309>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object f, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exceptions.py", line 309>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00d\x01}\x00\t\x00d\x02d\x03\x17\x00\x01\x00d\x00S\x00#\x00...\x01#\x00t\x00$\x00r%\x01\x00|\x00\x06\x00Y\x00S\x00w\x01w\x00&\x03Y\x00w\x01')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('TypeError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(0), W_UnicodeObject('x'), W_IntObject(1), W_IntObject(5))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00d\x01}\x00\t\x00d\x02d\x03\x17\x00\x01\x00d\x00S\x00#\x00...\x01#\x00t\x00$\x00r%\x01\x00|\x00\x06\x00Y\x00S\x00w\x01w\x00&\x03Y\x00w\x01')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('TypeError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(0), W_UnicodeObject('x'), W_IntObject(1), W_IntObject(5))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...ct(72), W_IntObject(76), W_IntObject(76), W_IntObject(1), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...24890>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
----------------------------- Captured stdout call -----------------------------
________________________ test_try_except_finally_nested ________________________
def test_try_except_finally_nested():
import dis
def run():
x = 5
try:
try:
if x > 2:
raise ValueError
finally:
x += 1
except ValueError:
x *= 7
return x
print()
> dis.dis(run)
interpreter/test/apptest_exceptions.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object run, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exceptions.py", line 373>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object run, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exceptions.py", line 373>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object run, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exceptions.py", line 373>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('d\x01}\x00\t\x00\t\x00|\x00d\x02k\x04r\nt\x00\x82\x01|\x00d\x03...00r%\x01\x00|\x00d\x049\x00}\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x00S\x00')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('ValueError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(5), W_IntObject(2), W_IntObject(1), W_IntObject(7))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('d\x01}\x00\t\x00\t\x00|\x00d\x02k\x04r\nt\x00\x82\x01|\x00d\x03...00r%\x01\x00|\x00d\x049\x00}\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x00S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('ValueError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(5), W_IntObject(2), W_IntObject(1), W_IntObject(7))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...ct(72), W_IntObject(76), W_IntObject(76), W_IntObject(1), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...leObject(W_IntObject(383), W_IntObject(383), W_IntObject(8), W_IntObject(16))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
----------------------------- Captured stdout call -----------------------------
____________________________ test_dis_try_except_as ____________________________
def test_dis_try_except_as():
print()
print("=== try/except T as name ===")
> dis.dis(_try_except_as)
interpreter/test/apptest_exctable_dis.py:54:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object _try_except_as, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 11>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _try_except_as, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 11>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _try_except_as, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 11>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00d\x01}\x00d\x00S\x00#\x00t\x00$\x00r\x14}\x01Y\x00d\x00}\x01~\x01d\x00S\x00d\x00}\x01~\x01w\x01w\x00&\x03Y\x00w\x01')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('ValueError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(1))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00d\x01}\x00d\x00S\x00#\x00t\x00$\x00r\x14}\x01Y\x00d\x00}\x01~\x01d\x00S\x00d\x00}\x01~\x01w\x01w\x00&\x03Y\x00w\x01')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('ValueError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(1))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...ct(32), W_IntObject(42), W_IntObject(42), W_IntObject(1), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...24890>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
----------------------------- Captured stdout call -----------------------------
=== try/except T as name ===
_________________________ test_dis_try_except_no_name __________________________
def test_dis_try_except_no_name():
print()
print("=== try/except T (no name) ===")
> dis.dis(_try_except_no_name)
interpreter/test/apptest_exctable_dis.py:60:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object _try_except_no_name, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 18>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _try_except_no_name, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 18>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _try_except_no_name, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 18>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00d\x01}\x00d\x00S\x00#\x00t\x00$\x00r\x0e\x01\x00Y\x00d\x00S\x00w\x01w\x00&\x03Y\x00w\x01')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('ValueError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(1))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00d\x01}\x00d\x00S\x00#\x00t\x00$\x00r\x0e\x01\x00Y\x00d\x00S\x00w\x01w\x00&\x03Y\x00w\x01')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('ValueError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(1))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...ct(26), W_IntObject(30), W_IntObject(30), W_IntObject(1), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...24890>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
----------------------------- Captured stdout call -----------------------------
=== try/except T (no name) ===
__________________________ test_dis_try_except_multi ___________________________
def test_dis_try_except_multi():
print()
print("=== try/except with two handlers (both as name) ===")
> dis.dis(_try_except_multi_handler)
interpreter/test/apptest_exctable_dis.py:66:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object _try_except_multi_handler, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 25>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _try_except_multi_handler, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 25>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _try_except_multi_handler, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 25>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00d\x01}\x00d\x00S\x00#\x00t\x00$\x00r\x14}\x01Y\x00d\x00}\...r"}\x01Y\x00d\x00}\x01~\x01d\x00S\x00d\x00}\x01~\x01w\x01w\x00&\x03Y\x00w\x01')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('TypeError'), W_UnicodeObject('ValueError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(1))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00d\x01}\x00d\x00S\x00#\x00t\x00$\x00r\x14}\x01Y\x00d\x00}\...r"}\x01Y\x00d\x00}\x01~\x01d\x00S\x00d\x00}\x01~\x01w\x01w\x00&\x03Y\x00w\x01')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('TypeError'), W_UnicodeObject('ValueError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(1))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...ct(60), W_IntObject(70), W_IntObject(70), W_IntObject(1), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...24890>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
----------------------------- Captured stdout call -----------------------------
=== try/except with two handlers (both as name) ===
_____________________________ test_dis_try_finally _____________________________
def test_dis_try_finally():
print()
print("=== try/finally ===")
> dis.dis(_try_finally)
interpreter/test/apptest_exctable_dis.py:75:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object _try_finally, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 34>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _try_finally, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 34>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _try_finally, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 34>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00d\x01}\x00d\x00S\x00#\x00w\x00&\x03Y\x00w\x01')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(1))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00d\x01}\x00d\x00S\x00#\x00w\x00&\x03Y\x00w\x01')
varname_from_oparg = bound method _varname_from_oparg, names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(1))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...ct(10), W_IntObject(14), W_IntObject(14), W_IntObject(1), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...upleObject(W_IntObject(38), W_IntObject(38), W_IntObject(8), W_IntObject(12))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
----------------------------- Captured stdout call -----------------------------
=== try/finally ===
_______________________________ test_dis_nested ________________________________
def test_dis_nested():
print()
print("=== nested try/except inside except handler ===")
> dis.dis(_nested_try_except_in_except)
interpreter/test/apptest_exctable_dis.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object _nested_try_except_in_except, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 41>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _nested_try_except_in_except, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 41>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _nested_try_except_in_except, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 41>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00d\x01}\x00d\x00S\x00#\x00t\x00$\x00r \x01\x00\t\x00d\x02}...00d\x00S\x00w\x01w\x00&\x03Y\x00w\x01Y\x00d\x00S\x00w\x01w\x00&\x03Y\x00w\x01')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('OSError'), W_UnicodeObject('ValueError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(1), W_IntObject(2))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00d\x01}\x00d\x00S\x00#\x00t\x00$\x00r \x01\x00\t\x00d\x02}...00d\x00S\x00w\x01w\x00&\x03Y\x00w\x01Y\x00d\x00S\x00w\x01w\x00&\x03Y\x00w\x01')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('OSError'), W_UnicodeObject('ValueError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(1), W_IntObject(2))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...ct(62), W_IntObject(66), W_IntObject(66), W_IntObject(1), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...24890>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
----------------------------- Captured stdout call -----------------------------
=== nested try/except inside except handler ===
_____________________________ test_dis_try_in_try ______________________________
def test_dis_try_in_try():
print()
print("=== nested try-in-try (settrace lineno test) ===")
> dis.dis(_try_in_try)
interpreter/test/apptest_exctable_dis.py:100:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object _try_in_try, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 87>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _try_in_try, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 87>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _try_in_try, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 87>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00\t\x00d\x00S\x00#\x00t\x00$\x00r\x13}\x00Y\x00d\x00}\x00~...03Y\x00w\x01#\x00t\x00$\x00r \x01\x00Y\x00d\x00S\x00w\x01w\x00&\x03Y\x00w\x01')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('Exception'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00\t\x00d\x00S\x00#\x00t\x00$\x00r\x13}\x00Y\x00d\x00}\x00~...03Y\x00w\x01#\x00t\x00$\x00r \x01\x00Y\x00d\x00S\x00w\x01w\x00&\x03Y\x00w\x01')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('Exception'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...ct(62), W_IntObject(66), W_IntObject(66), W_IntObject(1), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...24890>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
----------------------------- Captured stdout call -----------------------------
=== nested try-in-try (settrace lineno test) ===
_______________________ test_except_star_cleanup_lineno ________________________
def test_except_star_cleanup_lineno():
# GH-101517 / pdb test: after the except* body runs, the RETURN_VALUE for
# the "all exceptions caught" path must be attributed to the except* clause
# line, not to the body line. pdb relies on this to display the right line.
import sys
print()
print("=== except* cleanup lineno dis ===")
> dis.dis(_except_star_all_caught)
interpreter/test/apptest_exctable_dis.py:173:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object _except_star_all_caught, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 158>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _except_star_all_caught, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 158>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _except_star_all_caught, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_exctable_dis.py", line 158>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00t\x00\x82\x01#\x00&\x01g\x00c\x02t\x01%\x00&\x01\x9a\x0b}...1\x9e\x07\x01\x00Y\x00d\x00S\x00c\x02Y\x00w\x00c\x02Y\x00w\x00&\x03Y\x00w\x01')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('KeyError'), W_UnicodeObject('Exception'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\t\x00t\x00\x82\x01#\x00&\x01g\x00c\x02t\x01%\x00&\x01\x9a\x0b}...1\x9e\x07\x01\x00Y\x00d\x00S\x00c\x02Y\x00w\x00c\x02Y\x00w\x00&\x03Y\x00w\x01')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('KeyError'), W_UnicodeObject('Exception'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...ct(24), W_IntObject(56), W_IntObject(74), W_IntObject(1), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...24890>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
----------------------------- Captured stdout call -----------------------------
=== except* cleanup lineno dis ===
________________________ test_revert_exc_info_2_finally ________________________
def test_revert_exc_info_2_finally():
import sys, dis
def the_test():
assert sys.exc_info() == (None, None, None)
try:
try:
raise ValueError
finally:
try:
try:
raise IndexError
finally:
assert sys.exc_info()[0] is IndexError
except IndexError:
pass
assert sys.exc_info()[0] is ValueError
except ValueError:
pass
assert sys.exc_info() == (None, None, None)
> dis.dis(the_test)
interpreter/test/apptest_raise.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object the_test, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_raise.py", line 83>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object the_test, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_raise.py", line 83>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object the_test, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_raise.py", line 83>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\x89\x00j\x00}\x00|\x00\x83\x00}\x01d\x01}\x02|\x01|\x02k\x02}\...01\x83\x01\x82\x01d\x00\x08\x00}\x00\x08\x00}\x01\x08\x00}\x03}\x02d\x00S\x00')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('exc_info'), W_UnicodeObject('@pytest'), W_Unico...at_explanation'), W_UnicodeObject('ValueError'), W_UnicodeObject('IndexError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24...leObject(W_UnicodeObject('%(py1)s is %(py3)s')), W_UnicodeObject('ValueError'))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\x89\x00j\x00}\x00|\x00\x83\x00}\x01d\x01}\x02|\x01|\x02k\x02}\...01\x83\x01\x82\x01d\x00\x08\x00}\x00\x08\x00}\x01\x08\x00}\x03}\x02d\x00S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('exc_info'), W_UnicodeObject('@pytest'), W_Unico...at_explanation'), W_UnicodeObject('ValueError'), W_UnicodeObject('IndexError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24...leObject(W_UnicodeObject('%(py1)s is %(py3)s')), W_UnicodeObject('ValueError'))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...486), W_IntObject(490), W_IntObject(490), W_IntObject(1), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...24890>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
_____________________________ test_with_reraise_2 ______________________________
def test_with_reraise_2():
import dis
class Context:
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, exc_tb):
return True
def the_test():
def fn():
try:
raise ValueError("foo")
except:
with Context():
raise KeyError("caught")
raise
with pytest.raises(ValueError):
fn()
> dis.dis(the_test)
interpreter/test/apptest_raise.py:222:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object the_test, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_raise.py", line 211>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object the_test, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_raise.py", line 211>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object the_test, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_raise.py", line 211>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\x88\x00f\x01d\x01\x84\x08}\x00t\x00\xa0\x01t\x02\xa1\x015\x00\...x00#\x001\x00s\x1cw\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x00S\x00')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('pytest'), W_UnicodeObject('raises'), W_UnicodeObject('ValueError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24..._dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_raise.py", line 212>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('\x88\x00f\x01d\x01\x84\x08}\x00t\x00\xa0\x01t\x02\xa1\x015\x00\...x00#\x001\x00s\x1cw\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x00S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('pytest'), W_UnicodeObject('raises'), W_UnicodeObject('ValueError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24..._dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_raise.py", line 212>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...ct(56), W_IntObject(58), W_IntObject(50), W_IntObject(3), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...leObject(W_IntObject(219), W_IntObject(220), W_IntObject(8), W_IntObject(16))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
___________________________ test_traceback_positions ___________________________
def test_traceback_positions():
def division_by_zero(a, b):
return (
a + b / 0
)
with raises(ZeroDivisionError) as exc_info:
division_by_zero(1, 2)
original_std_err = sys.stderr
sys.stderr = buffer = Buffer()
original_exc_format = sys.excepthook(
exc_info.type, exc_info.value, exc_info.value.__traceback__
)
sys.stderr = original_exc_format
expected_exc_format = [
' a + b / 0',
' ~~^~~',
'ZeroDivisionError: division by zero'
]
> assert buffer.get_lines()[-3:] == expected_exc_format
E (application-level) AssertionError: assert ['ZeroDivisionError: division by zero'] == [' a + b / 0', ' ~~^~~', 'ZeroDivisionError: division by zero']
interpreter/test/apptest_traceback.py:99: AssertionError
_________________ test_traceback_positions_trailing_whitespace _________________
def test_traceback_positions_trailing_whitespace():
# issue gh-5219
def name_error():
# note this has excess trailing whitespace
a = b
with raises(NameError) as exc_info:
name_error()
original_std_err = sys.stderr
sys.stderr = buffer = Buffer()
original_exc_format = sys.excepthook(
exc_info.type, exc_info.value, exc_info.value.__traceback__
)
sys.stderr = original_exc_format
expected_exc_format = [
' a = b',
' ^',
"NameError: name 'b' is not defined"
]
> assert buffer.get_lines()[-3:] == expected_exc_format
E (application-level) AssertionError: assert ["NameError: name 'b' is not defined"] == [' a = b', ' ^', "NameError: name 'b' is not defined"]
interpreter/test/apptest_traceback.py:121: AssertionError
______________________ test_traceback_positions_on_cause _______________________
def test_traceback_positions_on_cause():
def foo(x):
1 + 1/0 + 2
def bar(x):
try:
1 + foo(x) + foo(x)
except Exception as e:
raise ValueError("oh no!") from e
with raises(ValueError) as exc_info:
bar(bar(bar(2)))
original_std_err = sys.stderr
sys.stderr = buffer = Buffer()
original_exc_format = sys.excepthook(
exc_info.type, exc_info.value, exc_info.value.__traceback__
)
sys.stderr = original_exc_format
processed_lines = [
line
for line in buffer.get_lines()
if __file__ not in line
]
expected_exc_format = [
'Traceback (most recent call last):',
' 1 + foo(x) + foo(x)',
' ^^^^^^',
' 1 + 1/0 + 2',
' ~^~',
'ZeroDivisionError: division by zero',
'',
'The above exception was the direct cause of the following exception:',
'',
'Traceback (most recent call last):',
' bar(bar(bar(2)))',
' ^^^^^^',
' raise ValueError("oh no!") from e',
'ValueError: oh no!'
]
> assert processed_lines == expected_exc_format
E (application-level) AssertionError: assert ['ValueError: oh no!'] == ['Traceback (most recent call last):', ' 1 + foo(x) + foo(x)', ' ^^^^^^', ' 1 + 1/0 + 2', ' ~^~', 'ZeroDivisionError: division by zero', '', 'The above exception was the direct cause of the following exception:', '', 'Traceback (most recent call last):', ' bar(bar(bar(2)))', ' ^^^^^^', ' raise ValueError("oh no!") from e', 'ValueError: oh no!']
interpreter/test/apptest_traceback.py:164: AssertionError
___________________________ test_colors_in_traceback ___________________________
def test_colors_in_traceback():
import os
def division_by_zero(a, b):
return (
a + b / 0 # abc
)
old_value = os.environ.get('FORCE_COLOR', None)
os.environ['FORCE_COLOR'] = '1'
try:
> from _colorize import can_colorize, ANSIColors
E (application-level) ModuleNotFoundError: No module named '_colorize'
interpreter/test/apptest_traceback.py:176: ModuleNotFoundError
_____________________________ test_shutil_pattern ______________________________
def test_shutil_pattern():
# Reproduce the shutil.copyfile failure.
# Multiple early returns inside the inner with cause duplicate_exits_without_lineno
# to copy the with-exit code, which confuses the linear exception table scan and
# leaves the fallback path (copyfileobj) with no exception table coverage.
# Structure mirrors shutil.copyfile:
# outer with (suppresses) -> try/except -> inner with (raises in __exit__)
# -> fast paths with early returns -> fallback that raises via None return
class InnerCM:
def __enter__(self):
return None # intentional -- fallback body raises AttributeError
def __exit__(self, exc_type, exc_val, exc_tb):
if exc_type is not None:
raise OSError("dest close failed")
return False
class OuterCM:
exited_with = 'not called'
def __enter__(self): return self
def __exit__(self, exc_type, exc_val, exc_tb):
self.exited_with = exc_type
return True # suppress everything
class GiveupOnFastCopy(Exception):
pass
def copyfile(use_fast1, use_fast2):
result = []
outer = OuterCM()
with outer:
try:
with InnerCM() as f:
if use_fast1:
try:
result.append('fast1')
return result
except GiveupOnFastCopy:
pass
elif use_fast2:
try:
result.append('fast2')
return result
except GiveupOnFastCopy:
pass
# fallback: f is None, raises AttributeError
result.append(f.read)
except IsADirectoryError:
pass
return outer
import dis
> dis.dis(copyfile)
interpreter/test/apptest_with_leak.py:131:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object copyfile, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_with_leak.py", line 106>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object copyfile, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_with_leak.py", line 106>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object copyfile, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_with_leak.py", line 106>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject("g\x00}\x02\x89\x02\x83\x00}\x03|\x035\x00\x01\x00\t\x00\x89\x01...x86#\x001\x00s\x82w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00|\x03S\x00")
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('append'), W_UnicodeObject('read'), W_UnicodeObject('IsADirectoryError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_UnicodeObject('fast1'), W_UnicodeObject('fast2'))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject("g\x00}\x02\x89\x02\x83\x00}\x03|\x035\x00\x01\x00\t\x00\x89\x01...x86#\x001\x00s\x82w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00|\x03S\x00")
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('append'), W_UnicodeObject('read'), W_UnicodeObject('IsADirectoryError'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_UnicodeObject('fast1'), W_UnicodeObject('fast2'))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...260), W_IntObject(262), W_IntObject(254), W_IntObject(3), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...leObject(W_IntObject(128), W_IntObject(128), W_IntObject(8), W_IntObject(20))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
___________________ test_lru_cache_style_with_lock_exception ___________________
def test_lru_cache_style_with_lock_exception():
# Reproduces WITH_EXCEPT_START crash: a wrapper using 'with lock:' around a
# cache lookup where the wrapped function raises between the two with-blocks.
import dis
from _thread import RLock
def make_cached(user_function):
cache = {}
lock = RLock()
def wrapper(*args):
key = args
with lock:
if key in cache:
return cache[key]
result = user_function(*args)
with lock:
cache[key] = result
return result
return wrapper
@make_cached
def func(i):
return 'abc'[i]
> dis.dis(func) # dis the wrapper to aid debugging
interpreter/test/apptest_with_leak.py:170:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object wrapper, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_with_leak.py", line 154>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object wrapper, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_with_leak.py", line 154>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object wrapper, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_with_leak.py", line 154>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00}\x01\x89\x015\x00\x01\x00|\x01\x89\x00v\x00r\x13\x89\x00|...0\x99@#\x001\x00s<w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00|\x02S\x00')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00}\x01\x89\x015\x00\x01\x00|\x01\x89\x00v\x00r\x13\x89\x00|...0\x99@#\x001\x00s<w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00|\x02S\x00')
varname_from_oparg = bound method _varname_from_oparg, names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...120), W_IntObject(122), W_IntObject(114), W_IntObject(3), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...eObject(W_IntObject(162), W_IntObject(162), W_IntObject(12), W_IntObject(25))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
_____________________ test_lru_cache_exception_no_context ______________________
def test_lru_cache_exception_no_context():
# test_functools.TestLRU.test_lru_with_exceptions: exception raised between
# the two 'with lock:' blocks must not gain __context__ from lock cleanup.
import dis
from _thread import RLock
def make_cached(user_function):
cache = {}
lock = RLock()
def wrapper(*args):
key = args
with lock:
if key in cache:
return cache[key]
result = user_function(*args)
with lock:
cache[key] = result
return result
return wrapper
@make_cached
def func(i):
return 'abc'[i]
print("\n=== apptest double-with wrapper dis ===")
> dis.dis(func)
interpreter/test/apptest_with_leak.py:208:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object wrapper, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_with_leak.py", line 191>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object wrapper, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_with_leak.py", line 191>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object wrapper, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_with_leak.py", line 191>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00}\x01\x89\x015\x00\x01\x00|\x01\x89\x00v\x00r\x13\x89\x00|...0\x99@#\x001\x00s<w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00|\x02S\x00')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00}\x01\x89\x015\x00\x01\x00|\x01\x89\x00v\x00r\x13\x89\x00|...0\x99@#\x001\x00s<w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00|\x02S\x00')
varname_from_oparg = bound method _varname_from_oparg, names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...120), W_IntObject(122), W_IntObject(114), W_IntObject(3), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...eObject(W_IntObject(199), W_IntObject(199), W_IntObject(12), W_IntObject(25))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
----------------------------- Captured stdout call -----------------------------
=== apptest double-with wrapper dis ===
_________________ test_except_pass_around_lru_style_exception __________________
def test_except_pass_around_lru_style_exception():
# typing.py inner() pattern: try: return cached(...) except TypeError: pass
# then raise ValueError. The ValueError must have no __context__ from the
# suppressed TypeError caught inside the two-with-lock wrapper.
import dis
from _thread import RLock
def make_cached(user_function):
cache = {}
lock = RLock()
def wrapper(*args):
key = args
with lock:
if key in cache:
return cache[key]
result = user_function(*args)
with lock:
cache[key] = result
return result
return wrapper
@make_cached
def cached(x):
if x < 0:
raise TypeError("bad arg")
return x
def inner(x):
try:
return cached(x)
except TypeError:
pass
raise ValueError("fallback error")
print("\n=== apptest cached wrapper dis ===")
> dis.dis(cached)
interpreter/test/apptest_with_leak.py:265:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object wrapper, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_with_leak.py", line 239>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object wrapper, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_with_leak.py", line 239>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object wrapper, file "/build_dir/own-linux-x86-64/build/pypy/interpreter/test/apptest_with_leak.py", line 239>
lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00}\x01\x89\x015\x00\x01\x00|\x01\x89\x00v\x00r\x13\x89\x00|...0\x99@#\x001\x00s<w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00|\x02S\x00')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00}\x01\x89\x015\x00\x01\x00|\x01\x89\x00v\x00r\x13\x89\x00|...0\x99@#\x001\x00s<w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00|\x02S\x00')
varname_from_oparg = bound method _varname_from_oparg, names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...120), W_IntObject(122), W_IntObject(114), W_IntObject(3), W_BoolObject(True))])
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...eObject(W_IntObject(247), W_IntObject(247), W_IntObject(12), W_IntObject(25))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
----------------------------- Captured stdout call -----------------------------
=== apptest cached wrapper dis ===
____________________ AppTestCompiler.test_cpython_issue2301 ____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb8e958d50>
def test_cpython_issue2301(self):
try:
compile(b"# coding: utf7\nprint '+XnQ-'", "dummy", "exec")
except SyntaxError as v:
> assert v.text == "print '\u5e74'\n"
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_compiler.py:997]:5: AssertionError
_____________________ AppTestOptimizer.test_remove_ending ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb8e09c550>
def test_remove_ending(self):
source = """def f():
return 3
"""
ns = {}
exec(source, ns)
code = ns['f'].__code__
import dis, sys
from io import StringIO
s = StringIO()
so = sys.stdout
sys.stdout = s
try:
> dis.dis(code)
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_compiler.py:1247]:14:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object f, file "<string>", line 1>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object f, file "<string>", line 1>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object f, file "<string>", line 1>, lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('d\x01S\x00'), lasti = W_IntObject(-1)
varname_from_oparg = bound method _varname_from_oparg, names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(3))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('d\x01S\x00')
varname_from_oparg = bound method _varname_from_oparg, names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(3))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.EmptyListStrategy object at 0x7fbb92e51ad0>, None)
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...TupleObject(W_IntObject(2), W_IntObject(2), W_IntObject(12), W_IntObject(20))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
_____________ AppTestOptimizer.test_folding_of_binops_on_constants _____________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb8e09c550>
def test_folding_of_binops_on_constants(self):
def disassemble(func):
from io import StringIO
import sys, dis
f = StringIO()
tmp = sys.stdout
sys.stdout = f
dis.dis(func)
sys.stdout = tmp
result = f.getvalue()
f.close()
return result
def dis_single(line):
return disassemble(compile(line, '', 'single'))
for line, elem in (
('a = 2+3+4', '(9)'), # chained fold
('"@"*4', "('@@@@')"), # check string ops
('a="abc" + "def"', "('abcdef')"), # check string ops
('a = 3**4', '(81)'), # binary power
('a = 3*4', '(12)'), # binary multiply
('a = 13//4', '(3)'), # binary floor divide
('a = 14%4', '(2)'), # binary modulo
('a = 2+3', '(5)'), # binary add
('a = 13-4', '(9)'), # binary subtract
('a = (12,13)[1]', '(13)'), # binary subscr
('a = 13 << 2', '(52)'), # binary lshift
('a = 13 >> 2', '(3)'), # binary rshift
('a = 13 & 7', '(5)'), # binary and
('a = 13 ^ 7', '(10)'), # binary xor
('a = 13 | 7', '(15)'), # binary or
):
> asm = dis_single(line)
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_compiler.py:1351]:34:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
line = W_UnicodeObject('a = 2+3+4')
def dis_single(line):
> return disassemble(compile(line, '', 'single'))
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_compiler.py:1351]:15:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
func = <code object <module>, file "", line 1>
def disassemble(func):
from io import StringIO
import sys, dis
f = StringIO()
tmp = sys.stdout
sys.stdout = f
> dis.dis(func)
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_compiler.py:1351]:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object <module>, file "", line 1>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object <module>, file "", line 1>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object <module>, file "", line 1>, lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('d\x00Z\x00d\x01S\x00'), lasti = W_IntObject(-1)
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('a'))
co_consts = W_TupleObject(W_IntObject(9), <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('d\x00Z\x00d\x01S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('a'))
co_consts = W_TupleObject(W_IntObject(9), <pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.EmptyListStrategy object at 0x7fbb92e51ad0>, None)
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...W_TupleObject(W_IntObject(1), W_IntObject(1), W_IntObject(0), W_IntObject(1))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
______________________ AppTestOptimizer.test_dis_stopcode ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb8e09c550>
def test_dis_stopcode(self):
source = """def _f(a):
print(a)
return 1
"""
ns = {}
exec(source, ns)
code = ns['_f'].__code__
import sys, dis
from io import StringIO
s = StringIO()
save_stdout = sys.stdout
sys.stdout = s
try:
> dis.dis(code)
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_compiler.py:1402]:16:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object _f, file "<string>", line 1>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _f, file "<string>", line 1>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _f, file "<string>", line 1>, lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('t\x00|\x00\x83\x01\x01\x00d\x01S\x00')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('print'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(1))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('t\x00|\x00\x83\x01\x01\x00d\x01S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('print'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_IntObject(1))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.EmptyListStrategy object at 0x7fbb92e51ad0>, None)
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...TupleObject(W_IntObject(3), W_IntObject(3), W_IntObject(16), W_IntObject(24))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
___________________ AppTestOptimizer.test_optimize_list_comp ___________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb8e09c550>
def test_optimize_list_comp(self):
source = """def _f(a):
return [x for x in a if None]
"""
ns = {}
exec(source, ns)
code = ns['_f'].__code__
import sys, dis
from io import StringIO
s = StringIO()
out = sys.stdout
sys.stdout = s
try:
> dis.dis(code)
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_compiler.py:1423]:15:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object _f, file "<string>", line 1>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _f, file "<string>", line 1>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _f, file "<string>", line 1>, lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('d\x01\x84\x00|\x00D\x00\x83\x01S\x00')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, <code object <listcomp>, file "<string>", line 2>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('d\x01\x84\x00|\x00D\x00\x83\x01S\x00')
varname_from_oparg = bound method _varname_from_oparg, names = W_TupleObject()
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, <code object <listcomp>, file "<string>", line 2>)
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.EmptyListStrategy object at 0x7fbb92e51ad0>, None)
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...TupleObject(W_IntObject(2), W_IntObject(2), W_IntObject(12), W_IntObject(41))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
___________________ AppTestOptimizer.test_call_method_kwargs ___________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb8e09c550>
def test_call_method_kwargs(self):
if not self.is_pypy():
skip("CALL_METHOD exists only on pypy")
source = """def _f(a):
return a.f(a=a)
"""
ns = {}
exec(source, ns)
code = ns['_f'].__code__
import sys, dis
from io import StringIO
s = StringIO()
out = sys.stdout
sys.stdout = s
try:
> dis.dis(code)
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_compiler.py:1457]:17:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <code object _f, file "<string>", line 1>
def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
With no argument, disassemble the last traceback.
Compiled objects currently include generator objects, async generator
objects, and coroutine objects, all of which store their code object
in a special attribute.
"""
if x is None:
distb(file=file, show_caches=show_caches, adaptive=adaptive)
return
# Extract functions from methods.
if hasattr(x, '__func__'):
x = x.__func__
# Extract compiled code objects from...
if hasattr(x, '__code__'): # ...a function, or
x = x.__code__
elif hasattr(x, 'gi_code'): #...a generator object, or
x = x.gi_code
elif hasattr(x, 'ag_code'): #...an asynchronous generator object, or
x = x.ag_code
elif hasattr(x, 'cr_code'): #...a coroutine.
x = x.cr_code
# Perform the disassembly.
if hasattr(x, '__dict__'): # Class or module
items = sorted(x.__dict__.items())
for name, x1 in items:
if isinstance(x1, _have_code):
print("Disassembly of %s:" % name, file=file)
try:
dis(x1, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
except TypeError as msg:
print("Sorry:", msg, file=file)
print(file=file)
elif hasattr(x, 'co_code'): # Code object
> _disassemble_recursive(x, file=file, depth=depth, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _f, file "<string>", line 1>
def _disassemble_recursive(co, *, file=None, depth=None, show_caches=False, adaptive=False):
> disassemble(co, file=file, show_caches=show_caches, adaptive=adaptive)
../lib-python/3/dis.py:555:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
co = <code object _f, file "<string>", line 1>, lasti = W_IntObject(-1)
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a code object."""
linestarts = dict(findlinestarts(co))
exception_entries = _parse_exception_table(co)
> _disassemble_bytes(_get_code_array(co, adaptive),
../lib-python/3/dis.py:548:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00\xa0\x00|\x00d\x01\xcc\x01S\x00')
lasti = W_IntObject(-1), varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('f'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_TupleObject(W_UnicodeObject('a')))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None,
names=None, co_consts=None, linestarts=None,
*, file=None, line_offset=0, exception_entries=(),
co_positions=None, show_caches=False):
# Omit the line number column entirely if we have no line number info
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000:
lineno_width = len(str(maxlineno))
else:
lineno_width = 3
else:
lineno_width = 0
maxoffset = len(code) - 2
if maxoffset >= 10000:
offset_width = len(str(maxoffset))
else:
offset_width = 4
> for instr in _get_instructions_bytes(code, varname_from_oparg, names,
../lib-python/3/dis.py:586:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = W_BytesObject('|\x00\xa0\x00|\x00d\x01\xcc\x01S\x00')
varname_from_oparg = bound method _varname_from_oparg
names = W_TupleObject(W_UnicodeObject('f'))
co_consts = W_TupleObject(<pypy.objspace.std.noneobject.W_NoneObject object at 0x7fbb93b24890>, W_TupleObject(W_UnicodeObject('a')))
linestarts = W_DictObject(<pypy.objspace.std.dictmultiobject.IntDictStrategy object at 0x7fbb93086d90>)
line_offset = W_IntObject(0)
exception_entries = W_ListObject(<pypy.objspace.std.listobject.EmptyListStrategy object at 0x7fbb92e51ad0>, None)
co_positions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x7fbb...TupleObject(W_IntObject(2), W_IntObject(2), W_IntObject(12), W_IntObject(27))])
show_caches = W_BoolObject(False)
def _get_instructions_bytes(code, varname_from_oparg=None,
names=None, co_consts=None,
linestarts=None, line_offset=0,
exception_entries=(), co_positions=None,
show_caches=False):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, co_consts) can be specified using optional
arguments.
"""
co_positions = co_positions or iter(())
get_name = None if names is None else names.__getitem__
labels = set(findlabels(code))
for start, end, target, _, _ in exception_entries:
for i in range(start, end):
labels.add(target)
starts_line = None
for offset, op, arg in _unpack_opargs(code):
if linestarts is not None:
starts_line = linestarts.get(offset, None)
if starts_line is not None:
starts_line += line_offset
is_jump_target = offset in labels
argval = None
argrepr = ''
> positions = Positions(*next(co_positions, ()))
E (application-level) TypeError: 'list' object is not an iterator
../lib-python/3/dis.py:463: TypeError
____________ AppTestExceptions.test_asterror_has_line_without_file _____________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb8e454d50>
def test_asterror_has_line_without_file(self):
code = u"print(1)\na/2 = 5\n"
with raises(SyntaxError) as excinfo:
compile(code, 'not a file!', 'exec')
> assert excinfo.value.text == "a/2 = 5\n"
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_compiler.py:1586]:5: AssertionError
______ AppTest_ModuleObject.test_repr_with_loader_with_valid_module_repr _______
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb8cb9dbd0>
def test_repr_with_loader_with_valid_module_repr(self):
import sys
test_module = type(sys)("test_module", "doc")
# If the module has a __loader__ and that loader has a module_repr()
# method, call it with a single argument, which is the module object.
# The value returned is used as the module's repr.
class CustomLoader:
@classmethod
def module_repr(cls, module):
mod_repr = ("<module {mod_name}: "
"{cls} Test>".format(mod_name=repr(module.__name__),
cls=repr(cls.__name__)))
return mod_repr
test_module.__loader__ = CustomLoader
> assert repr(test_module) == "<module 'test_module': 'CustomLoader' Test>"
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_module.py:82]:16: AssertionError
____ AppTest_ModuleObject.test_repr_with_loader_with_module_repr_wrong_type ____
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb8cb9dbd0>
def test_repr_with_loader_with_module_repr_wrong_type(self):
import sys
test_module = type(sys)("test_module", "doc")
# This return value must be a string.
class BuggyCustomLoader:
@classmethod
def module_repr(cls, module):
return 5
test_module.__loader__ = BuggyCustomLoader
> raises(TypeError, repr, test_module)
E (application-level) AssertionError: DID NOT RAISE
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_module.py:99]:12: AssertionError
_____ AppTest_ModuleObject.test_repr_with_loader_with_raising_module_repr2 _____
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb8cb9dbd0>
def test_repr_with_loader_with_raising_module_repr2(self):
import sys
test_module = type(sys)("test_module", "doc")
# If an exception occurs in module_repr(), the exception is caught
# and discarded, and the calculation of the module's repr continues
# as if module_repr() did not exist.
class CustomLoaderWithRaisingRepr:
@classmethod
def module_repr(cls, module):
raise KeyboardInterrupt
test_module.__loader__ = CustomLoaderWithRaisingRepr
> raises(KeyboardInterrupt, 'repr(test_module)')
E (application-level) AssertionError: DID NOT RAISE
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_module.py:132]:13: AssertionError
_______________ AppTestSyntaxError.test_tokenizer_error_location _______________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb89e81990>
def test_tokenizer_error_location(self):
line4 = "if ?: pass\n"
try:
exec("print\nprint\nprint\n" + line4)
except SyntaxError as e:
assert e.lineno == 4
> assert e.text == line4
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_syntax.py:608]:7: AssertionError
________________ AppTestSyntaxError.test_grammar_error_location ________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb89e81990>
def test_grammar_error_location(self):
try:
exec("""if 1:
class Foo:
bla
a as e
bar
""")
except SyntaxError as e:
assert e.lineno == 4
> assert e.text.endswith('a as e\n')
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_syntax.py:619]:11: AssertionError
______________ AppTestSyntaxError.test_astbuilder_error_location _______________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fbb89e81990>
def test_astbuilder_error_location(self):
program = "(1, 2) += (3, 4)\n"
try:
exec(program)
except SyntaxError as e:
assert e.lineno == 1
> assert e.text == program
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/interpreter/test/test_syntax.py:635]:7: AssertionError
_____________________________ test_pytrace_dis_bug _____________________________
def test_pytrace_dis_bug():
output = run(sys.executable, pypypath, '-S',
stdin="__pytrace__ = 1\nfor i in range(1): i += 1\n")
output = output.replace('\r\n', '\n')
assert """\
\t<module>: LOAD_NAME 0 (range)
\t<module>: LOAD_CONST 0 (1)
\t<module>: CALL_FUNCTION 1
\t<module>: GET_ITER 0
\t<module>: FOR_ITER 6 (to 20)
\t<module>: STORE_NAME 1 (i)
\t<module>: LOAD_NAME 1 (i)
\t<module>: LOAD_CONST 0 (1)
\t<module>: INPLACE_ADD 0
\t<module>: STORE_NAME 1 (i)
\t<module>: JUMP_ABSOLUTE 4 (to 8)
\t<module>: FOR_ITER 6 (to 20)
\t<module>: LOAD_CONST 1 (None)
\t<module>: RETURN_VALUE 0
> """ in output
E assert '\t<module>: LOAD_NAME 0 (range)\n\t<module>: LOAD_CONST 0 (1)\n\t<module>: CALL_F... FOR_ITER 6 (to 20)\n\t<module>: LOAD_CONST 1 (None)\n\t<module>: RETURN_VALUE 0\n' in '>>>> Tracing enabled\n>>>> \t<module>: LOAD_NAME 0 (range)\n\t<module>: LOAD_CONST 0 (1)\n\... FOR_ITER 6 (to 20)\n\t<module>: LOAD_CONST 1 (None)\n\t<module>: RETURN_VALUE 0 \n>>>> '
interpreter/test/test_zpy.py:170: AssertionError
----------------------------- Captured stdout call -----------------------------
--- stdout ---
>>>> Tracing enabled
>>>> <module>: LOAD_NAME 0 (range)
<module>: LOAD_CONST 0 (1)
<module>: CALL_FUNCTION 1
<module>: GET_ITER 0
<module>: FOR_ITER 6 (to 20)
<module>: STORE_NAME 1 (i)
<module>: LOAD_NAME 1 (i)
<module>: LOAD_CONST 0 (1)
<module>: INPLACE_ADD 0
<module>: STORE_NAME 1 (i)
<module>: <153> 4
<module>: FOR_ITER 6 (to 20)
<module>: LOAD_CONST 1 (None)
<module>: RETURN_VALUE 0
>>>>
()
--- stderr ---
None
()
----------------------------- Captured stderr call -----------------------------
PyPy 7.3.24-alpha0 in StdObjSpace on top of Python 2.7.18 (startuptime: 10.06 secs)
=========================== short test summary info ============================
FAIL interpreter/test/apptest_exceptions.py::test_nested_except_raise_stored
FAIL interpreter/test/apptest_exceptions.py::test_try_except_finally_nested
FAIL interpreter/test/apptest_exctable_dis.py::test_dis_try_except_as
FAIL interpreter/test/apptest_exctable_dis.py::test_dis_try_except_no_name
FAIL interpreter/test/apptest_exctable_dis.py::test_dis_try_except_multi
FAIL interpreter/test/apptest_exctable_dis.py::test_dis_try_finally
FAIL interpreter/test/apptest_exctable_dis.py::test_dis_nested
FAIL interpreter/test/apptest_exctable_dis.py::test_dis_try_in_try
FAIL interpreter/test/apptest_exctable_dis.py::test_except_star_cleanup_lineno
FAIL interpreter/test/apptest_raise.py::test_revert_exc_info_2_finally
FAIL interpreter/test/apptest_raise.py::test_with_reraise_2
FAIL interpreter/test/apptest_traceback.py::test_traceback_positions
FAIL interpreter/test/apptest_traceback.py::test_traceback_positions_trailing_whitespace
FAIL interpreter/test/apptest_traceback.py::test_traceback_positions_on_cause
FAIL interpreter/test/apptest_traceback.py::test_colors_in_traceback
FAIL interpreter/test/apptest_with_leak.py::test_shutil_pattern
FAIL interpreter/test/apptest_with_leak.py::test_lru_cache_style_with_lock_exception
FAIL interpreter/test/apptest_with_leak.py::test_lru_cache_exception_no_context
FAIL interpreter/test/apptest_with_leak.py::test_except_pass_around_lru_style_exception
FAIL interpreter/test/test_compiler.py::AppTestCompiler::()::test_cpython_issue2301
FAIL interpreter/test/test_compiler.py::AppTestOptimizer::()::test_remove_ending
FAIL interpreter/test/test_compiler.py::AppTestOptimizer::()::test_folding_of_binops_on_constants
FAIL interpreter/test/test_compiler.py::AppTestOptimizer::()::test_dis_stopcode
FAIL interpreter/test/test_compiler.py::AppTestOptimizer::()::test_optimize_list_comp
FAIL interpreter/test/test_compiler.py::AppTestOptimizer::()::test_call_method_kwargs
FAIL interpreter/test/test_compiler.py::AppTestExceptions::()::test_asterror_has_line_without_file
FAIL interpreter/test/test_module.py::AppTest_ModuleObject::()::test_repr_with_loader_with_valid_module_repr
FAIL interpreter/test/test_module.py::AppTest_ModuleObject::()::test_repr_with_loader_with_module_repr_wrong_type
FAIL interpreter/test/test_module.py::AppTest_ModuleObject::()::test_repr_with_loader_with_raising_module_repr2
FAIL interpreter/test/test_syntax.py::AppTestSyntaxError::()::test_tokenizer_error_location
FAIL interpreter/test/test_syntax.py::AppTestSyntaxError::()::test_grammar_error_location
FAIL interpreter/test/test_syntax.py::AppTestSyntaxError::()::test_astbuilder_error_location
FAIL interpreter/test/test_zpy.py::test_pytrace_dis_bug
======= 33 failed, 1321 passed, 18 skipped, 1 xpassed in 739.20 seconds ========
++ 15:03:44 starting module/_opcode/test [26 started in total]
__ module/_opcode/test [23 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 5 items
module/_opcode/test/apptest_opcode.py .....
========================== 5 passed in 15.12 seconds ===========================
++ 15:04:01 starting module/_pickle/test [27 started in total]
__ module/_multiprocessing/test [24 done in total, somefailed=False] __________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 12 items
module/_multiprocessing/test/test_interp_semaphore.py .
module/_multiprocessing/test/test_semaphore.py .........
module/_multiprocessing/test/test_win32.py s
module/_multiprocessing/test/test_ztranslation.py .
==================== 11 passed, 1 skipped in 123.83 seconds ====================
++ 15:05:40 starting module/_pickle_support/test [28 started in total]
__ module/_pickle_support/test [25 done in total, somefailed=False] ___________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/_pickle_support/test/apptest__pickle_support.py .
========================== 1 passed in 11.14 seconds ===========================
++ 15:05:52 starting module/_posixsubprocess/test [29 started in total]
__ module/_pickle/test [26 done in total, somefailed=True] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 29 items / 1 errors
module/_pickle/test/apptest_optional_frames.py F.
module/_pickle/test/apptest_pypy_extensions.py ...........................
==================================== ERRORS ====================================
_________ ERROR collecting pypy/module/_pickle/test/apptest_pickle.py __________
tool/pytest/apptest2.py:37: in collect
w_mod = create_module(space, w_name, fname, source)
tool/pytest/apptest2.py:56: in create_module
space.exec_(source, w_dict, w_dict, filename=filename)
interpreter/baseobjspace.py:1408: in exec_
return statement.exec_code(self, w_globals, w_locals)
interpreter/eval.py:33: in exec_code
return frame.run()
interpreter/pyframe.py:257: in run
return self.execute_frame()
interpreter/pyframe.py:350: in execute_frame
executioncontext)
interpreter/pyopcode.py:68: in dispatch
next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:91: in handle_bytecode
next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:74: in handle_bytecode
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:347: in dispatch_bytecode
self.IMPORT_FROM(oparg, next_instr)
interpreter/pyopcode.py:1205: in IMPORT_FROM
self.pushvalue(self.import_from(w_module, w_name))
interpreter/pyopcode.py:1246: in import_from
w_pkgpath,
interpreter/error.py:891: in raise_import_error
raise OperationError(space.w_ImportError, w_exc)
E OperationError: [<W_TypeObject 'ImportError' at 0x7fad65ce1490>: W_ImportError([W_UnicodeObject("cannot import name 'PickleBuffer' from 'pickle' (/build_dir/own-linux-x86-64/build/lib-python/3/pickle.py)")])]
=================================== FAILURES ===================================
_______________________ test_oob_buffers_py_dump_c_load ________________________
def test_oob_buffers_py_dump_c_load():
import sys, io, pickle, pickletools, _pickle
mod = type(sys)('apptest_optional_frames')
mod.ZeroCopyBytes = ZeroCopyBytes
mod.ZeroCopyBytearray = ZeroCopyBytearray
ZeroCopyBytes.__module__ = 'apptest_optional_frames'
ZeroCopyBytearray.__module__ = 'apptest_optional_frames'
sys.modules.setdefault('apptest_optional_frames', mod)
def count_opcode(code, pickled):
n = 0
for op, _, _ in pickletools.genops(pickled):
if op.code == code.decode('latin-1'):
n += 1
return n
def dumps(obj, proto, buffer_callback=None):
buf = io.BytesIO()
pickle._Pickler(buf, proto, buffer_callback=buffer_callback).dump(obj)
return buf.getvalue()
def loads(data, buffers=None):
return _pickle.loads(data, buffers=buffers)
if pickle.HIGHEST_PROTOCOL < 5:
return
bytestring = b"abcdefgh"
for obj in (ZeroCopyBytes(bytestring), ZeroCopyBytearray(bytestring)):
for proto in range(5, pickle.HIGHEST_PROTOCOL + 1):
buffers = []
buffer_callback = lambda pb: buffers.append(pb.raw())
> data = dumps(obj, proto, buffer_callback=buffer_callback)
module/_pickle/test/apptest_optional_frames.py:89:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = W_BytesObjectUserDictWeakrefable('abcdefgh'), proto = W_IntObject(5)
buffer_callback = <Function <lambda>>
def dumps(obj, proto, buffer_callback=None):
buf = io.BytesIO()
> pickle._Pickler(buf, proto, buffer_callback=buffer_callback).dump(obj)
module/_pickle/test/apptest_optional_frames.py:75:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fad62f59b90>
obj = W_BytesObjectUserDictWeakrefable('abcdefgh')
def dump(self, obj):
"""Write a pickled representation of obj to the open file."""
# Check whether Pickler was initialized correctly. This is
# only needed to mimic the behavior of _pickle.Pickler.dump().
if not hasattr(self, "_file_write"):
raise PicklingError("Pickler.__init__() was not called by "
"%s.__init__()" % (self.__class__.__name__,))
if self.proto >= 2:
self.write(PROTO + pack("<B", self.proto))
if self.proto >= 4:
self.framer.start_framing()
> self.save(obj)
../lib-python/3/pickle.py:504:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fad62f59b90>
obj = W_BytesObjectUserDictWeakrefable('abcdefgh')
save_persistent_id = W_BoolObject(True)
def save(self, obj, save_persistent_id=True):
self.framer.commit_frame()
# Check for persistent id (defined by a subclass)
if save_persistent_id:
pid = self.persistent_id(obj)
if pid is not None:
self.save_pers(pid)
return
# Check the memo
x = self.memo.get(id(obj))
if x is not None:
self.write(self.get(x[0]))
return
rv = NotImplemented
reduce = getattr(self, "reducer_override", None)
if reduce is not None:
rv = reduce(obj)
if rv is NotImplemented:
# Check the type dispatch table
t = type(obj)
f = self.dispatch.get(t)
if f is not None:
f(self, obj) # Call unbound method with explicit self
return
# Check private dispatch table if any, or else
# copyreg.dispatch_table
reduce = getattr(self, 'dispatch_table', dispatch_table).get(t)
if reduce is not None:
rv = reduce(obj)
else:
# Check for a class with a custom metaclass; treat as regular
# class
if issubclass(t, type):
self.save_global(obj)
return
# Check for a __reduce_ex__ method, fall back to __reduce__
reduce = getattr(obj, "__reduce_ex__", None)
if reduce is not None:
> rv = reduce(self.proto)
../lib-python/3/pickle.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = W_BytesObjectUserDictWeakrefable('abcdefgh'), protocol = W_IntObject(5)
def __reduce_ex__(self, protocol):
import pickle
if protocol >= 5:
> return type(self)._reconstruct, (pickle.PickleBuffer(self),), None
E (application-level) AttributeError: module 'pickle' has no attribute 'PickleBuffer'
module/_pickle/test/apptest_optional_frames.py:21: AttributeError
=========================== short test summary info ============================
FAIL module/_pickle/test/apptest_optional_frames.py::test_oob_buffers_py_dump_c_load
================ 1 failed, 28 passed, 1 error in 116.38 seconds ================
++ 15:06:04 starting module/_pypyjson/test [30 started in total]
__ module/_io/test [27 done in total, somefailed=False] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 286 items / 1 skipped
module/_io/test/apptest_bufferedio.py .
module/_io/test/apptest_bytesio.py .................
module/_io/test/apptest_io.py ...........................................
module/_io/test/apptest_stringio.py ...........................
module/_io/test/apptest_textio.py ..............................s.................
module/_io/test/test_bufferedio.py .......................................................................ss................................
module/_io/test/test_fileio.py ....................................
module/_io/test/test_interp_textio.py .........
=================== 283 passed, 4 skipped in 407.27 seconds ====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f24353e2890>> ignored
++ 15:06:55 starting module/_random/test [31 started in total]
__ module/_pypyjson/test [28 done in total, somefailed=False] _________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 55 items
module/_pypyjson/test/apptest__pypyjson.py ........
module/_pypyjson/test/test__pypyjson.py ............................................
module/_pypyjson/test/test_simd.py ...
========================== 55 passed in 66.39 seconds ==========================
++ 15:07:17 starting module/_rawffi/alt/test [32 started in total]
__ module/_random/test [29 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 13 items
module/_random/test/test_random.py ............
module/_random/test/test_ztranslation.py .
========================== 13 passed in 21.41 seconds ==========================
++ 15:07:19 starting module/_rawffi/test [33 started in total]
__ module/_rawffi/alt/test [30 done in total, somefailed=False] _______________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 73 items
module/_rawffi/alt/test/test_ffitype.py .....
module/_rawffi/alt/test/test_funcptr.py ..................................ssssss.s
module/_rawffi/alt/test/test_struct.py ...............
module/_rawffi/alt/test/test_type_converter.py ...........
==================== 66 passed, 7 skipped in 23.37 seconds =====================
++ 15:07:41 starting module/_socket/test [34 started in total]
__ module/_posixsubprocess/test [31 done in total, somefailed=False] __________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 10 items
module/_posixsubprocess/test/apptest_subprocess.py .........
module/_posixsubprocess/test/test_ztranslation.py .
========================= 10 passed in 140.75 seconds ==========================
++ 15:08:17 starting module/_sre/test [35 started in total]
__ module/_rawffi/test [32 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 84 items
module/_rawffi/test/apptest_rawffi.py .
module/_rawffi/test/test__rawffi.py .....s.............................................s..........s...n: 2
Arg 0: 3
Arg 1: 15
...
module/_rawffi/test/test_exit.py .
module/_rawffi/test/test_nested.py ......
module/_rawffi/test/test_struct.py ...
module/_rawffi/test/test_tracker.py ...
module/_rawffi/test/test_ztranslation.py .
==================== 81 passed, 3 skipped in 90.80 seconds =====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f8ae0af9f50>> ignored
++ 15:08:53 starting module/_vmprof/test [36 started in total]
__ module/_vmprof/test [33 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 7 items
module/_vmprof/test/test__vmprof.py .....
module/_vmprof/test/test_direct.py ..
========================== 7 passed in 54.26 seconds ===========================
++ 15:09:52 starting module/_warnings/test [37 started in total]
__ module/_socket/test [34 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 87 items
module/_socket/test/apptest_socket.py .....................ss..................s................s...
module/_socket/test/test_sock_app.py .................ss.....
module/_socket/test/test_ztranslation.py .
==================== 81 passed, 6 skipped in 164.42 seconds ====================
++ 15:10:27 starting module/_weakref/test [38 started in total]
__ module/_warnings/test [35 done in total, somefailed=True] __________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 17 items
module/_warnings/test/apptest_warnings.py ........s.s.....
module/_warnings/test/test_warnings.py F
=================================== FAILURES ===================================
_________________________ test_warn_globals_immutable __________________________
space = StdObjSpace
def test_warn_globals_immutable(space):
w_import = space.builtin.getdictvalue(space, '__import__')
w_warnings = space.call_function(w_import, space.newtext("warnings"))
# the test fails if the following line returns an ObjectMutableCell (which
# has no .name)
w_warn = w_warnings.w_dict.dstorage._x['warn']
> assert w_warn.name == 'warn'
E AttributeError: 'ObjectMutableCell' object has no attribute 'name'
module/_warnings/test/test_warnings.py:7: AttributeError
=========================== short test summary info ============================
FAIL module/_warnings/test/test_warnings.py::test_warn_globals_immutable
=============== 1 failed, 14 passed, 2 skipped in 33.35 seconds ================
++ 15:10:30 starting module/_winreg/test [39 started in total]
__ module/_winreg/test [36 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items / 1 skipped
========================== 1 skipped in 0.03 seconds ===========================
++ 15:10:30 starting module/array/test [40 started in total]
__ module/_sre/test [37 done in total, somefailed=False] ______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 163 items
module/_sre/test/apptest_sre.py .....................................................................
module/_sre/test/test_app_sre.py .........................................s.s......................
module/_sre/test/test_sre_buf.py ............................
=================== 161 passed, 2 skipped in 162.54 seconds ====================
++ 15:11:04 starting module/atexit/test [41 started in total]
__ module/atexit/test [38 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 2 items
module/atexit/test/apptest_atexit.py ..
========================== 2 passed in 19.94 seconds ===========================
++ 15:11:28 starting module/binascii/test [42 started in total]
__ module/_weakref/test [39 done in total, somefailed=False] __________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 43 items
module/_weakref/test/apptest_weakref.py ...........................................
========================== 43 passed in 76.78 seconds ==========================
++ 15:11:47 starting module/bz2/test [43 started in total]
__ module/binascii/test [40 done in total, somefailed=False] __________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 18 items
module/binascii/test/test_binascii.py ..................
========================== 18 passed in 22.73 seconds ==========================
++ 15:11:51 starting module/cmath/test [44 started in total]
__ module/cmath/test [41 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 18 items
module/cmath/test/test_cmath.py ..................
========================== 18 passed in 12.29 seconds ==========================
++ 15:12:06 starting module/cpyext/test/test_api.py [45 started in total]
__ module/array/test [42 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 64 items
module/array/test/apptest_array.py ...
module/array/test/test_array.py .....................s..................s...................
module/array/test/test_ztranslation.py .
==================== 62 passed, 2 skipped in 109.38 seconds ====================
++ 15:12:26 starting module/cpyext/test/test_arraymodule.py [46 started in total]
__ module/cpyext/test/test_api.py [43 done in total, somefailed=False] ________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 4 items
module/cpyext/test/test_api.py ....
========================== 4 passed in 29.84 seconds ===========================
++ 15:12:50 starting module/cpyext/test/test_async_iter.py [47 started in total]
__ module/cpyext/test/test_async_iter.py [44 done in total, somefailed=False] _
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module/cpyext/test/test_async_iter.py sss
========================== 3 skipped in 26.14 seconds ==========================
++ 15:13:34 starting module/cpyext/test/test_boolobject.py [48 started in total]
__ module/cpyext/test/test_arraymodule.py [45 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 18 items
module/cpyext/test/test_arraymodule.py ..........x.......
==================== 17 passed, 1 xfailed in 94.86 seconds =====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f0e10e67f50>> ignored
Exception TypeError: "'NoneType' object is not callable" in <function callback at 0x7f0e106c8b50> ignored
Exception TypeError: "'NoneType' object is not callable" in <function callback at 0x7f0e10486250> ignored
++ 15:14:15 starting module/cpyext/test/test_borrow.py [49 started in total]
__ module/cpyext/test/test_boolobject.py [46 done in total, somefailed=False] _
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 4 items
module/cpyext/test/test_boolobject.py ....
========================== 4 passed in 46.29 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f220deb2fd0>> ignored
++ 15:14:40 starting module/cpyext/test/test_buffer.py [50 started in total]
__ module/cpyext/test/test_borrow.py [47 done in total, somefailed=False] _____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module/cpyext/test/test_borrow.py ...
========================== 3 passed in 45.68 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fbf1a5a1f90>> ignored
++ 15:15:14 starting module/cpyext/test/test_bytearrayobject.py [51 started in total]
__ module/bz2/test [48 done in total, somefailed=False] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 53 items
module/bz2/test/apptest_bz2_compdecomp.py .s...
module/bz2/test/test_bz2_compdecomp.py ..s.............
module/bz2/test/test_bz2_file.py ............................
module/bz2/test/test_interpbz2.py ...
module/bz2/test/test_large.py s
==================== 50 passed, 3 skipped in 227.24 seconds ====================
++ 15:15:39 starting module/cpyext/test/test_bytesobject.py [52 started in total]
__ module/cpyext/test/test_buffer.py [49 done in total, somefailed=False] _____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 5 items
module/cpyext/test/test_buffer.py .....
========================== 5 passed in 64.44 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f86eb8b1810>> ignored
++ 15:16:00 starting module/cpyext/test/test_capsule.py [53 started in total]
__ module/cpyext/test/test_bytearrayobject.py [50 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module/cpyext/test/test_bytearrayobject.py ......
========================== 6 passed in 51.19 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fbd29679850>> ignored
++ 15:16:19 starting module/cpyext/test/test_cell.py [54 started in total]
__ module/cpyext/test/test_cell.py [51 done in total, somefailed=False] _______
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/cpyext/test/test_cell.py .
========================== 1 passed in 43.40 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f3f77d86810>> ignored
++ 15:17:18 starting module/cpyext/test/test_classobject.py [55 started in total]
__ module/cpyext/test/test_capsule.py [52 done in total, somefailed=False] ____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module/cpyext/test/test_capsule.py ...
========================== 3 passed in 63.02 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f2dcfd23f90>> ignored
++ 15:17:20 starting module/cpyext/test/test_codecs.py [56 started in total]
__ module/cpyext/test/test_bytesobject.py [53 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 20 items
module/cpyext/test/test_bytesobject.py ....................
========================== 20 passed in 87.74 seconds ==========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f19773eabd0>> ignored
++ 15:17:20 starting module/cpyext/test/test_complexobject.py [57 started in total]
__ module/cpyext/test/test_classobject.py [54 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 2 items
module/cpyext/test/test_classobject.py ..
========================== 2 passed in 43.23 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f08e6ce0fd0>> ignored
++ 15:18:16 starting module/cpyext/test/test_contextvars.py [58 started in total]
__ module/cpyext/test/test_codecs.py [55 done in total, somefailed=False] _____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module/cpyext/test/test_codecs.py ...
========================== 3 passed in 48.14 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f27cd458810>> ignored
++ 15:18:26 starting module/cpyext/test/test_cpyext.py [59 started in total]
__ module/cpyext/test/test_complexobject.py [56 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module/cpyext/test/test_complexobject.py ......
========================== 6 passed in 54.52 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7feef81edf50>> ignored
++ 15:18:33 starting module/cpyext/test/test_datetime.py [60 started in total]
__ module/cpyext/test/test_contextvars.py [57 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/cpyext/test/test_contextvars.py .
========================== 1 passed in 62.80 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f6eb8a59ad0>> ignored
++ 15:19:36 starting module/cpyext/test/test_dictobject.py [61 started in total]
__ module/cpyext/test/test_cpyext.py [58 done in total, somefailed=True] ______
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 26 items
module/cpyext/test/test_cpyext.py ..s...F....s..............
=================================== FAILURES ===================================
__________________ AppTestCpythonExtension.test_load_dynamic ___________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f2979557390>
def test_load_dynamic(self):
import sys
body = """
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"%(modname)s", /* m_name */
NULL, /* m_doc */
-1, /* m_size */
NULL, /* m_methods */
};
"""
> foo = self.import_module(name='foo', body=body, use_imp=True)
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_cpyext.py:562]:12:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('foo')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-516/foo-3/foo.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
=========================== short test summary info ============================
FAIL module/cpyext/test/test_cpyext.py::AppTestCpythonExtension::()::test_load_dynamic
=============== 1 failed, 23 passed, 2 skipped in 103.40 seconds ===============
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f297998f150>> ignored
++ 15:20:22 starting module/cpyext/test/test_eval.py [62 started in total]
__ module/cpyext/test/test_datetime.py [59 done in total, somefailed=True] ____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 16 items
module/cpyext/test/test_datetime.py .....FF.F....F..
=================================== FAILURES ===================================
______________________ TestDatetime.test_basicsize[Time] _______________________
self = <pypy.module.cpyext.test.test_datetime.TestDatetime object at 0x7fba3a50dc90>
space = StdObjSpace, name = 'Time'
@pytest.mark.parametrize('name', ['Time', 'DateTime', 'Date', 'Delta'])
def test_basicsize(self, space, name):
datetime = _PyDateTime_Import(space)
py_size = getattr(datetime, "c_%sType" % name).c_tp_basicsize
c_size = rffi.sizeof(cts.gettype("PyDateTime_%s" % name))
> assert py_size == c_size
E assert 24 == 40
module/cpyext/test/test_datetime.py:124: AssertionError
____________________ TestDatetime.test_basicsize[DateTime] _____________________
self = <pypy.module.cpyext.test.test_datetime.TestDatetime object at 0x7fba3aa1bad0>
space = StdObjSpace, name = 'DateTime'
@pytest.mark.parametrize('name', ['Time', 'DateTime', 'Date', 'Delta'])
def test_basicsize(self, space, name):
datetime = _PyDateTime_Import(space)
py_size = getattr(datetime, "c_%sType" % name).c_tp_basicsize
c_size = rffi.sizeof(cts.gettype("PyDateTime_%s" % name))
> assert py_size == c_size
E assert 24 == 40
module/cpyext/test/test_datetime.py:124: AssertionError
______________________ TestDatetime.test_basicsize[Delta] ______________________
self = <pypy.module.cpyext.test.test_datetime.TestDatetime object at 0x7fba3aa23690>
space = StdObjSpace, name = 'Delta'
@pytest.mark.parametrize('name', ['Time', 'DateTime', 'Date', 'Delta'])
def test_basicsize(self, space, name):
datetime = _PyDateTime_Import(space)
py_size = getattr(datetime, "c_%sType" % name).c_tp_basicsize
c_size = rffi.sizeof(cts.gettype("PyDateTime_%s" % name))
> assert py_size == c_size
E assert 24 == 40
module/cpyext/test/test_datetime.py:124: AssertionError
_________________________ AppTestDatetime.test_tzinfo __________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fba3aa45bd0>
def test_tzinfo(self):
module = self.import_extension('foo', [
("time_with_tzinfo", "METH_O",
""" PyDateTime_IMPORT;
return PyDateTimeAPI->Time_FromTime(
6, 6, 6, 6, args, PyDateTimeAPI->TimeType);
"""),
("datetime_with_tzinfo", "METH_O",
"""
PyObject * obj;
int tzrefcnt = args->ob_refcnt;
PyDateTime_IMPORT;
obj = PyDateTimeAPI->DateTime_FromDateAndTime(
2000, 6, 6, 6, 6, 6, 6, args,
PyDateTimeAPI->DateTimeType);
if (!((PyDateTime_DateTime*)obj)->hastzinfo)
{
Py_DECREF(obj);
PyErr_SetString(PyExc_ValueError, "missing tzinfo");
return NULL;
}
if (((PyDateTime_DateTime*)obj)->tzinfo->ob_refcnt <= tzrefcnt)
{
Py_DECREF(obj);
PyErr_SetString(PyExc_ValueError, "tzinfo refcnt not incremented");
return NULL;
}
return obj;
"""),
], prologue='#include "datetime.h"\n')
from datetime import tzinfo, datetime, timedelta, time
# copied from datetime documentation
class GMT1(tzinfo):
def __del__(self):
print('deleting GMT1')
def utcoffset(self, dt):
return timedelta(hours=1) + self.dst(dt)
def dst(self, dt):
return timedelta(0)
def tzname(self,dt):
return "GMT +1"
gmt1 = GMT1()
dt1 = module.time_with_tzinfo(gmt1)
assert dt1 == time(6, 6, 6, 6, gmt1)
assert '+01' in str(dt1)
> dt_tz = module.datetime_with_tzinfo(gmt1)
E (application-level) ValueError: tzinfo refcnt not incremented
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_datetime.py:393]:49: ValueError
----------------------------- Captured stderr call -----------------------------
<function PyModule_Create2 at 0x7fba3c9c01d0> DONE
<function _PyDateTime_Import at 0x7fba3c66ef50> DONE
<function _PyTime_FromTime at 0x7fba3c626f50> DONE
<function _PyDateTime_Import at 0x7fba3c66ef50> DONE
<function _PyDateTime_FromDateAndTime at 0x7fba3c61f150> DONE
<function PyErr_SetString at 0x7fba3ca46b50> DONE
=========================== short test summary info ============================
FAIL module/cpyext/test/test_datetime.py::TestDatetime::()::test_basicsize[Time]
FAIL module/cpyext/test/test_datetime.py::TestDatetime::()::test_basicsize[DateTime]
FAIL module/cpyext/test/test_datetime.py::TestDatetime::()::test_basicsize[Delta]
FAIL module/cpyext/test/test_datetime.py::AppTestDatetime::()::test_tzinfo
===================== 4 failed, 12 passed in 96.24 seconds =====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fba3a23acd0>> ignored
++ 15:20:29 starting module/cpyext/test/test_exception.py [63 started in total]
__ module/cpyext/test/test_dictobject.py [60 done in total, somefailed=False] _
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 19 items
module/cpyext/test/test_dictobject.py ...................
========================== 19 passed in 86.51 seconds ==========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f2b1313af50>> ignored
++ 15:21:18 starting module/cpyext/test/test_fileobject.py [64 started in total]
__ module/_hpy_universal/test/_vendored [61 done in total, somefailed=False] __
('warning: setuptools.command.build does not exist in setuptools', '44.1.1', 'on', '2.7.18 (default, Jan 29 2025, 22:16:55) \n[GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]')
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 784 items
module/_hpy_universal/test/_vendored/test_00_basic.py ..........................................................
module/_hpy_universal/test/_vendored/test_argparse.py ..........................................................................................
module/_hpy_universal/test/_vendored/test_call.py ..........
module/_hpy_universal/test/_vendored/test_capsule.py ..........
module/_hpy_universal/test/_vendored/test_capsule_legacy.py ..
module/_hpy_universal/test/_vendored/test_contextvar.py ..
module/_hpy_universal/test/_vendored/test_cpy_compat.py ................
module/_hpy_universal/test/_vendored/test_eval.py ....
module/_hpy_universal/test/_vendored/test_helpers.py ......
module/_hpy_universal/test/_vendored/test_hpybuildvalue.py ..............
module/_hpy_universal/test/_vendored/test_hpybytes.py ............
module/_hpy_universal/test/_vendored/test_hpydict.py ............
module/_hpy_universal/test/_vendored/test_hpyerr.py ..ss..............................ss..
module/_hpy_universal/test/_vendored/test_hpyfield.py ssss........ssss..
module/_hpy_universal/test/_vendored/test_hpyglobal.py ..
module/_hpy_universal/test/_vendored/test_hpyimport.py ..
module/_hpy_universal/test/_vendored/test_hpyiter.py ....
module/_hpy_universal/test/_vendored/test_hpylist.py ..........
module/_hpy_universal/test/_vendored/test_hpylong.py ....................................
module/_hpy_universal/test/_vendored/test_hpymodule.py ................
module/_hpy_universal/test/_vendored/test_hpyslice.py ......
module/_hpy_universal/test/_vendored/test_hpystructseq.py ....
module/_hpy_universal/test/_vendored/test_hpytuple.py ........
module/_hpy_universal/test/_vendored/test_hpytype.py ......................ss..................................................
module/_hpy_universal/test/_vendored/test_hpytype_legacy.py ....................ss..............................................................
module/_hpy_universal/test/_vendored/test_hpyunicode.py ..........................................
module/_hpy_universal/test/_vendored/test_importing.py ss
module/_hpy_universal/test/_vendored/test_legacy_forbidden.py ....ssss
module/_hpy_universal/test/_vendored/test_number.py ..................
module/_hpy_universal/test/_vendored/test_object.py ..................................................
module/_hpy_universal/test/_vendored/test_slots.py ..........................................
module/_hpy_universal/test/_vendored/test_slots_legacy.py ......................................................
module/_hpy_universal/test/_vendored/test_tracker.py ............
module/_hpy_universal/test/_vendored/debug/apptest_builder_invalid.py ....
module/_hpy_universal/test/_vendored/debug/apptest_handles.py ..........sss
module/_hpy_universal/test/_vendored/debug/apptest_handles_invalid.py .
================== 759 passed, 25 skipped in 1290.48 seconds ===================
Exception TypeError: "'NoneType' object is not callable" in <function callback at 0x7fe665a39650> ignored
Exception TypeError: "'NoneType' object is not callable" in <function callback at 0x7fe6643b50d0> ignored
++ 15:21:19 starting module/cpyext/test/test_floatobject.py [65 started in total]
__ module/cpyext/test/test_exception.py [62 done in total, somefailed=False] __
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module/cpyext/test/test_exception.py ......
========================== 6 passed in 53.21 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f82675b99d0>> ignored
++ 15:21:42 starting module/cpyext/test/test_frameobject.py [66 started in total]
__ module/cpyext/test/test_eval.py [63 done in total, somefailed=False] _______
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 19 items
module/cpyext/test/test_eval.py ...................
========================== 19 passed in 87.22 seconds ==========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7ff7c147ef50>> ignored
++ 15:22:03 starting module/cpyext/test/test_funcobject.py [67 started in total]
__ module/cpyext/test/test_fileobject.py [64 done in total, somefailed=False] _
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/cpyext/test/test_fileobject.py .
========================== 1 passed in 40.22 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f37cc2e4a10>> ignored
++ 15:22:17 starting module/cpyext/test/test_genobject.py [68 started in total]
__ module/cpyext/test/test_frameobject.py [65 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 4 items
module/cpyext/test/test_frameobject.py ....
========================== 4 passed in 53.17 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7ff8ce053850>> ignored
++ 15:22:48 starting module/cpyext/test/test_getargs.py [69 started in total]
__ module/cpyext/test/test_floatobject.py [66 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 14 items
module/cpyext/test/test_floatobject.py ..............
========================== 14 passed in 76.29 seconds ==========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fb238d7ca90>> ignored
++ 15:22:54 starting module/cpyext/test/test_import.py [70 started in total]
__ module/cpyext/test/test_genobject.py [67 done in total, somefailed=False] __
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module/cpyext/test/test_genobject.py ...
========================== 3 passed in 97.44 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f388e0d9810>> ignored
++ 15:24:13 starting module/cpyext/test/test_iterator.py [71 started in total]
__ module/cpyext/test/test_funcobject.py [68 done in total, somefailed=False] _
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 14 items
module/cpyext/test/test_funcobject.py ..............
========================= 14 passed in 115.19 seconds ==========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f1997a02810>> ignored
++ 15:24:14 starting module/cpyext/test/test_listobject.py [72 started in total]
__ module/cpyext/test/test_getargs.py [69 done in total, somefailed=False] ____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 16 items
module/cpyext/test/test_getargs.py ................
========================== 16 passed in 76.24 seconds ==========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f1f40545810>> ignored
++ 15:24:22 starting module/cpyext/test/test_longobject.py [73 started in total]
__ module/cpyext/test/test_import.py [70 done in total, somefailed=True] ______
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 8 items
module/cpyext/test/test_import.py ...FF...
=================================== FAILURES ===================================
____________________________ TestImport.test_reload ____________________________
self = <pypy.module.cpyext.test.test_import.TestImport object at 0x7fef2ff1f410>
space = StdObjSpace
def test_reload(self, space):
stat = PyImport_Import(space, space.wrap("stat"))
space.delattr(stat, space.wrap("S_IMODE"))
> stat = PyImport_ReloadModule(space, stat)
module/cpyext/test/test_import.py:40:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
module/cpyext/api.py:449: in unwrapper
result = self.callable(space, *newargs)
module/cpyext/import_.py:79: in PyImport_ReloadModule
w_imp = space.call_function(w_import, space.newtext('imp'))
interpreter/baseobjspace.py:1237: in call_function
return w_func.funccall(*args_w)
interpreter/function.py:138: in funccall
return self.call_args(Arguments(self.space, list(args_w)))
interpreter/function.py:82: in call_args
w_res = self.getcode().funcrun(self, args)
interpreter/gateway.py:869: in funcrun
return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:884: in funcrun_obj
self.handle_exception(space, e)
interpreter/gateway.py:878: in funcrun_obj
w_result = activation._run(space, scope_w)
<2206-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3: in _run
return self.behavior(space, scope_w[0], scope_w[1], scope_w[2], scope_w[3], scope_w[4])
module/_frozen_importlib/interp_import.py:96: in interp___import__
w_level)
interpreter/baseobjspace.py:1241: in call_function
return self.call_args(w_func, args)
objspace/descroperation.py:192: in call_args
return w_obj.call_args(args)
interpreter/function.py:82: in call_args
w_res = self.getcode().funcrun(self, args)
interpreter/pycode.py:280: in funcrun
return frame.run(func.name, func.qualname)
interpreter/pyframe.py:257: in run
return self.execute_frame()
interpreter/pyframe.py:350: in execute_frame
executioncontext)
interpreter/pyopcode.py:68: in dispatch
next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:91: in handle_bytecode
next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:74: in handle_bytecode
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:307: in dispatch_bytecode
self.CALL_FUNCTION(oparg, next_instr)
interpreter/pyopcode.py:1462: in CALL_FUNCTION
w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter/baseobjspace.py:1264: in call_valuestack
nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter/function.py:194: in funccall_valuestack
natural_arity - nargs, dropvalues)
interpreter/function.py:232: in _flat_pycall_defaults
return new_frame.run(self.name, self.qualname)
interpreter/pyframe.py:257: in run
return self.execute_frame()
interpreter/pyframe.py:350: in execute_frame
executioncontext)
interpreter/pyopcode.py:68: in dispatch
next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:91: in handle_bytecode
next_instr = self.handle_operation_error(ec, operr)
interpreter/pyopcode.py:74: in handle_bytecode
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:307: in dispatch_bytecode
self.CALL_FUNCTION(oparg, next_instr)
interpreter/pyopcode.py:1462: in CALL_FUNCTION
w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter/baseobjspace.py:1264: in call_valuestack
nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter/function.py:188: in funccall_valuestack
return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter/function.py:215: in _flat_pycall
return new_frame.run(self.name, self.qualname)
interpreter/pyframe.py:257: in run
return self.execute_frame()
interpreter/pyframe.py:350: in execute_frame
executioncontext)
interpreter/pyopcode.py:68: in dispatch
next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:95: in handle_bytecode
reraise_lasti=e.lasti)
interpreter/pyopcode.py:74: in handle_bytecode
next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter/pyopcode.py:245: in dispatch_bytecode
return self.RERAISE(oparg, next_instr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1349> at line 1360
oparg = 1, next_instr = 122L
def RERAISE(self, oparg, next_instr):
# CPython 3.11 RERAISE N semantics: if N > 0, read the lasti (int)
# from PEEK(N + 1) [i.e., N slots below TOS after pushing exc], set
# self.last_instr to it so the re-raised exception's traceback/lineno
# reflect the original raise site, then pop the exception and raise.
# N == 0 is a plain reraise of TOS. Stack before: [..., lasti, exc]
# for N == 1; after: [..., lasti]. The surrounding handler is
# expected to have already done its POP_EXCEPT if sys.exc_info needs
# restoring (PyPy no longer bundles POP_EXCEPT into RERAISE 1).
if oparg:
# PEEK(oparg + 1): 0 == TOS (exc), oparg is the lasti slot.
# Pass via RaiseWithExplicitTraceback rather than self.last_instr:
# the table lookup must use the RERAISE site offset, not lasti.
reraise_lasti = self.space.int_w(self.peekvalue(oparg))
else:
reraise_lasti = -1
w_exc = self.popvalue()
from pypy.module.exceptions.interp_exceptions import W_BaseException
space = self.space
w_value = space.interp_w(W_BaseException, w_exc)
w_type = space.type(w_exc)
operr = OperationError(w_type, w_exc, w_value.w_traceback)
# Raise as RaiseWithExplicitTraceback so that handle_bytecode
# dispatches via its 'except RaiseWithExplicitTraceback' branch
# (calling handle_operation_error with attach_tb=False). This
# avoids a spurious traceback entry and exception_trace call that
# would occur if the OperationError bubbled up to the plain
# 'except OperationError' branch in handle_bytecode.
> raise RaiseWithExplicitTraceback(operr, reraise_lasti)
E OperationError: [<W_TypeObject 'ModuleNotFoundError' at 0x7fef31d02f10>: W_ImportErrorUserWeakrefable([W_UnicodeObject("No module named 'imp'")])]
interpreter/pyopcode.py:1456: OperationError
___________________ TestImport.test_ImportModuleLevelObject ____________________
self = <pypy.module.cpyext.test.test_import.TestImport object at 0x7fef300912d0>
space = StdObjSpace
def test_ImportModuleLevelObject(self, space):
w_mod = PyImport_ImportModuleLevelObject(
space, space.wrap('stat'), None, None, None, 0)
assert w_mod
> assert space.getattr(w_mod, space.wrap("S_IMODE"))
module/cpyext/test/test_import.py:47:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
objspace/std/objspace.py:670: in getattr
return self._handle_getattribute(w_descr, w_obj, w_name)
objspace/descroperation.py:238: in _handle_getattribute
return space.get_and_call_function(w_descr, w_obj, w_name)
objspace/descroperation.py:183: in get_and_call_function
return w_descr.funccall(w_obj, *args_w)
interpreter/function.py:115: in funccall
return code.fastcall_2(self.space, self, args_w[0], args_w[1])
interpreter/gateway.py:1006: in fastcall_2
self.handle_exception(space, e)
interpreter/gateway.py:1001: in fastcall_2
w_result = self.fastfunc_2(space, w1, w2)
<314-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3: in fastfunc_descr_getattribute_2
return func(space.interp_w(Module, w0), space, w1)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.module.Module object at 0x7fef3066bdd0>
space = StdObjSpace, w_attr = W_UnicodeObject('S_IMODE')
def descr_getattribute(self, space, w_attr):
from pypy.objspace.descroperation import object_getattribute
from pypy.module.imp.importing import (is_spec_initializing,
is_spec_uninitialized_submodule)
try:
return space.call_function(object_getattribute(space), self, w_attr)
except OperationError as e:
if not e.match(space, space.w_AttributeError):
raise
w_dict = self.w_dict
w_getattr = space.finditem(w_dict, space.newtext('__getattr__'))
if w_getattr is not None:
return space.call_function(w_getattr, w_attr)
w_name = space.finditem(self.w_dict, space.newtext('__name__'))
w_spec = space.finditem(self.w_dict, space.newtext('__spec__'))
if w_name is None:
raise oefmt(space.w_AttributeError,
"module has no attribute %R", w_attr)
elif w_spec is not None and is_spec_initializing(space, w_spec):
raise oefmt(space.w_AttributeError,
"partially initialized "
"module %R has no attribute %R "
"(most likely due to a circular import)",
w_name, w_attr
)
elif w_spec is not None and is_spec_uninitialized_submodule(space, w_spec, w_attr):
raise oefmt(space.w_AttributeError,
"cannot access submodule %R of module %R "
"(most likely due to a circular import)",
w_attr, w_name)
else:
raise oefmt(space.w_AttributeError,
> "module %R has no attribute %R", w_name, w_attr)
E OpErrFmt: [<W_TypeObject 'AttributeError' at 0x7fef31cb0110>: module 'stat' has no attribute 'S_IMODE']
interpreter/module.py:162: OpErrFmt
=========================== short test summary info ============================
FAIL module/cpyext/test/test_import.py::TestImport::()::test_reload
FAIL module/cpyext/test/test_import.py::TestImport::()::test_ImportModuleLevelObject
===================== 2 failed, 6 passed in 122.19 seconds =====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fef2f471790>> ignored
++ 15:25:12 starting module/cpyext/test/test_mapping.py [74 started in total]
__ module/cpyext/test/test_iterator.py [71 done in total, somefailed=False] ___
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module/cpyext/test/test_iterator.py ......
========================== 6 passed in 51.81 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f4c5bad4850>> ignored
++ 15:25:18 starting module/cpyext/test/test_marshal.py [75 started in total]
__ module/cpyext/test/test_listobject.py [72 done in total, somefailed=False] _
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 14 items
module/cpyext/test/test_listobject.py ..............
========================== 14 passed in 71.72 seconds ==========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fa799473810>> ignored
++ 15:25:41 starting module/cpyext/test/test_memoryobject.py [76 started in total]
__ module/cpyext/test/test_mapping.py [73 done in total, somefailed=False] ____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 5 items
module/cpyext/test/test_mapping.py .....
========================== 5 passed in 38.46 seconds ===========================
++ 15:26:03 starting module/cpyext/test/test_methodobject.py [77 started in total]
__ module/cpyext/test/test_longobject.py [74 done in total, somefailed=False] _
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 25 items
module/cpyext/test/test_longobject.py .........................
========================== 25 passed in 93.87 seconds ==========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fc9f7cf7f50>> ignored
++ 15:26:11 starting module/cpyext/test/test_misc.py [78 started in total]
__ module/cpyext/test/test_marshal.py [75 done in total, somefailed=False] ____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 2 items
module/cpyext/test/test_marshal.py ..
========================== 2 passed in 44.48 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f86715d2dd0>> ignored
++ 15:26:17 starting module/cpyext/test/test_module.py [79 started in total]
__ module/cpyext/test/test_memoryobject.py [76 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 13 items
module/cpyext/test/test_memoryobject.py ...s..s......
==================== 11 passed, 2 skipped in 67.88 seconds =====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f75af8f3f90>> ignored
Exception TypeError: "'NoneType' object is not callable" in <function callback at 0x7f75af4110d0> ignored
Exception TypeError: "'NoneType' object is not callable" in <function callback at 0x7f75af2a8ed0> ignored
++ 15:27:09 starting module/cpyext/test/test_namespaceobject.py [80 started in total]
__ module/cpyext/test/test_misc.py [77 done in total, somefailed=False] _______
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/cpyext/test/test_misc.py .
========================== 1 passed in 41.24 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fe900ed9850>> ignored
++ 15:27:10 starting module/cpyext/test/test_ndarrayobject.py [81 started in total]
__ module/cpyext/test/test_ndarrayobject.py [78 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items / 1 skipped
========================== 1 skipped in 0.21 seconds ===========================
++ 15:27:24 starting module/cpyext/test/test_number.py [82 started in total]
__ module/cpyext/test/test_methodobject.py [79 done in total, somefailed=True]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 14 items
module/cpyext/test/test_methodobject.py ............FF
=================================== FAILURES ===================================
_____________________ AppTestMethodObject.test_module_name _____________________
self = <CallInfo when='call' exception: command 'gcc' failed with exit status 1>
func = <function <lambda> at 0x7f521a6c62d0>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_module_name'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_module_name'>}
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 0x7f5223a13f10>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7f521ce5fd70>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_module_name'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_module_name'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7f521ce5fd70>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_module_name'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_module_name'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_module_name'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f521ca7c050>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...odule_name'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f521ccf0500>
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 0x7f521ccf0500>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...odule_name'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_module_name'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f521ccf0d20>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...odule_name'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f521ccf0c80>
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 0x7f521ccf0c80>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...odule_name'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_module_name'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_module_name'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_module_name'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
**appexec_definitions)
filename = self._getdynfilename(target)
func = app2interp_temp(src, filename=filename)
w_instance = self.parent.w_instance
> self.execute_appex(space, func, space, w_instance)
tool/pytest/apptest.py:331:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_module_name'>, space = StdObjSpace
target = <function test_module_name at 0x7f521a6b1dd0>
args = (StdObjSpace, <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f521b236310>)
def execute_appex(self, space, target, *args):
self.space = space
space.getexecutioncontext().set_sys_exc_info(None)
try:
> target(*args)
tool/pytest/apptest.py:267:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f521b236310>,)
w_func = <Function test_module_name>
args = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f521b236310>
def appcaller(space, *args_w):
if not isinstance(space, ObjSpace):
raise TypeError("first argument must be a space instance.")
# the last argument can be an Arguments
w_func = self.wget(space, name)
if not args_w:
return space.call_function(w_func)
else:
args = args_w[-1]
assert args is not None
if not isinstance(args, Arguments):
> return space.call_function(w_func, *args_w)
interpreter/gateway.py:1409:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function test_module_name>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f521b236310>,)
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 = <Function test_module_name>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f521b236310>,)
gateway = <module 'pypy.interpreter.gateway' from '/build_dir/own-linux-x86-64/build/pypy/interpreter/gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <code object test_module_name, file "[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_methodobject.py:305]", line 1>
def funccall(self, *args_w): # speed hack
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
nargs = len(args_w)
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, args_w[0])
elif nargs == 2:
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, args_w[0], args_w[1])
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
return code.fastcall_3(self.space, self, args_w[0],
args_w[1], args_w[2])
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
return code.fastcall_4(self.space, self, args_w[0],
args_w[1], args_w[2], args_w[3])
elif (nargs | PyCode.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
if nargs < 5:
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in funccallunrolling:
if i < nargs:
new_frame.locals_cells_stack_w[i] = args_w[i]
> return new_frame.run(self.name, self.qualname)
interpreter/function.py:132:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_module_n...-64/build/pypy/module/cpyext/test/test_methodobject.py:305]", line 1> at line 3
name = 'test_module_name', qualname = 'test_module_name'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_module_n...-64/build/pypy/module/cpyext/test/test_methodobject.py:305]", line 1> at line 3
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:354:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_module_n...-64/build/pypy/module/cpyext/test/test_methodobject.py:305]", line 1> at line 3
e = CompileError(DistutilsExecError("command 'gcc' failed with exit status 1",),)
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter/pyframe.py:845:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_module_n...-64/build/pypy/module/cpyext/test/test_methodobject.py:305]", line 1> at line 3
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_module_n...-64/build/pypy/module/cpyext/test/test_methodobject.py:305]", line 1> at line 3
pycode = <code object test_module_name, file "[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_methodobject.py:305]", line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7f521b0cdd50>
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 test_module_n...-64/build/pypy/module/cpyext/test/test_methodobject.py:305]", line 1> at line 3
co_code = '|\x00\xa0\x00d\x01d\x02\xcc\x01}\x01|\x01j\x01j\x02d\x01k\x02s\x0eJ\x00\x82\x01d\x00S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7f521b0cdd50>
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 test_module_n...-64/build/pypy/module/cpyext/test/test_methodobject.py:305]", line 1> at line 3
co_code = '|\x00\xa0\x00d\x01d\x02\xcc\x01}\x01|\x01j\x01j\x02d\x01k\x02s\x0eJ\x00\x82\x01d\x00S\x00'
next_instr = 10L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7f521b0cdd50>
@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 test_module_n...-64/build/pypy/module/cpyext/test/test_methodobject.py:305]", line 1> at line 3
n_arguments = 0, ignored = (10L,)
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 = <FunctionWithFixedCode import_module>
args = Arguments([], ['name'], [W_UnicodeObject('test_func')])
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 = <FunctionWithFixedCode import_module>
args = Arguments([], ['name'], [W_UnicodeObject('test_func')])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7f521a765110>
func = <FunctionWithFixedCode import_module>
args = Arguments([], ['name'], [W_UnicodeObject('test_func')])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7f521a765110>
func = <FunctionWithFixedCode import_module>, w_obj = None
args = Arguments([], ['name'], [W_UnicodeObject('test_func')])
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 0x7f521a765110>
space = StdObjSpace
e = CompileError(DistutilsExecError("command 'gcc' failed with exit status 1",),)
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 0x7f521a765110>
func = <FunctionWithFixedCode import_module>, w_obj = None
args = Arguments([], ['name'], [W_UnicodeObject('test_func')])
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_text_text_or_none_text_fsencode_or_none_W_Root_bool_bool object at 0x7f521a778d90>
space = StdObjSpace
scope_w = [W_UnicodeObject('test_func'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x7f521e44b190>, W_UnicodeObject(''), <pypy.objspace.std.noneobject.W_NoneObject object at 0x7f521e44b190>, None, W_BoolObject(False), ...]
def _run(self, space, scope_w):
> return self.behavior(space, space.text_w(scope_w[0]), space.text_or_none_w(scope_w[1]), space.text_w(scope_w[2]), space.fsencode_or_none_w(scope_w[3]), scope_w[4], space.is_true(scope_w[5]), space.is_true(scope_w[6]))
<2731-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, name = 'test_func', init = None, body = '', filename = None
w_include_dirs = None, PY_SSIZE_T_CLEAN = False, use_imp = False
@unwrap_spec(name='text', init='text_or_none', body='text',
filename='fsencode_or_none', PY_SSIZE_T_CLEAN=bool,
use_imp=bool)
def import_module(space, name, init=None, body='',
filename=None, w_include_dirs=None,
PY_SSIZE_T_CLEAN=False, use_imp=False):
include_dirs = _unwrap_include_dirs(space, w_include_dirs)
# For file-based imports (no inline code), reuse the previously
# loaded module from our own cache -- avoids re-running PyInit_xxx
# (the expensive part) on every test in the class.
# We use a separate cache (not sys.modules) so that an
# import_extension() call with the same name doesn't shadow the
# file-based module.
if init is None and not body:
if name in self._file_module_cache:
self.record_imported_module(name)
return self._file_module_cache[name]
# About to overwrite sys.modules[name] -- save the displaced
# module (if any) so that its raw allocations aren't freed
# during a later test's leakfinder tracking window.
w_modules = space.sys.get('modules')
try:
w_old = space.getitem(w_modules, space.newtext(name))
self._module_keepalive.append(w_old)
except OperationError:
pass
w_result = self.sys_info.import_module(
name, init, body, filename, include_dirs, PY_SSIZE_T_CLEAN,
> use_imp)
module/cpyext/test/test_cpyext.py:384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.cpyext.test.test_cpyext.SpaceCompiler object at 0x7f521b27de50>
name = 'test_func', init = None, body = ''
filename = local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_func.c')
include_dirs = None, PY_SSIZE_T_CLEAN = False, use_imp = False
def import_module(self, name, init=None, body='', filename=None,
include_dirs=None, PY_SSIZE_T_CLEAN=False, use_imp=False):
"""
init specifies the overall template of the module.
if init is None, the module source will be loaded from a file in this
test directory, give a name given by the filename parameter.
if filename is None, the module name will be used to construct the
filename.
"""
if body or init:
if init is None:
init = "return PyModule_Create(&moduledef);"
if init is not None:
code = make_source(name, init, body, PY_SSIZE_T_CLEAN)
kwds = dict(source_strings=[code])
else:
assert not PY_SSIZE_T_CLEAN
if filename is None:
filename = name
filename = HERE / (filename + ".c")
kwds = dict(source_files=[filename])
mod = self.compile_extension_module(
> name, include_dirs=include_dirs, **kwds)
tool/cpyext/extbuild.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.cpyext.test.test_cpyext.SpaceCompiler object at 0x7f521b27de50>
name = 'test_func', include_dirs = []
source_files = [local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_func.c')]
source_strings = None
def compile_extension_module(self, name, include_dirs=None,
source_files=None, source_strings=None):
"""
Build an extension module and return the filename of the resulting
native code file.
name is the name of the module, possibly including dots if it is a
module inside a package.
"""
include_dirs = include_dirs or []
modname = name.split('.')[-1]
dirname = self.get_builddir(name=modname)
if source_strings:
assert not source_files
files = convert_sources_to_files(source_strings, dirname)
source_files = files
soname = c_compile(source_files, outputfilename=str(dirname / modname),
compile_extra=self.compile_extra,
link_extra=self.link_extra,
include_dirs=self.include_extra + include_dirs,
> libraries=self.extra_libs)
tool/cpyext/extbuild.py:54:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cfilenames = [local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_func.c')]
outputfilename = local('/tmp/pytest/usession-py3.12-534/test_func-0/test_func.so')
compile_extra = ['-Werror', '-g', '-O0', '-Wp,-U_FORTIFY_SOURCE', '-fPIC']
link_extra = ['-g']
include_dirs = [local('/tmp/pytest/usession-py3.12-534'), local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/include'), loca...dir/own-linux-x86-64/build/pypy/module/cpyext/parse'), local('/build_dir/own-linux-x86-64/build/rpython/translator/c')]
libraries = [], library_dirs = []
def c_compile(cfilenames, outputfilename,
compile_extra=None, link_extra=None,
include_dirs=None, libraries=None, library_dirs=None):
compile_extra = compile_extra or []
link_extra = link_extra or []
include_dirs = include_dirs or []
libraries = libraries or []
library_dirs = library_dirs or []
if sys.platform == 'win32':
link_extra = link_extra + ['/DEBUG'] # generate .pdb file
if sys.platform == 'darwin':
# support Fink & Darwinports
for s in ('/sw/', '/opt/local/'):
if (s + 'include' not in include_dirs
and os.path.exists(s + 'include')):
include_dirs.append(s + 'include')
if s + 'lib' not in library_dirs and os.path.exists(s + 'lib'):
library_dirs.append(s + 'lib')
outputfilename = py.path.local(outputfilename).new(ext=so_ext)
saved_environ = os.environ.copy()
try:
_build(
cfilenames, outputfilename,
compile_extra, link_extra,
> include_dirs, libraries, library_dirs)
tool/cpyext/extbuild.py:200:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cfilenames = [local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_func.c')]
outputfilename = local('/tmp/pytest/usession-py3.12-534/test_func-0/test_func.so')
compile_extra = ['-Werror', '-g', '-O0', '-Wp,-U_FORTIFY_SOURCE', '-fPIC']
link_extra = ['-g']
include_dirs = [local('/tmp/pytest/usession-py3.12-534'), local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/include'), loca...dir/own-linux-x86-64/build/pypy/module/cpyext/parse'), local('/build_dir/own-linux-x86-64/build/rpython/translator/c')]
libraries = [], library_dirs = []
def _build(cfilenames, outputfilename, compile_extra, link_extra,
include_dirs, libraries, library_dirs):
try:
# monkeypatch distutils for some versions of msvc compiler
import setuptools
except ImportError:
# XXX if this fails and is required,
# we must call pypy -mensurepip after translation
pass
from distutils.ccompiler import new_compiler
from distutils import sysconfig
# XXX for Darwin running old versions of CPython 2.7.x
sysconfig.get_config_vars()
compiler = new_compiler(force=1)
sysconfig.customize_compiler(compiler) # XXX
objects = []
for cfile in cfilenames:
cfile = py.path.local(cfile)
old = cfile.dirpath().chdir()
try:
res = compiler.compile([cfile.basename],
> include_dirs=include_dirs, extra_preargs=compile_extra)
tool/cpyext/extbuild.py:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <distutils.unixccompiler.UnixCCompiler instance at 0x7f521abaeaf0>
sources = ['test_func.c'], output_dir = None, macros = []
include_dirs = [local('/tmp/pytest/usession-py3.12-534'), local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/include'), loca...dir/own-linux-x86-64/build/pypy/module/cpyext/parse'), local('/build_dir/own-linux-x86-64/build/rpython/translator/c')]
debug = 0
extra_preargs = ['-Werror', '-g', '-O0', '-Wp,-U_FORTIFY_SOURCE', '-fPIC']
extra_postargs = [], depends = None
def compile(self, sources, output_dir=None, macros=None,
include_dirs=None, debug=0, extra_preargs=None,
extra_postargs=None, depends=None):
"""Compile one or more source files.
'sources' must be a list of filenames, most likely C/C++
files, but in reality anything that can be handled by a
particular compiler and compiler class (eg. MSVCCompiler can
handle resource files in 'sources'). Return a list of object
filenames, one per source filename in 'sources'. Depending on
the implementation, not all source files will necessarily be
compiled, but all corresponding object filenames will be
returned.
If 'output_dir' is given, object files will be put under it, while
retaining their original path component. That is, "foo/bar.c"
normally compiles to "foo/bar.o" (for a Unix implementation); if
'output_dir' is "build", then it would compile to
"build/foo/bar.o".
'macros', if given, must be a list of macro definitions. A macro
definition is either a (name, value) 2-tuple or a (name,) 1-tuple.
The former defines a macro; if the value is None, the macro is
defined without an explicit value. The 1-tuple case undefines a
macro. Later definitions/redefinitions/ undefinitions take
precedence.
'include_dirs', if given, must be a list of strings, the
directories to add to the default include file search path for this
compilation only.
'debug' is a boolean; if true, the compiler will be instructed to
output debug symbols in (or alongside) the object file(s).
'extra_preargs' and 'extra_postargs' are implementation- dependent.
On platforms that have the notion of a command-line (e.g. Unix,
DOS/Windows), they are most likely lists of strings: extra
command-line arguments to prepand/append to the compiler command
line. On other platforms, consult the implementation class
documentation. In any event, they are intended as an escape hatch
for those occasions when the abstract compiler framework doesn't
cut the mustard.
'depends', if given, is a list of filenames that all targets
depend on. If a source file is older than any file in
depends, then the source file will be recompiled. This
supports dependency tracking, but only at a coarse
granularity.
Raises CompileError on failure.
"""
# A concrete compiler class can either override this method
# entirely or implement _compile().
macros, objects, extra_postargs, pp_opts, build = \
self._setup_compile(output_dir, macros, include_dirs, sources,
depends, extra_postargs)
cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
for obj in objects:
try:
src, ext = build[obj]
except KeyError:
continue
> self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
/usr/local/lib/python2.7/distutils/ccompiler.py:574:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <distutils.unixccompiler.UnixCCompiler instance at 0x7f521abaeaf0>
obj = 'test_func.o', src = 'test_func.c', ext = '.c'
cc_args = ['-Werror', '-g', '-O0', '-Wp,-U_FORTIFY_SOURCE', '-fPIC', '-I/tmp/pytest/usession-py3.12-534', ...]
extra_postargs = []
pp_opts = ['-I/tmp/pytest/usession-py3.12-534', '-I/build_dir/own-linux-x86-64/build/pypy/module/cpyext/include', '-I/build_dir/own-linux-x86-64/build/pypy/module/cpyext/parse', '-I/build_dir/own-linux-x86-64/build/rpython/translator/c']
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
compiler_so = self.compiler_so
if sys.platform == 'darwin':
compiler_so = _osx_support.compiler_fixup(compiler_so,
cc_args + extra_postargs)
try:
self.spawn(compiler_so + cc_args + [src, '-o', obj] +
extra_postargs)
except DistutilsExecError, msg:
> raise CompileError, msg
E CompileError: command 'gcc' failed with exit status 1
/usr/local/lib/python2.7/distutils/unixccompiler.py:124: CompileError
----------------------------- Captured stderr call -----------------------------
test_func.c: In function \u2018__Pyx_PyCode_New\u2019:\ntest_func.c:592:9: error: implicit declaration of function \u2018PyUnstable_Code_NewWithPosOnlyArgs\u2019; did you mean \u2018PyCode_NewWithPosOnlyArgs\u2019? [-Werror=implicit-function-declaration]\n 592 | PyUnstable_Code_NewWithPosOnlyArgs\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n | PyCode_NewWithPosOnlyArgs\ntest_func.c:590:12: error: assignment to \u2018PyCodeObject *\u2019 from \u2018int\u2019 makes pointer from integer without a cast [-Werror=int-conversion]\n 590 | result =\n | ^\ncc1: all warnings being treated as errors
_______________________ AppTestMethodObject.test_min_max _______________________
self = <CallInfo when='call' exception: command 'gcc' failed with exit status 1>
func = <function <lambda> at 0x7f521a6c6550>, when = 'call'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
../_pytest/runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
../_pytest/runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_min_max'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_min_max'>}
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 0x7f5223a13f10>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7f521ce5fd70>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_min_max'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_min_max'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
../_pytest/vendored_packages/pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x7f521ce5fd70>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_min_max'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_min_max'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
../_pytest/vendored_packages/pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_min_max'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f521a89e5a0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...st_min_max'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f521a89e820>
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 0x7f521a89e820>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...st_min_max'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_min_max'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
../_pytest/vendored_packages/pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_call at 0x7f521a89e960>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...st_min_max'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
../_pytest/vendored_packages/pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x7f521a89ea00>
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 0x7f521a89ea00>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...st_min_max'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
../_pytest/vendored_packages/pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_min_max'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
../_pytest/vendored_packages/pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_min_max'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_min_max'>
def runtest(self):
target = self.obj
src = extract_docstring_if_empty_function(target.im_func)
space = target.im_self.space
if self.config.option.runappdirect:
appexec_definitions = self.parent.obj.__dict__
spaceconfig = getattr(self.parent.obj, 'spaceconfig', None)
usemodules = spaceconfig.get('usemodules') if spaceconfig else None
return run_with_python(self.config.option.python, src, usemodules,
**appexec_definitions)
filename = self._getdynfilename(target)
func = app2interp_temp(src, filename=filename)
w_instance = self.parent.w_instance
> self.execute_appex(space, func, space, w_instance)
tool/pytest/apptest.py:331:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_min_max'>, space = StdObjSpace
target = <function test_min_max at 0x7f521a8ae250>
args = (StdObjSpace, <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f521b236310>)
def execute_appex(self, space, target, *args):
self.space = space
space.getexecutioncontext().set_sys_exc_info(None)
try:
> target(*args)
tool/pytest/apptest.py:267:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f521b236310>,)
w_func = <Function test_min_max>
args = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f521b236310>
def appcaller(space, *args_w):
if not isinstance(space, ObjSpace):
raise TypeError("first argument must be a space instance.")
# the last argument can be an Arguments
w_func = self.wget(space, name)
if not args_w:
return space.call_function(w_func)
else:
args = args_w[-1]
assert args is not None
if not isinstance(args, Arguments):
> return space.call_function(w_func, *args_w)
interpreter/gateway.py:1409:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function test_min_max>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f521b236310>,)
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 = <Function test_min_max>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f521b236310>,)
gateway = <module 'pypy.interpreter.gateway' from '/build_dir/own-linux-x86-64/build/pypy/interpreter/gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <code object test_min_max, file "[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_methodobject.py:310]", line 1>
def funccall(self, *args_w): # speed hack
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
nargs = len(args_w)
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, args_w[0])
elif nargs == 2:
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, args_w[0], args_w[1])
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
return code.fastcall_3(self.space, self, args_w[0],
args_w[1], args_w[2])
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
return code.fastcall_4(self.space, self, args_w[0],
args_w[1], args_w[2], args_w[3])
elif (nargs | PyCode.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
if nargs < 5:
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in funccallunrolling:
if i < nargs:
new_frame.locals_cells_stack_w[i] = args_w[i]
> return new_frame.run(self.name, self.qualname)
interpreter/function.py:132:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_min_max,...-64/build/pypy/module/cpyext/test/test_methodobject.py:310]", line 1> at line 2
name = 'test_min_max', qualname = 'test_min_max'
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:257:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_min_max,...-64/build/pypy/module/cpyext/test/test_methodobject.py:310]", line 1> at line 2
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:354:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_min_max,...-64/build/pypy/module/cpyext/test/test_methodobject.py:310]", line 1> at line 2
e = CompileError(DistutilsExecError("command 'gcc' failed with exit status 1",),)
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter/pyframe.py:845:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_min_max,...-64/build/pypy/module/cpyext/test/test_methodobject.py:310]", line 1> at line 2
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:350:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_min_max,...-64/build/pypy/module/cpyext/test/test_methodobject.py:310]", line 1> at line 2
pycode = <code object test_min_max, file "[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_methodobject.py:310]", line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7f521b0cdd50>
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 test_min_max,...-64/build/pypy/module/cpyext/test/test_methodobject.py:310]", line 1> at line 2
co_code = '|\x00\xa0\x00d\x01d\x02\xcc\x01}\x01|\x01\xa0\x01\xa1\x00\x01\x00d\x00S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7f521b0cdd50>
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 test_min_max,...-64/build/pypy/module/cpyext/test/test_methodobject.py:310]", line 1> at line 2
co_code = '|\x00\xa0\x00d\x01d\x02\xcc\x01}\x01|\x01\xa0\x01\xa1\x00\x01\x00d\x00S\x00'
next_instr = 10L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x7f521b0cdd50>
@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 test_min_max,...-64/build/pypy/module/cpyext/test/test_methodobject.py:310]", line 1> at line 2
n_arguments = 0, ignored = (10L,)
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 = <FunctionWithFixedCode import_module>
args = Arguments([], ['name'], [W_UnicodeObject('builtin_min_max')])
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 = <FunctionWithFixedCode import_module>
args = Arguments([], ['name'], [W_UnicodeObject('builtin_min_max')])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter/function.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7f521a8a0590>
func = <FunctionWithFixedCode import_module>
args = Arguments([], ['name'], [W_UnicodeObject('builtin_min_max')])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x7f521a8a0590>
func = <FunctionWithFixedCode import_module>, w_obj = None
args = Arguments([], ['name'], [W_UnicodeObject('builtin_min_max')])
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 0x7f521a8a0590>
space = StdObjSpace
e = CompileError(DistutilsExecError("command 'gcc' failed with exit status 1",),)
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 0x7f521a8a0590>
func = <FunctionWithFixedCode import_module>, w_obj = None
args = Arguments([], ['name'], [W_UnicodeObject('builtin_min_max')])
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_text_text_or_none_text_fsencode_or_none_W_Root_bool_bool object at 0x7f521a778290>
space = StdObjSpace
scope_w = [W_UnicodeObject('builtin_min_max'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x7f521e44b190>, W_UnicodeObject(''), <pypy.objspace.std.noneobject.W_NoneObject object at 0x7f521e44b190>, None, W_BoolObject(False), ...]
def _run(self, space, scope_w):
> return self.behavior(space, space.text_w(scope_w[0]), space.text_or_none_w(scope_w[1]), space.text_w(scope_w[2]), space.fsencode_or_none_w(scope_w[3]), scope_w[4], space.is_true(scope_w[5]), space.is_true(scope_w[6]))
<2731-codegen /build_dir/own-linux-x86-64/build/rpython/tool/sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, name = 'builtin_min_max', init = None, body = ''
filename = None, w_include_dirs = None, PY_SSIZE_T_CLEAN = False
use_imp = False
@unwrap_spec(name='text', init='text_or_none', body='text',
filename='fsencode_or_none', PY_SSIZE_T_CLEAN=bool,
use_imp=bool)
def import_module(space, name, init=None, body='',
filename=None, w_include_dirs=None,
PY_SSIZE_T_CLEAN=False, use_imp=False):
include_dirs = _unwrap_include_dirs(space, w_include_dirs)
# For file-based imports (no inline code), reuse the previously
# loaded module from our own cache -- avoids re-running PyInit_xxx
# (the expensive part) on every test in the class.
# We use a separate cache (not sys.modules) so that an
# import_extension() call with the same name doesn't shadow the
# file-based module.
if init is None and not body:
if name in self._file_module_cache:
self.record_imported_module(name)
return self._file_module_cache[name]
# About to overwrite sys.modules[name] -- save the displaced
# module (if any) so that its raw allocations aren't freed
# during a later test's leakfinder tracking window.
w_modules = space.sys.get('modules')
try:
w_old = space.getitem(w_modules, space.newtext(name))
self._module_keepalive.append(w_old)
except OperationError:
pass
w_result = self.sys_info.import_module(
name, init, body, filename, include_dirs, PY_SSIZE_T_CLEAN,
> use_imp)
module/cpyext/test/test_cpyext.py:384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.cpyext.test.test_cpyext.SpaceCompiler object at 0x7f521b27de50>
name = 'builtin_min_max', init = None, body = ''
filename = local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/builtin_min_max.c')
include_dirs = None, PY_SSIZE_T_CLEAN = False, use_imp = False
def import_module(self, name, init=None, body='', filename=None,
include_dirs=None, PY_SSIZE_T_CLEAN=False, use_imp=False):
"""
init specifies the overall template of the module.
if init is None, the module source will be loaded from a file in this
test directory, give a name given by the filename parameter.
if filename is None, the module name will be used to construct the
filename.
"""
if body or init:
if init is None:
init = "return PyModule_Create(&moduledef);"
if init is not None:
code = make_source(name, init, body, PY_SSIZE_T_CLEAN)
kwds = dict(source_strings=[code])
else:
assert not PY_SSIZE_T_CLEAN
if filename is None:
filename = name
filename = HERE / (filename + ".c")
kwds = dict(source_files=[filename])
mod = self.compile_extension_module(
> name, include_dirs=include_dirs, **kwds)
tool/cpyext/extbuild.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.cpyext.test.test_cpyext.SpaceCompiler object at 0x7f521b27de50>
name = 'builtin_min_max', include_dirs = []
source_files = [local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/builtin_min_max.c')]
source_strings = None
def compile_extension_module(self, name, include_dirs=None,
source_files=None, source_strings=None):
"""
Build an extension module and return the filename of the resulting
native code file.
name is the name of the module, possibly including dots if it is a
module inside a package.
"""
include_dirs = include_dirs or []
modname = name.split('.')[-1]
dirname = self.get_builddir(name=modname)
if source_strings:
assert not source_files
files = convert_sources_to_files(source_strings, dirname)
source_files = files
soname = c_compile(source_files, outputfilename=str(dirname / modname),
compile_extra=self.compile_extra,
link_extra=self.link_extra,
include_dirs=self.include_extra + include_dirs,
> libraries=self.extra_libs)
tool/cpyext/extbuild.py:54:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cfilenames = [local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/builtin_min_max.c')]
outputfilename = local('/tmp/pytest/usession-py3.12-534/builtin_min_max-0/builtin_min_max.so')
compile_extra = ['-Werror', '-g', '-O0', '-Wp,-U_FORTIFY_SOURCE', '-fPIC']
link_extra = ['-g']
include_dirs = [local('/tmp/pytest/usession-py3.12-534'), local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/include'), loca...dir/own-linux-x86-64/build/pypy/module/cpyext/parse'), local('/build_dir/own-linux-x86-64/build/rpython/translator/c')]
libraries = [], library_dirs = []
def c_compile(cfilenames, outputfilename,
compile_extra=None, link_extra=None,
include_dirs=None, libraries=None, library_dirs=None):
compile_extra = compile_extra or []
link_extra = link_extra or []
include_dirs = include_dirs or []
libraries = libraries or []
library_dirs = library_dirs or []
if sys.platform == 'win32':
link_extra = link_extra + ['/DEBUG'] # generate .pdb file
if sys.platform == 'darwin':
# support Fink & Darwinports
for s in ('/sw/', '/opt/local/'):
if (s + 'include' not in include_dirs
and os.path.exists(s + 'include')):
include_dirs.append(s + 'include')
if s + 'lib' not in library_dirs and os.path.exists(s + 'lib'):
library_dirs.append(s + 'lib')
outputfilename = py.path.local(outputfilename).new(ext=so_ext)
saved_environ = os.environ.copy()
try:
_build(
cfilenames, outputfilename,
compile_extra, link_extra,
> include_dirs, libraries, library_dirs)
tool/cpyext/extbuild.py:200:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cfilenames = [local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/builtin_min_max.c')]
outputfilename = local('/tmp/pytest/usession-py3.12-534/builtin_min_max-0/builtin_min_max.so')
compile_extra = ['-Werror', '-g', '-O0', '-Wp,-U_FORTIFY_SOURCE', '-fPIC']
link_extra = ['-g']
include_dirs = [local('/tmp/pytest/usession-py3.12-534'), local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/include'), loca...dir/own-linux-x86-64/build/pypy/module/cpyext/parse'), local('/build_dir/own-linux-x86-64/build/rpython/translator/c')]
libraries = [], library_dirs = []
def _build(cfilenames, outputfilename, compile_extra, link_extra,
include_dirs, libraries, library_dirs):
try:
# monkeypatch distutils for some versions of msvc compiler
import setuptools
except ImportError:
# XXX if this fails and is required,
# we must call pypy -mensurepip after translation
pass
from distutils.ccompiler import new_compiler
from distutils import sysconfig
# XXX for Darwin running old versions of CPython 2.7.x
sysconfig.get_config_vars()
compiler = new_compiler(force=1)
sysconfig.customize_compiler(compiler) # XXX
objects = []
for cfile in cfilenames:
cfile = py.path.local(cfile)
old = cfile.dirpath().chdir()
try:
res = compiler.compile([cfile.basename],
> include_dirs=include_dirs, extra_preargs=compile_extra)
tool/cpyext/extbuild.py:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <distutils.unixccompiler.UnixCCompiler instance at 0x7f5219f2edc0>
sources = ['builtin_min_max.c'], output_dir = None, macros = []
include_dirs = [local('/tmp/pytest/usession-py3.12-534'), local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/include'), loca...dir/own-linux-x86-64/build/pypy/module/cpyext/parse'), local('/build_dir/own-linux-x86-64/build/rpython/translator/c')]
debug = 0
extra_preargs = ['-Werror', '-g', '-O0', '-Wp,-U_FORTIFY_SOURCE', '-fPIC']
extra_postargs = [], depends = None
def compile(self, sources, output_dir=None, macros=None,
include_dirs=None, debug=0, extra_preargs=None,
extra_postargs=None, depends=None):
"""Compile one or more source files.
'sources' must be a list of filenames, most likely C/C++
files, but in reality anything that can be handled by a
particular compiler and compiler class (eg. MSVCCompiler can
handle resource files in 'sources'). Return a list of object
filenames, one per source filename in 'sources'. Depending on
the implementation, not all source files will necessarily be
compiled, but all corresponding object filenames will be
returned.
If 'output_dir' is given, object files will be put under it, while
retaining their original path component. That is, "foo/bar.c"
normally compiles to "foo/bar.o" (for a Unix implementation); if
'output_dir' is "build", then it would compile to
"build/foo/bar.o".
'macros', if given, must be a list of macro definitions. A macro
definition is either a (name, value) 2-tuple or a (name,) 1-tuple.
The former defines a macro; if the value is None, the macro is
defined without an explicit value. The 1-tuple case undefines a
macro. Later definitions/redefinitions/ undefinitions take
precedence.
'include_dirs', if given, must be a list of strings, the
directories to add to the default include file search path for this
compilation only.
'debug' is a boolean; if true, the compiler will be instructed to
output debug symbols in (or alongside) the object file(s).
'extra_preargs' and 'extra_postargs' are implementation- dependent.
On platforms that have the notion of a command-line (e.g. Unix,
DOS/Windows), they are most likely lists of strings: extra
command-line arguments to prepand/append to the compiler command
line. On other platforms, consult the implementation class
documentation. In any event, they are intended as an escape hatch
for those occasions when the abstract compiler framework doesn't
cut the mustard.
'depends', if given, is a list of filenames that all targets
depend on. If a source file is older than any file in
depends, then the source file will be recompiled. This
supports dependency tracking, but only at a coarse
granularity.
Raises CompileError on failure.
"""
# A concrete compiler class can either override this method
# entirely or implement _compile().
macros, objects, extra_postargs, pp_opts, build = \
self._setup_compile(output_dir, macros, include_dirs, sources,
depends, extra_postargs)
cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
for obj in objects:
try:
src, ext = build[obj]
except KeyError:
continue
> self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
/usr/local/lib/python2.7/distutils/ccompiler.py:574:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <distutils.unixccompiler.UnixCCompiler instance at 0x7f5219f2edc0>
obj = 'builtin_min_max.o', src = 'builtin_min_max.c', ext = '.c'
cc_args = ['-Werror', '-g', '-O0', '-Wp,-U_FORTIFY_SOURCE', '-fPIC', '-I/tmp/pytest/usession-py3.12-534', ...]
extra_postargs = []
pp_opts = ['-I/tmp/pytest/usession-py3.12-534', '-I/build_dir/own-linux-x86-64/build/pypy/module/cpyext/include', '-I/build_dir/own-linux-x86-64/build/pypy/module/cpyext/parse', '-I/build_dir/own-linux-x86-64/build/rpython/translator/c']
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
compiler_so = self.compiler_so
if sys.platform == 'darwin':
compiler_so = _osx_support.compiler_fixup(compiler_so,
cc_args + extra_postargs)
try:
self.spawn(compiler_so + cc_args + [src, '-o', obj] +
extra_postargs)
except DistutilsExecError, msg:
> raise CompileError, msg
E CompileError: command 'gcc' failed with exit status 1
/usr/local/lib/python2.7/distutils/unixccompiler.py:124: CompileError
----------------------------- Captured stderr call -----------------------------
builtin_min_max.c:10401:5: error: excess elements in struct initializer [-Werror]\n10401 | 0,\n | ^\nbuiltin_min_max.c:10401:5: note: (near initialization for \u2018__pyx_CyFunctionType_type\u2019)\nbuiltin_min_max.c: In function \u2018__Pyx__PyCode_New\u2019:\nbuiltin_min_max.c:11865:9: error: implicit declaration of function \u2018PyUnstable_Code_NewWithPosOnlyArgs\u2019; did you mean \u2018PyCode_NewWithPosOnlyArgs\u2019? [-Werror=implicit-function-declaration]\n11865 | PyUnstable_Code_NewWithPosOnlyArgs\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n | PyCode_NewWithPosOnlyArgs\nbuiltin_min_max.c:11863:12: error: assignment to \u2018PyCodeObject *\u2019 from \u2018int\u2019 makes pointer from integer without a cast [-Werror=int-conversion]\n11863 | result =\n | ^\ncc1: all warnings being treated as errors
=========================== short test summary info ============================
FAIL module/cpyext/test/test_methodobject.py::AppTestMethodObject::()::test_module_name
FAIL module/cpyext/test/test_methodobject.py::AppTestMethodObject::()::test_min_max
===================== 2 failed, 12 passed in 76.84 seconds =====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f521ad5cb10>> ignored
++ 15:27:37 starting module/cpyext/test/test_object.py [83 started in total]
__ module/cpyext/test/test_module.py [80 done in total, somefailed=True] ______
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 25 items
module/cpyext/test/test_module.py .......FFFFFFFFFFFFFFFFF.
=================================== FAILURES ===================================
________________________ AppTestModuleObject.test_basic ________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f1648cbae90>
def test_basic(self):
from types import ModuleType
> module = self.import_module(name='multiphase', use_imp=True)
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:133]:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('multiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/multiphase-0/multiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
_______________________ AppTestModuleObject.test_getdef ________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f1648cbae90>
def test_getdef(self):
from types import ModuleType
> module = self.import_module(name='multiphase', use_imp=True)
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:140]:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('multiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/multiphase-1/multiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
_______________________ AppTestModuleObject.test_slots1 ________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f1648cbae90>
def test_slots1(self):
from types import ModuleType
body = """
static PyModuleDef multiphase_def;
static PyObject* multiphase_create(PyObject *spec, PyModuleDef *def) {
PyObject *module = PyModule_New("altname");
PyObject_SetAttrString(module, "create_spec", spec);
PyObject_SetAttrString(module, "create_def_eq",
PyBool_FromLong(def == &multiphase_def));
return module;
}
static int multiphase_exec(PyObject* module) {
Py_INCREF(Py_True);
PyObject_SetAttrString(module, "exec_called", Py_True);
return 0;
}
static PyModuleDef_Slot multiphase_slots[] = {
{Py_mod_create, multiphase_create},
{Py_mod_exec, multiphase_exec},
{0, NULL}
};
static PyModuleDef multiphase_def = {
PyModuleDef_HEAD_INIT, /* m_base */
"multiphase", /* m_name */
"example docstring", /* m_doc */
0, /* m_size */
NULL, /* m_methods */
multiphase_slots, /* m_slots */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
"""
init = """
return PyModuleDef_Init(&multiphase_def);
"""
> module = self.import_module(name='multiphase', body=body, init=init,
use_imp=True)
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:145]:41:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('multiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/multiphase-2/multiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
_______________________ AppTestModuleObject.test_slots2 ________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f1648cbae90>
def test_slots2(self):
from types import ModuleType
body = """
static PyModuleDef multiphase_def;
static PyObject* multiphase_create(PyObject *spec, PyModuleDef *def) {
PyObject *name = PyUnicode_FromString("altname");
PyObject *module = PyModule_NewObject(name);
Py_DECREF(name);
PyObject_SetAttrString(module, "create_spec", spec);
PyObject_SetAttrString(module, "create_def_eq",
PyBool_FromLong(def == &multiphase_def));
return module;
}
static int multiphase_exec(PyObject* module) {
Py_INCREF(Py_True);
PyObject_SetAttrString(module, "exec_called", Py_True);
return 0;
}
static PyModuleDef_Slot multiphase_slots[] = {
{Py_mod_create, multiphase_create},
{Py_mod_exec, multiphase_exec},
{0, NULL}
};
static PyModuleDef multiphase_def = {
PyModuleDef_HEAD_INIT, /* m_base */
"multiphase", /* m_name */
"example docstring", /* m_doc */
0, /* m_size */
NULL, /* m_methods */
multiphase_slots, /* m_slots */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
"""
init = """
return PyModuleDef_Init(&multiphase_def);
"""
> module = self.import_module(name='multiphase', body=body, init=init,
use_imp=True)
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:192]:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('multiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/multiphase-3/multiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
_____________________ AppTestModuleObject.test_forget_init _____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f1648cbae90>
def test_forget_init(self):
from types import ModuleType
body = """
static PyModuleDef multiphase_def = {
PyModuleDef_HEAD_INIT, /* m_base */
"multiphase", /* m_name */
"example docstring", /* m_doc */
0, /* m_size */
};
"""
init = """
return (PyObject *) &multiphase_def;
"""
> raises(SystemError, self.import_module, name='multiphase', body=body,
init=init, use_imp=True)
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:241]:14:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('multiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/multiphase-4/multiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
____________________ AppTestMultiPhase.test__testmultiphase ____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
def test__testmultiphase(self):
import sys
from importlib import machinery, util
> module = self.import_module(name=self.name, use_imp=True)
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:262]:4:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('_testmultiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/_testmultiphase-0/_testmultiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
_____________________ AppTestMultiPhase.test_functionality _____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
def test_functionality(self):
import types
> module = self.import_module(name=self.name, use_imp=True)
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:276]:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('_testmultiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/_testmultiphase-1/_testmultiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
________________________ AppTestMultiPhase.test_reload _________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
def test_reload(self):
import importlib
> module = self.import_module(name=self.name, use_imp=True)
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:293]:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('_testmultiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/_testmultiphase-2/_testmultiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
___________________ AppTestMultiPhase.test_try_registration ____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
def test_try_registration(self):
> module = self.import_module(name=self.name, use_imp=True)
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:301]:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('_testmultiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/_testmultiphase-3/_testmultiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
______________________ AppTestMultiPhase.test_bad_modules ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
def test_bad_modules(self):
# XXX: not a very good test, since most internal issues in cpyext
# cause SystemErrors.
> module = self.import_module(name=self.name, use_imp=True)
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:322]:4:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('_testmultiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/_testmultiphase-4/_testmultiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
______________________ AppTestMultiPhase.test_export_null ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
def test_export_null(self):
> excinfo = raises(SystemError, self.load_from_name, 'export_null')
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:342]:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
name = W_UnicodeObject('export_null')
origin = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7f164c52f190>
use_prefix = W_BoolObject(True)
> ???
?:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('_testmultiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/_testmultiphase-5/_testmultiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
_____________________ AppTestMultiPhase.test_export_uninit _____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
def test_export_uninit(self):
> excinfo = raises(SystemError, self.load_from_name, 'export_uninitialized')
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:347]:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
name = W_UnicodeObject('export_uninitialized')
origin = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7f164c52f190>
use_prefix = W_BoolObject(True)
> ???
?:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('_testmultiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/_testmultiphase-6/_testmultiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
_____________________ AppTestMultiPhase.test_export_raise ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
def test_export_raise(self):
> excinfo = raises(SystemError, self.load_from_name, 'export_raise')
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:352]:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
name = W_UnicodeObject('export_raise')
origin = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7f164c52f190>
use_prefix = W_BoolObject(True)
> ???
?:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('_testmultiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/_testmultiphase-7/_testmultiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
___________________ AppTestMultiPhase.test_export_unreported ___________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
def test_export_unreported(self):
> excinfo = raises(SystemError, self.load_from_name, 'export_unreported_exception')
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:356]:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
name = W_UnicodeObject('export_unreported_exception')
origin = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7f164c52f190>
use_prefix = W_BoolObject(True)
> ???
?:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('_testmultiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/_testmultiphase-8/_testmultiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
__________________ AppTestMultiPhase.test_unloadable_nonascii __________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
def test_unloadable_nonascii(self):
name = u"fo\xf3"
excinfo = raises(ImportError, self.load_from_name, name)
> assert excinfo.value.name == '_testmultiphase_' + name
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:361]:4: AssertionError
_______________________ AppTestMultiPhase.test_nonascii ________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
def test_nonascii(self):
> module = self.import_module(name=self.name, use_imp=True)
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:366]:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('_testmultiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/_testmultiphase-10/_testmultiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
______________________ AppTestMultiPhase.test_get_module _______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
def test_get_module(self):
> module = self.load_from_name("meth_state_access")
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_module.py:379]:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f164883f2d0>
name = W_UnicodeObject('meth_state_access')
origin = <pypy.objspace.std.noneobject.W_NoneObject object at 0x7f164c52f190>
use_prefix = W_BoolObject(True)
> ???
?:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = W_UnicodeObject('_testmultiphase')
path = W_UnicodeObject('/tmp/pytest/usession-py3.12-536/_testmultiphase-11/_testmultiphase.pypy312-pp73i-x86_64-linux-gnu.so')
> ???
E (application-level) ModuleNotFoundError: No module named 'imp'
?:2: ModuleNotFoundError
=========================== short test summary info ============================
FAIL module/cpyext/test/test_module.py::AppTestModuleObject::()::test_basic
FAIL module/cpyext/test/test_module.py::AppTestModuleObject::()::test_getdef
FAIL module/cpyext/test/test_module.py::AppTestModuleObject::()::test_slots1
FAIL module/cpyext/test/test_module.py::AppTestModuleObject::()::test_slots2
FAIL module/cpyext/test/test_module.py::AppTestModuleObject::()::test_forget_init
FAIL module/cpyext/test/test_module.py::AppTestMultiPhase::()::test__testmultiphase
FAIL module/cpyext/test/test_module.py::AppTestMultiPhase::()::test_functionality
FAIL module/cpyext/test/test_module.py::AppTestMultiPhase::()::test_reload
FAIL module/cpyext/test/test_module.py::AppTestMultiPhase::()::test_try_registration
FAIL module/cpyext/test/test_module.py::AppTestMultiPhase::()::test_bad_modules
FAIL module/cpyext/test/test_module.py::AppTestMultiPhase::()::test_export_null
FAIL module/cpyext/test/test_module.py::AppTestMultiPhase::()::test_export_uninit
FAIL module/cpyext/test/test_module.py::AppTestMultiPhase::()::test_export_raise
FAIL module/cpyext/test/test_module.py::AppTestMultiPhase::()::test_export_unreported
FAIL module/cpyext/test/test_module.py::AppTestMultiPhase::()::test_unloadable_nonascii
FAIL module/cpyext/test/test_module.py::AppTestMultiPhase::()::test_nonascii
FAIL module/cpyext/test/test_module.py::AppTestMultiPhase::()::test_get_module
===================== 17 failed, 8 passed in 88.49 seconds =====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f1648d7c890>> ignored
++ 15:27:59 starting module/cpyext/test/test_pyerrors.py [84 started in total]
__ module/cpyext/test/test_namespaceobject.py [81 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/cpyext/test/test_namespaceobject.py .
========================== 1 passed in 41.38 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fc47127ab90>> ignored
++ 15:28:07 starting module/cpyext/test/test_pyfile.py [85 started in total]
__ module/cpyext/test/test_number.py [82 done in total, somefailed=False] _____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 7 items
module/cpyext/test/test_number.py .......
========================== 7 passed in 54.18 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fdb2581ed90>> ignored
++ 15:28:37 starting module/cpyext/test/test_pymem.py [86 started in total]
__ module/cpyext/test/test_pyfile.py [83 done in total, somefailed=False] _____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 7 items
module/cpyext/test/test_pyfile.py ...x...
===================== 6 passed, 1 xfailed in 52.39 seconds =====================
++ 15:29:13 starting module/cpyext/test/test_pysignals.py [87 started in total]
__ module/cpyext/test/test_pymem.py [84 done in total, somefailed=False] ______
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/cpyext/test/test_pymem.py .
========================== 1 passed in 39.56 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f8b4007ba90>> ignored
++ 15:29:36 starting module/cpyext/test/test_pystate.py [88 started in total]
__ module/cpyext/test/test_object.py [85 done in total, somefailed=False] _____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 39 items
module/cpyext/test/test_object.py ......................s................
==================== 38 passed, 1 skipped in 137.60 seconds ====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7ff6b5119c10>> ignored
++ 15:30:09 starting module/cpyext/test/test_pystrhex.py [89 started in total]
__ module/cpyext/test/test_pysignals.py [86 done in total, somefailed=False] __
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/cpyext/test/test_pysignals.py .
========================== 1 passed in 40.37 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f8ea745e810>> ignored
++ 15:30:11 starting module/cpyext/test/test_pystrtod.py [90 started in total]
__ module/cpyext/test/test_pystate.py [87 done in total, somefailed=False] ____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 14 items
module/cpyext/test/test_pystate.py ....x.....sx..
=============== 11 passed, 1 skipped, 2 xfailed in 63.70 seconds ===============
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f86b9944f90>> ignored
++ 15:30:56 starting module/cpyext/test/test_sequence.py [91 started in total]
__ module/cpyext/test/test_pyerrors.py [88 done in total, somefailed=True] ____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 33 items
module/cpyext/test/test_pyerrors.py ........s.....s.......Fs...s.....
=================================== FAILURES ===================================
_______________________ AppTestFetch.test_PyErr_Display ________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4ff82d1fd0>
def test_PyErr_Display(self):
from sys import version_info
module = self.import_extension('foo', [
("display_error", "METH_VARARGS",
r'''
PyObject *type, *val, *tb;
PyErr_GetExcInfo(&type, &val, &tb);
PyErr_Display(type, val, tb);
Py_XDECREF(type);
Py_XDECREF(val);
Py_XDECREF(tb);
Py_RETURN_NONE;
'''),
])
import io, sys
sys.stderr = io.StringIO()
try:
1 / 0
except ZeroDivisionError:
module.display_error()
finally:
output = sys.stderr.getvalue()
sys.stderr = sys.__stderr__
> assert "in test_PyErr_Display\n" in output
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_pyerrors.py:489]:24: AssertionError
----------------------------- Captured stderr call -----------------------------
<function PyModule_Create2 at 0x7f4ffb45f250> DONE
<function PyErr_GetExcInfo at 0x7f4ffb47c3d0> DONE
<function PyErr_Display at 0x7f4ffb472d50> DONE
=========================== short test summary info ============================
FAIL module/cpyext/test/test_pyerrors.py::AppTestFetch::()::test_PyErr_Display
=============== 1 failed, 28 passed, 4 skipped in 165.86 seconds ===============
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f4ff8397910>> ignored
++ 15:30:59 starting module/cpyext/test/test_setobject.py [92 started in total]
__ module/cpyext/test/test_pystrhex.py [89 done in total, somefailed=False] ___
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/cpyext/test/test_pystrhex.py .
========================== 1 passed in 42.93 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f504996e850>> ignored
++ 15:31:08 starting module/cpyext/test/test_sliceobject.py [93 started in total]
__ module/cpyext/test/test_pystrtod.py [90 done in total, somefailed=False] ___
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 20 items
module/cpyext/test/test_pystrtod.py ....................
========================== 20 passed in 78.72 seconds ==========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f8a57a4ff50>> ignored
++ 15:31:46 starting module/cpyext/test/test_structseq.py [94 started in total]
__ module/cpyext/test/test_setobject.py [91 done in total, somefailed=False] __
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 9 items
module/cpyext/test/test_setobject.py .........
========================== 9 passed in 60.57 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f7948ddeb50>> ignored
++ 15:32:20 starting module/cpyext/test/test_sysmodule.py [95 started in total]
__ module/cpyext/test/test_sliceobject.py [92 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 8 items
module/cpyext/test/test_sliceobject.py ........
========================== 8 passed in 58.94 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f0eb341be50>> ignored
++ 15:32:21 starting module/cpyext/test/test_thread.py [96 started in total]
__ module/cpyext/test/test_structseq.py [93 done in total, somefailed=False] __
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/cpyext/test/test_structseq.py .
========================== 1 passed in 42.77 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fc7179a1a10>> ignored
++ 15:32:44 starting module/cpyext/test/test_traceback.py [97 started in total]
__ module/cpyext/test/test_sequence.py [94 done in total, somefailed=False] ___
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 23 items
module/cpyext/test/test_sequence.py .......................
========================== 23 passed in 93.41 seconds ==========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f327f3ee850>> ignored
++ 15:32:45 starting module/cpyext/test/test_translate.py [98 started in total]
__ module/cpyext/test/test_translate.py [95 done in total, somefailed=False] __
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/cpyext/test/test_translate.py .
=========================== 1 passed in 2.42 seconds ===========================
++ 15:33:02 starting module/cpyext/test/test_tupleobject.py [99 started in total]
__ module/cpyext/test/test_sysmodule.py [96 done in total, somefailed=False] __
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module/cpyext/test/test_sysmodule.py ...
========================== 3 passed in 47.87 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fdab665ef90>> ignored
++ 15:33:25 starting module/cpyext/test/test_typeobject.py [100 started in total]
__ module/cpyext/test/test_traceback.py [97 done in total, somefailed=False] __
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/cpyext/test/test_traceback.py .
========================== 1 passed in 29.41 seconds ===========================
++ 15:33:28 starting module/cpyext/test/test_unicodeobject.py [101 started in total]
__ module/cpyext/test/test_tupleobject.py [98 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 10 items
module/cpyext/test/test_tupleobject.py ..........
========================== 10 passed in 64.00 seconds ==========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fc5c62f5fd0>> ignored
++ 15:34:22 starting module/cpyext/test/test_userslots.py [102 started in total]
__ module/cpyext/test/test_thread.py [99 done in total, somefailed=False] _____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module/cpyext/test/test_thread.py x...x.
==================== 4 passed, 2 xfailed in 105.43 seconds =====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f1717b58890>> ignored
++ 15:34:24 starting module/cpyext/test/test_version.py [103 started in total]
__ module/cpyext/test/test_version.py [100 done in total, somefailed=True] ____
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module/cpyext/test/test_version.py FF.
=================================== FAILURES ===================================
_____________________________ test_pragma_version ______________________________
def test_pragma_version():
from pypy.module.sys.version import CPYTHON_VERSION
rootdir = py.path.local(__file__).join('..', '..')
pyconfig_h = rootdir.join('PC', 'pyconfig.h')
version = '%d%d' % (CPYTHON_VERSION[0], CPYTHON_VERSION[1])
pragma = 'pragma comment(lib,"python%s.lib")' % version
> assert pragma in pyconfig_h.read()
E assert 'pragma comment(lib,"python312.lib")' in '#ifndef Py_CONFIG_H\n#define Py_CONFIG_H\n\n/* pyconfig.h. NOT Generated automatically by configure.\n\nThis is a ma...fine HAVE_LONG_LONG 1\n#define PY_FORMAT_LONG_LONG "ll"\n#define PY_FORMAT_SIZE_T "z"\n\n\n#endif /* !Py_CONFIG_H */\n'
E + where '#ifndef Py_CONFIG_H\n#define Py_CONFIG_H\n\n/* pyconfig.h. NOT Generated automatically by configure.\n\nThis is a ma...fine HAVE_LONG_LONG 1\n#define PY_FORMAT_LONG_LONG "ll"\n#define PY_FORMAT_SIZE_T "z"\n\n\n#endif /* !Py_CONFIG_H */\n' = <bound method LocalPath.read of local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/PC/pyconfig.h')>()
E + where <bound method LocalPath.read of local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/PC/pyconfig.h')> = local('/build_dir/own-linux-x86-64/build/pypy/module/cpyext/PC/pyconfig.h').read
module/cpyext/test/test_version.py:14: AssertionError
_________________________ AppTestVersion.test_versions _________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f9a0ea9c450>
def test_versions(self):
import sys
init = """
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"foo", /* m_name */
NULL, /* m_doc */
-1, /* m_size */
NULL /* m_methods */
};
if (Py_IsInitialized()) {
PyObject *m = PyModule_Create(&moduledef);
PyModule_AddStringConstant(m, "py_version", PY_VERSION);
PyModule_AddIntConstant(m, "py_major_version", PY_MAJOR_VERSION);
PyModule_AddIntConstant(m, "py_minor_version", PY_MINOR_VERSION);
PyModule_AddIntConstant(m, "py_micro_version", PY_MICRO_VERSION);
return m;
}
Py_RETURN_NONE;
"""
module = self.import_module(name='foo', init=init)
expected = '%d.%d.%d' % sys.version_info[:3]
> assert module.py_version == expected
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/module/cpyext/test/test_version.py:19]:23: AssertionError
----------------------------- Captured stderr call -----------------------------
<function Py_IsInitialized at 0x7f9a10651450> DONE
<function PyModule_Create2 at 0x7f9a106481d0> DONE
<function PyUnicode_FromString at 0x7f9a1048fa50> DONE
<function check at 0x7f9a106b0850> DONE
<function PyModule_GetDict at 0x7f9a10648550> DONE
<function PyDict_SetItemString at 0x7f9a10412dd0> DONE
<function PyLong_FromLong at 0x7f9a1050b750> DONE
<function check at 0x7f9a106b0850> DONE
<function PyModule_GetDict at 0x7f9a10648550> DONE
<function PyDict_SetItemString at 0x7f9a10412dd0> DONE
<function PyLong_FromLong at 0x7f9a1050b750> DONE
<function check at 0x7f9a106b0850> DONE
<function PyModule_GetDict at 0x7f9a10648550> DONE
<function PyDict_SetItemString at 0x7f9a10412dd0> DONE
<function PyLong_FromLong at 0x7f9a1050b750> DONE
<function check at 0x7f9a106b0850> DONE
<function PyModule_GetDict at 0x7f9a10648550> DONE
<function PyDict_SetItemString at 0x7f9a10412dd0> DONE
=========================== short test summary info ============================
FAIL module/cpyext/test/test_version.py::test_pragma_version
FAIL module/cpyext/test/test_version.py::AppTestVersion::()::test_versions
===================== 2 failed, 1 passed in 40.65 seconds ======================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f9a0e49bf90>> ignored
++ 15:35:23 starting module/cpyext/test/test_weakref.py [104 started in total]
__ module/cpyext/test/test_userslots.py [101 done in total, somefailed=False] _
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 7 items
module/cpyext/test/test_userslots.py ......called power
.
========================== 7 passed in 66.98 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fae0f54a7d0>> ignored
++ 15:35:42 starting module/crypt/test [105 started in total]
__ module/cpyext/test/test_weakref.py [102 done in total, somefailed=False] ___
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 5 items
module/cpyext/test/test_weakref.py .....
========================== 5 passed in 62.87 seconds ===========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f544f58f990>> ignored
++ 15:36:43 starting module/errno/test [106 started in total]
__ module/crypt/test [103 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/crypt/test/test_crypt.py .
========================== 1 passed in 58.27 seconds ===========================
++ 15:36:48 starting module/exceptions/test [107 started in total]
__ module/errno/test [104 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module/errno/test/test_errno.py ...
========================== 3 passed in 11.62 seconds ===========================
++ 15:36:55 starting module/faulthandler/test [108 started in total]
__ module/faulthandler/test [105 done in total, somefailed=False] _____________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module/faulthandler/test/test_faulthander.py ..
module/faulthandler/test/test_ztranslation.py .
========================== 3 passed in 21.64 seconds ===========================
++ 15:37:19 starting module/fcntl/test [109 started in total]
__ module/fcntl/test [106 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 8 items
module/fcntl/test/test_fcntl.py ........
========================== 8 passed in 34.93 seconds ===========================
++ 15:37:57 starting module/gc/test [110 started in total]
__ module/exceptions/test [107 done in total, somefailed=False] _______________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 98 items
module/exceptions/test/apptest_exceptions.py ..................................................
module/exceptions/test/test_exc.py ........s.......................................
==================== 97 passed, 1 skipped in 70.86 seconds =====================
++ 15:38:00 starting module/imp/test [111 started in total]
__ module/cpyext/test/test_unicodeobject.py [108 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 76 items
module/cpyext/test/test_unicodeobject.py .....................................................ss.....................
==================== 74 passed, 2 skipped in 296.12 seconds ====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f35fb444a90>> ignored
++ 15:38:39 starting module/itertools/test [112 started in total]
__ module/gc/test [109 done in total, somefailed=False] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 30 items
module/gc/test/test_app_referents.py ....
module/gc/test/test_gc.py .....x...
module/gc/test/test_hook.py ........
module/gc/test/test_referents.py ........
module/gc/test/test_ztranslation.py .
==================== 29 passed, 1 xfailed in 38.98 seconds =====================
++ 15:38:41 starting module/marshal/test [113 started in total]
__ module/marshal/test [110 done in total, somefailed=False] __________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 51 items
module/marshal/test/apptest_marshal.py ...............................................
module/marshal/test/test_marshal.py .
module/marshal/test/test_marshalimpl.py ...
========================== 51 passed in 87.07 seconds ==========================
++ 15:40:15 starting module/math/test [114 started in total]
__ module/itertools/test [111 done in total, somefailed=False] ________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 92 items
module/itertools/test/apptest_itertools.py ....
module/itertools/test/test_itertools.py .......................................................................................
module/itertools/test/test_ztranslation.py .
========================= 92 passed in 135.67 seconds ==========================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f8846eb0f90>> ignored
++ 15:40:57 starting module/micronumpy/test [115 started in total]
__ module/micronumpy/test [112 done in total, somefailed=False] _______________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items
========================= no tests ran in 0.00 seconds =========================
++ 15:40:57 starting module/mmap/test [116 started in total]
__ module/cpyext/test/test_typeobject.py [113 done in total, somefailed=False]
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 95 items
module/cpyext/test/test_typeobject.py ...................s......................................................s.....s..............
==================== 92 passed, 3 skipped in 443.20 seconds ====================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f33da9ea510>> ignored
++ 15:41:07 starting module/operator/test [117 started in total]
__ module/mmap/test [114 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 46 items
module/mmap/test/test_mmap.py ......................s.......................
==================== 45 passed, 1 skipped in 41.63 seconds =====================
++ 15:41:41 starting module/posix/test [118 started in total]
__ module/operator/test [115 done in total, somefailed=False] _________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 28 items
module/operator/test/test_operator.py ........................
module/operator/test/test_tscmp.py ....
========================== 28 passed in 48.56 seconds ==========================
++ 15:41:58 starting module/pwd/test [119 started in total]
__ module/imp/test [116 done in total, somefailed=True] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 123 items
module/imp/test/test_app.py FF.F.F.FFFFFFFF....F...
module/imp/test/test_import.py ..........................s..F....F........FF......FFFF..FFF..FsF.....FFFsF.......s.F.FFFFFFF......F
=================================== FAILURES ===================================
______________________ AppTestImpModule.test_find_module _______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_find_module(self):
> import os, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:43]:2: ModuleNotFoundError
_______________ AppTestImpModule.test_find_module_with_encoding ________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_find_module_with_encoding(self):
> import sys, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:53]:2: ModuleNotFoundError
________________________ AppTestImpModule.test_suffixes ________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_suffixes(self):
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:85]:2: ModuleNotFoundError
___________________ AppTestImpModule.test_obscure_functions ____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_obscure_functions(self):
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:106]:2: ModuleNotFoundError
_______________________ AppTestImpModule.test_is_builtin _______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_is_builtin(self):
> import sys, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:122]:2: ModuleNotFoundError
_____________________ AppTestImpModule.test_load_module_py _____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_load_module_py(self):
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:131]:2: ModuleNotFoundError
___________________ AppTestImpModule.test_load_module_pyc_1 ____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_load_module_pyc_1(self):
> import os, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:142]:2: ModuleNotFoundError
______________________ AppTestImpModule.test_load_source _______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_load_source(self):
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:156]:2: ModuleNotFoundError
___________________ AppTestImpModule.test_load_module_pyc_2 ____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_load_module_pyc_2(self):
> import os, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:164]:2: ModuleNotFoundError
____________________ AppTestImpModule.test_load_broken_pyc _____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_load_broken_pyc(self):
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:175]:2: ModuleNotFoundError
_______________ AppTestImpModule.test_load_module_in_sys_modules _______________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_load_module_in_sys_modules(self):
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:185]:2: ModuleNotFoundError
______________________ AppTestImpModule.test_nullimporter ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_nullimporter(self):
> import os, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:197]:2: ModuleNotFoundError
________________________ AppTestImpModule.test_get_tag _________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6edd4850>
def test_get_tag(self):
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_app.py:320]:2: ModuleNotFoundError
_______________________ AppTestImport.test_py_directory ________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_py_directory(self):
> import imp, os, sys
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:413]:2: ModuleNotFoundError
__________________ AppTestImport.test_no_relative_import_bug ___________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_no_relative_import_bug(self):
def imp():
from pkg import relative_g
exc = raises(ImportError, imp)
> assert exc.value.args[0] == "No module named 'pkg.imp'"
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:444]:5: AssertionError
_________ AppTestImport.test_relative_import_with___name__and___path__ _________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_relative_import_with___name__and___path__(self):
import sys
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:495]:3: ModuleNotFoundError
____________________ AppTestImport.test_relative_import_pkg ____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_relative_import_pkg(self):
import sys
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:504]:3: ModuleNotFoundError
__________________________ AppTestImport.test_reload ___________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_reload(self):
> import test_reload, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:580]:2: ModuleNotFoundError
______________________ AppTestImport.test_reload_failing _______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_reload_failing(self):
import test_reload
> import time, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:611]:3: ModuleNotFoundError
_____________________ AppTestImport.test_reload_submodule ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_reload_submodule(self):
> import pkg.a, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:625]:2: ModuleNotFoundError
________________ AppTestImport.test_reload_builtin_doesnt_clear ________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_reload_builtin_doesnt_clear(self):
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:629]:2: ModuleNotFoundError
_____________________ AppTestImport.test_reimport_builtin ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_reimport_builtin(self):
> import imp, sys, time
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:654]:2: ModuleNotFoundError
______________________ AppTestImport.test_reload_infinite ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_reload_infinite(self):
> import infinite_reload
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:669]:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
# infinite_reload.py
> import infinite_reload, imp; imp.reload(infinite_reload)
E (application-level) ModuleNotFoundError: No module named 'imp'
/tmp/pytest/usession-py3.12-568/impsubdir/infinite_reload.py:2: ModuleNotFoundError
__________________ AppTestImport.test_reload_module_subclass ___________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_reload_module_subclass(self):
> import types, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:672]:2: ModuleNotFoundError
_____________________ AppTestImport.test_cache_from_source _____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_cache_from_source(self):
> import imp, sys
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:706]:2: ModuleNotFoundError
_____________________ AppTestImport.test_crash_load_module _____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_crash_load_module(self):
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:731]:2: ModuleNotFoundError
______________________ AppTestImport.test_verbose_flag_0 _______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_verbose_flag_0(self):
output = []
class StdErr(object):
def write(self, line):
output.append(line)
def flush(self):
return
> import sys, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:774]:9: ModuleNotFoundError
______________________ AppTestImport.test_source_encoding ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_source_encoding(self):
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:790]:2: ModuleNotFoundError
____________________ AppTestImport.test_bad_source_encoding ____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_bad_source_encoding(self):
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:797]:2: ModuleNotFoundError
________________________ AppTestImport.test_unencodable ________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a6c392610>
def test_unencodable(self):
if not self.testfn_unencodable:
skip("need an unencodable filename")
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:814]:4: ModuleNotFoundError
_____________________ TestPycStuff.test_pyc_magic_changes2 _____________________
self = <pypy.module.imp.test.test_import.TestPycStuff instance at 0x7f4a697ea640>
def test_pyc_magic_changes2(self):
from pypy.tool.lib_pypy import LIB_PYTHON
from pypy.interpreter.pycode import default_magic
from hashlib import sha256
opcode_path = LIB_PYTHON.join('opcode.py')
h = sha256()
# very simple test: hard-code the hash of lib-python/3/opcode.py and the
# default magic. if you change stdlib_opcode, please update the hash
# below, as well as incrementing the magic number in pycode.py
with opcode_path.open("rb") as f:
h.update(f.read())
> assert h.hexdigest() == '4082bd96b9aacf9672a2c5196a6a3b6caf5e9de0071fe4e43aa642b0860381a4'
E assert 'f9ced71af192...0a3125e21374c' == '4082bd96b9aac...642b0860381a4'
E - f9ced71af192e7e041935ca361eff6fa412d0ad84838d1c22530a3125e21374c
E + 4082bd96b9aacf9672a2c5196a6a3b6caf5e9de0071fe4e43aa642b0860381a4
module/imp/test/test_import.py:1034: AssertionError
______________________ AppTestImportHooks.test_meta_path _______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a698626d0>
def test_meta_path(self):
tried_imports = []
class Importer(object):
def find_module(self, fullname, path=None):
tried_imports.append((fullname, path))
import sys, math
del sys.modules["math"]
sys.meta_path.insert(0, Importer())
try:
import math
# the above line may trigger extra imports, like _operator
# from app_math.py. The first one should be 'math'.
> assert len(tried_imports) >= 1
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:1084]:15: AssertionError
___________________ AppTestImportHooks.test_meta_path_block ____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a698626d0>
def test_meta_path_block(self):
class ImportBlocker(object):
"Specified modules can't be imported, even if they are built-in"
def __init__(self, *namestoblock):
self.namestoblock = dict.fromkeys(namestoblock)
def find_module(self, fullname, path=None):
if fullname in self.namestoblock:
return self
def load_module(self, fullname):
raise ImportError("blocked")
> import sys, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:1107]:12: ModuleNotFoundError
__________________ AppTestImportHooks.test_path_hooks_leaking __________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a698626d0>
def test_path_hooks_leaking(self):
class Importer(object):
def find_module(self, fullname, path=None):
if fullname == "a":
return self
def load_module(self, name):
sys.modules[name] = sys
return sys
def importer_for_path(path):
if path == "xxx":
return Importer()
raise ImportError()
> import sys, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:1136]:15: ModuleNotFoundError
_____________________ AppTestImportHooks.test_imp_wrapper ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a698626d0>
def test_imp_wrapper(self):
> import sys, os, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:1166]:2: ModuleNotFoundError
__________________ AppTestImportHooks.test_path_hooks_module ___________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a698626d0>
def test_path_hooks_module(self):
"Verify that non-sibling imports from module loaded by path hook works"
import sys
> import hooktest
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:1221]:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> import sys, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
module/imp/test/hooktest.py:1: ModuleNotFoundError
_______________ AppTestImportHooks.test_meta_path_import_error_1 _______________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a698626d0>
def test_meta_path_import_error_1(self):
# check that we get a KeyError somewhere inside
# <frozen importlib._bootstrap>, like CPython 3.5
class ImportHook(object):
def find_module(self, fullname, path=None):
assert not fullname.endswith('*')
if fullname == 'meta_path_pseudo_module':
return self
def load_module(self, fullname):
assert fullname == 'meta_path_pseudo_module'
# we "forget" to update sys.modules
return types.ModuleType('meta_path_pseudo_module')
import sys, types
sys.meta_path.append(ImportHook())
try:
> raises(KeyError, "import meta_path_pseudo_module")
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:1239]:18:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> import meta_path_pseudo_module
E (application-level) ModuleNotFoundError: No module named 'meta_path_pseudo_module'
<[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:1239]:18>:1: ModuleNotFoundError
_______________ AppTestImportHooks.test_meta_path_import_star_2 ________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a698626d0>
def test_meta_path_import_star_2(self):
class ImportHook(object):
def find_module(self, fullname, path=None):
if fullname.startswith('meta_path_2_pseudo_module'):
return self
def load_module(self, fullname):
assert fullname == 'meta_path_2_pseudo_module'
m = types.ModuleType('meta_path_2_pseudo_module')
m.__path__ = ['/some/random/dir']
sys.modules['meta_path_2_pseudo_module'] = m
return m
import sys, types
sys.meta_path.append(ImportHook())
try:
> self.exec_("from meta_path_2_pseudo_module import *", {})
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:1260]:16:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a698626d0>
cmd = W_UnicodeObject('from meta_path_2_pseudo_module import *')
ns = W_DictObject(<pypy.objspace.std.dictmultiobject.UnicodeDictStrategy object at 0x7f4a6a8b5f90>)
> ???
?:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E (application-level) ModuleNotFoundError: No module named 'meta_path_2_pseudo_module'
<string>:1: ModuleNotFoundError
_______________________ AppTestImportlibMagic.test_magic _______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7f4a67c49b50>
def test_magic(self):
from importlib import _bootstrap_external
> assert _bootstrap_external.MAGIC_NUMBER == self.magic
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/module/imp/test/test_import.py:1338]:3: AssertionError
=========================== short test summary info ============================
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_find_module
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_find_module_with_encoding
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_suffixes
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_obscure_functions
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_is_builtin
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_load_module_py
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_load_module_pyc_1
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_load_source
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_load_module_pyc_2
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_load_broken_pyc
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_load_module_in_sys_modules
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_nullimporter
FAIL module/imp/test/test_app.py::AppTestImpModule::()::test_get_tag
FAIL module/imp/test/test_import.py::AppTestImport::()::test_py_directory
FAIL module/imp/test/test_import.py::AppTestImport::()::test_no_relative_import_bug
FAIL module/imp/test/test_import.py::AppTestImport::()::test_relative_import_with___name__and___path__
FAIL module/imp/test/test_import.py::AppTestImport::()::test_relative_import_pkg
FAIL module/imp/test/test_import.py::AppTestImport::()::test_reload
FAIL module/imp/test/test_import.py::AppTestImport::()::test_reload_failing
FAIL module/imp/test/test_import.py::AppTestImport::()::test_reload_submodule
FAIL module/imp/test/test_import.py::AppTestImport::()::test_reload_builtin_doesnt_clear
FAIL module/imp/test/test_import.py::AppTestImport::()::test_reimport_builtin
FAIL module/imp/test/test_import.py::AppTestImport::()::test_reload_infinite
FAIL module/imp/test/test_import.py::AppTestImport::()::test_reload_module_subclass
FAIL module/imp/test/test_import.py::AppTestImport::()::test_cache_from_source
FAIL module/imp/test/test_import.py::AppTestImport::()::test_crash_load_module
FAIL module/imp/test/test_import.py::AppTestImport::()::test_verbose_flag_0
FAIL module/imp/test/test_import.py::AppTestImport::()::test_source_encoding
FAIL module/imp/test/test_import.py::AppTestImport::()::test_bad_source_encoding
FAIL module/imp/test/test_import.py::AppTestImport::()::test_unencodable
FAIL module/imp/test/test_import.py::TestPycStuff::()::test_pyc_magic_changes2
FAIL module/imp/test/test_import.py::AppTestImportHooks::()::test_meta_path
FAIL module/imp/test/test_import.py::AppTestImportHooks::()::test_meta_path_block
FAIL module/imp/test/test_import.py::AppTestImportHooks::()::test_path_hooks_leaking
FAIL module/imp/test/test_import.py::AppTestImportHooks::()::test_imp_wrapper
FAIL module/imp/test/test_import.py::AppTestImportHooks::()::test_path_hooks_module
FAIL module/imp/test/test_import.py::AppTestImportHooks::()::test_meta_path_import_error_1
FAIL module/imp/test/test_import.py::AppTestImportHooks::()::test_meta_path_import_star_2
FAIL module/imp/test/test_import.py::AppTestImportlibMagic::()::test_magic
============== 39 failed, 80 passed, 4 skipped in 261.32 seconds ===============
++ 15:42:28 starting module/pyexpat/test [120 started in total]
__ module/pwd/test [117 done in total, somefailed=False] ______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 5 items
module/pwd/test/test_pwd.py ....
module/pwd/test/test_ztranslation.py .
========================== 5 passed in 50.90 seconds ===========================
++ 15:42:57 starting module/pypyjit/test [121 started in total]
__ module/pyexpat/test [118 done in total, somefailed=False] __________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 21 items
module/pyexpat/test/apptest_pyexpat.py ...
module/pyexpat/test/test_build.py .
module/pyexpat/test/test_parser.py .................
========================== 21 passed in 39.76 seconds ==========================
++ 15:43:12 starting module/select/test [122 started in total]
__ module/pypyjit/test [119 done in total, somefailed=False] __________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 29 items
module/pypyjit/test/test_jit_hook.py ........s
module/pypyjit/test/test_jit_not_in_trace.py ..
module/pypyjit/test/test_jit_setup.py ....
module/pypyjit/test/test_policy.py ............
module/pypyjit/test/test_pyframe.py .
module/pypyjit/test/test_ztranslation.py .
==================== 28 passed, 1 skipped in 69.24 seconds =====================
++ 15:44:10 starting module/signal/test [123 started in total]
__ module/select/test [120 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 46 items
module/select/test/test_epoll.py ..........
module/select/test/test_kqueue.py ssssss
module/select/test/test_select.py ............................
module/select/test/test_select_signal.py .
module/select/test/test_ztranslation.py .
==================== 40 passed, 6 skipped in 88.53 seconds =====================
++ 15:44:46 starting module/struct/test [124 started in total]
__ module/posix/test [121 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 177 items / 2 skipped
module/posix/test/apptest_posix.py ....
module/posix/test/test_interp_posix.py ....
module/posix/test/test_posix2.py ......................................................................................s......s.................s..ss.........ssss........ssss........
module/posix/test/test_scandir.py ....................
=================== 164 passed, 15 skipped in 198.68 seconds ===================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7f6199682c10>> ignored
++ 15:45:04 starting module/sys/test [125 started in total]
__ module/struct/test [122 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 52 items
module/struct/test/apptest_struct.py ..........................................
module/struct/test/apptest_structbuffer.py ..
module/struct/test/test_struct.py .......
module/struct/test/test_ztranslation.py .
========================== 52 passed in 52.07 seconds ==========================
++ 15:45:45 starting module/termios/test [126 started in total]
__ module/sys/test [123 done in total, somefailed=True] _______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 101 items
module/sys/test/apptest_audit.py ..........
module/sys/test/apptest_initpath.py .
module/sys/test/apptest_sys.py .
module/sys/test/test_encoding.py ..
module/sys/test/test_initpath.py ..........
module/sys/test/test_sysmodule.py ..................................F..........s......F.................
module/sys/test/test_version.py .......
=================================== FAILURES ===================================
_______ AppTestSysModulePortedFromCPython.test_tracebacklimit_excepthook _______
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fe5d428ce50>
def test_tracebacklimit_excepthook(self):
import sys
savestderr = sys.stderr
assert not hasattr(sys, "tracebacklimit")
eh = sys.__excepthook__
def f1():
f2()
def f2():
f3()
def f3():
raise ValueError(42)
def get_error_with_tracebacklimit(limit):
import io
sys.tracebacklimit = limit
sys.stderr = err = io.StringIO()
try:
f1()
except ValueError:
eh(*sys.exc_info())
return err.getvalue()
# should be removed by the limit
msg = get_error_with_tracebacklimit(2)
assert "f1" not in msg
> assert "f2" in msg
E (application-level) AssertionError
[/build_dir/own-linux-x86-64/build/pypy/module/sys/test/test_sysmodule.py:460]:27: AssertionError
_ AppTestSysModulePortedFromCPython.test_reload_doesnt_override_sys_executable _
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fe5d428ce50>
def test_reload_doesnt_override_sys_executable(self):
import sys
> from imp import reload
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/sys/test/test_sysmodule.py:791]:3: ModuleNotFoundError
=========================== short test summary info ============================
FAIL module/sys/test/test_sysmodule.py::AppTestSysModulePortedFromCPython::()::test_tracebacklimit_excepthook
FAIL module/sys/test/test_sysmodule.py::AppTestSysModulePortedFromCPython::()::test_reload_doesnt_override_sys_executable
=============== 2 failed, 98 passed, 1 skipped in 69.77 seconds ================
Exception AttributeError: '__exit__' in <bound method Lock.__del__ of <rpython.rlib.rthread.Lock object at 0x7fe5d3fc8ed0>> ignored
++ 15:46:17 starting module/test_lib_pypy [127 started in total]
__ module/signal/test [124 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 27 items
module/signal/test/apptest_signal.py .
module/signal/test/test_signal.py ..........................
========================= 27 passed in 168.79 seconds ==========================
++ 15:47:03 starting module/thread/test [128 started in total]
__ module/termios/test [125 done in total, somefailed=False] __________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 10 items
module/termios/test/test_termios.py ..........
========================= 10 passed in 163.88 seconds ==========================
++ 15:48:31 starting module/time/test [129 started in total]
__ module/test_lib_pypy [126 done in total, somefailed=False] _________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 206 items / 7 skipped
module/test_lib_pypy/test_code_module.py ...
module/test_lib_pypy/test_collections.py .....................
module/test_lib_pypy/test_marshal_extra.py .......................................................................................................................................................
module/test_lib_pypy/test_md5_extra.py ......
module/test_lib_pypy/test_pickle_extra.py s
module/test_lib_pypy/test_sha_extra.py .....
module/test_lib_pypy/test_site_extra.py .
module/test_lib_pypy/test_structseq.py ...........
module/test_lib_pypy/test_tputil.py ..s....
=================== 204 passed, 9 skipped in 164.29 seconds ====================
++ 15:49:03 starting module/token/test [130 started in total]
__ module/token/test [127 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 8 items
module/token/test/apptest_token.py ........
========================== 8 passed in 11.20 seconds ===========================
++ 15:49:15 starting module/unicodedata/test [131 started in total]
__ module/time/test [128 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 43 items
module/time/test/apptest_time.py ........................s................
module/time/test/test_timeutils.py .
module/time/test/test_ztranslation.py .
==================== 42 passed, 1 skipped in 135.71 seconds ====================
++ 15:50:49 starting module/zipimport/test [132 started in total]
__ module/unicodedata/test [129 done in total, somefailed=False] ______________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 35 items
module/unicodedata/test/test_hyp.py ................
module/unicodedata/test/test_unicodedata.py ...................
========================== 35 passed in 88.91 seconds ==========================
++ 15:50:50 starting module/zlib/test [133 started in total]
__ module/zipimport/test [130 done in total, somefailed=False] ________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module/zipimport/test/apptest_zipimport.py .
========================== 1 passed in 11.08 seconds ===========================
++ 15:51:01 starting objspace/fake/test [134 started in total]
__ module/thread/test [131 done in total, somefailed=True] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 56 items
module/thread/test/test_fork.py s..F
module/thread/test/test_gil.py ....
module/thread/test/test_import_lock.py F.FF.
module/thread/test/test_local.py .......
module/thread/test/test_lock.py .....................
module/thread/test/test_thread.py ...............
=================================== FAILURES ===================================
___________________ AppTestFork.test_nested_import_lock_fork ___________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fcc0b3b6c90>
def test_nested_import_lock_fork(self):
"""Check fork() in main thread works while the main thread is doing an import"""
# Issue 9573: this used to trigger RuntimeError in the child process
> import imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/thread/test/test_fork.py:93]:4: ModuleNotFoundError
________________________ AppTestThread.test_import_lock ________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fcbf948d7d0>
def test_import_lock(self):
# XXX XXX XXX this test fails if run together with all other tests
# of this directory, but not when run alone
> import _thread, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/thread/test/test_import_lock.py:12]:4: ModuleNotFoundError
______________________ AppTestThread.test_manual_locking _______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fcbf948d7d0>
def test_manual_locking(self):
> import _thread, os, imp, time, sys
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/thread/test/test_import_lock.py:33]:2: ModuleNotFoundError
________________ AppTestThread.test_lock_held_by_another_thread ________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x7fcbf948d7d0>
def test_lock_held_by_another_thread(self):
> import _thread as thread, imp
E (application-level) ModuleNotFoundError: No module named 'imp'
[/build_dir/own-linux-x86-64/build/pypy/module/thread/test/test_import_lock.py:65]:2: ModuleNotFoundError
=========================== short test summary info ============================
FAIL module/thread/test/test_fork.py::AppTestFork::()::test_nested_import_lock_fork
FAIL module/thread/test/test_import_lock.py::AppTestThread::()::test_import_lock
FAIL module/thread/test/test_import_lock.py::AppTestThread::()::test_manual_locking
FAIL module/thread/test/test_import_lock.py::AppTestThread::()::test_lock_held_by_another_thread
=============== 4 failed, 51 passed, 1 skipped in 234.94 seconds ===============
++ 15:51:02 starting objspace/std/test [135 started in total]
__ objspace/fake/test [132 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 21 items
objspace/fake/test/test_checkmodule.py ........
objspace/fake/test/test_objspace.py .............
========================== 21 passed in 19.13 seconds ==========================
++ 15:51:22 starting objspace/test [136 started in total]
__ module/zlib/test [133 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 38 items
module/zlib/test/test_zlib.py ..................................s...
==================== 37 passed, 1 skipped in 54.38 seconds =====================
++ 15:51:48 starting sandbox/test [137 started in total]
__ objspace/test [134 done in total, somefailed=False] ________________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 75 items
objspace/test/apptest_binop_overriding.py .
objspace/test/apptest_descriptor.py ....s....
objspace/test/apptest_descroperation.py ................s......................................
objspace/test/test_descroperation.py ..........
==================== 73 passed, 2 skipped in 25.09 seconds =====================
++ 15:51:50 starting tool/bench/test [138 started in total]
__ tool/bench/test [135 done in total, somefailed=False] ______________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items / 1 skipped
tool/bench/test/test_pypyresult.py ...
===================== 3 passed, 1 skipped in 0.85 seconds ======================
++ 15:51:51 starting tool/memusage/test [139 started in total]
__ tool/memusage/test [136 done in total, somefailed=False] ___________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 5 items
tool/memusage/test/test_log2gnumeric.py .....
=========================== 5 passed in 0.84 seconds ===========================
++ 15:51:53 starting tool/pytest/fake_pytest/test [140 started in total]
__ tool/pytest/fake_pytest/test [137 done in total, somefailed=True] __________
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/main.py", line 107, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/config.py", line 839, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/vendored_packages/pluggy.py", line 729, in call_historic
INTERNALERROR> self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/vendored_packages/pluggy.py", line 596, in execute
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/assertion/__init__.py", line 61, in pytest_configure
INTERNALERROR> _load_modules(mode)
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/assertion/__init__.py", line 154, in _load_modules
INTERNALERROR> from _pytest.assertion import rewrite # noqa
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/assertion/rewrite.py", line 5, in <module>
INTERNALERROR> import importlib.util
INTERNALERROR> ImportError: No module named util
++ 15:51:53 starting tool/pytest/test [141 started in total]
__ tool/pytest/test [138 done in total, somefailed=True] ______________________
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/main.py", line 107, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/config.py", line 839, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/vendored_packages/pluggy.py", line 729, in call_historic
INTERNALERROR> self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/vendored_packages/pluggy.py", line 596, in execute
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/assertion/__init__.py", line 61, in pytest_configure
INTERNALERROR> _load_modules(mode)
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/assertion/__init__.py", line 154, in _load_modules
INTERNALERROR> from _pytest.assertion import rewrite # noqa
INTERNALERROR> File "/build_dir/own-linux-x86-64/build/_pytest/assertion/rewrite.py", line 5, in <module>
INTERNALERROR> import importlib.util
INTERNALERROR> ImportError: No module named util
++ 15:51:54 starting tool/release/test [142 started in total]
__ sandbox/test [139 done in total, somefailed=False] _________________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
sandbox/test/test_pypy_interact.py .
========================== 1 passed in 13.61 seconds ===========================
++ 15:52:03 starting tool/test [143 started in total]
__ tool/release/test [140 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 8 items
tool/release/test/test_package.py ....s
tool/release/test/test_smartstrip.py ...
===================== 7 passed, 1 skipped in 23.14 seconds =====================
__ tool/test [141 done in total, somefailed=False] ____________________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 29 items
tool/test/test_gdb_pypy.py ...........
tool/test/test_getdocstrings.py ...
tool/test/test_isolate.py .......
tool/test/test_lib_pypy.py ...
tool/test/test_license.py .
tool/test/test_package.py .
tool/test/test_tab.py ..
tool/test/test_template.py .
========================== 29 passed in 14.33 seconds ==========================
__ module/math/test [142 done in total, somefailed=False] _____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 209 items
module/math/test/apptest_math.py ...........s
module/math/test/test_direct.py ......................................................................................................................................................................
module/math/test/test_math.py ............s..................
=================== 207 passed, 2 skipped in 1317.04 seconds ===================
__ objspace/std/test [143 done in total, somefailed=False] ____________________
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('/build_dir/own-linux-x86-64/build/pypy/.hypothesis/examples')
pytest-2.9.2 from /build_dir/own-linux-x86-64/build/pytest.pyc
rootdir: /build_dir/own-linux-x86-64/build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 2498 items
objspace/std/test/apptest_boolobject.py .........
objspace/std/test/apptest_callmethod.py ..........
objspace/std/test/apptest_complexobject.py ....................................
objspace/std/test/apptest_contains.py ..
objspace/std/test/apptest_instmethobject.py .....
objspace/std/test/apptest_iterobject.py .....................
objspace/std/test/apptest_memoryobject.py ........
objspace/std/test/apptest_operation.py .
objspace/std/test/apptest_stringformat.py .................s......s..................s........................
objspace/std/test/apptest_typeobjject.py ........
objspace/std/test/apptest_unicode.py ...........................s..........................................................................................
objspace/std/test/apptest_userobject.py ........................
objspace/std/test/test_boolobject.py .......
objspace/std/test/test_bytearrayobject.py .....................................................................................
objspace/std/test/test_bytesobject.py ................................................................................s......................
objspace/std/test/test_callmethod.py ...
objspace/std/test/test_celldict.py ..........................................
objspace/std/test/test_complexobject.py ....
objspace/std/test/test_dictmultiobject.py .........s.s.........................................................s.........................................................s.........................................................................
objspace/std/test/test_dictproxy.py ................
objspace/std/test/test_floatobject.py ......................................................
objspace/std/test/test_identitydict.py .....
objspace/std/test/test_identityset.py .......
objspace/std/test/test_index.py ...................................
objspace/std/test/test_intobject.py .............................................................................................................................................................
objspace/std/test/test_iterobject.py ....
objspace/std/test/test_jsondict.py ..........
objspace/std/test/test_kwargsdict.py ....................................
objspace/std/test/test_lengthhint.py .....................
objspace/std/test/test_listobject.py ..................................................................................................................
objspace/std/test/test_liststrategies.py ...................................................................s...................................................................
objspace/std/test/test_longobject.py ....................................................
objspace/std/test/test_mapdict.py ..........................................................................................s.......................................................
objspace/std/test/test_memoryobject.py .............................................
objspace/std/test/test_methodcache.py ............................................................................................
objspace/std/test/test_newformat.py ...................................................s...........
objspace/std/test/test_noneobject.py ...
objspace/std/test/test_obj.py .......................................
objspace/std/test/test_prebuiltint.py ..............................................................
objspace/std/test/test_proxy.py ssssssssssss
objspace/std/test/test_proxy_function.py ........
objspace/std/test/test_proxy_internals.py .......
objspace/std/test/test_proxy_iter.py .
objspace/std/test/test_proxy_object.py ..........
objspace/std/test/test_proxy_usercreated.py .
objspace/std/test/test_random_attr.py s....
objspace/std/test/test_setobject.py .................................................................................................
objspace/std/test/test_setstrategies.py ....s...ss...
objspace/std/test/test_sliceobject.py .............
objspace/std/test/test_smalllongobject.py .................................................................................................................................................................................................................................................
objspace/std/test/test_specialisedtupleobject.py ...................ss............................
objspace/std/test/test_stdobjspace.py s........
objspace/std/test/test_translate.py .
objspace/std/test/test_tupleobject.py .......................................
objspace/std/test/test_typeobject.py ............................................................................................................
objspace/std/test/test_unicodeobject.py .................
objspace/std/test/test_userobject.py .
objspace/std/test/test_versionedtype.py ...............
================== 2467 passed, 31 skipped in 755.47 seconds ===================
program finished with exit code 1
elapsedTime=4337.328614