virt_test\Scripts\python.exe testrunner/runner.py --logfile=testrun.log --config=pypy/testrunner_cfg.py --config=~/machine_cfg.py --root=pypy --timeout=4000
in dir d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build (timeout 4000 secs)
watching logfiles {'pytestLog': 'testrun.log'}
argv: ['virt_test\\Scripts\\python.exe', 'testrunner/runner.py', '--logfile=testrun.log', '--config=pypy/testrunner_cfg.py', '--config=~/machine_cfg.py', '--root=pypy', '--timeout=4000']
environment:
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\matti\AppData\Roaming
ASL.LOG=Destination=file
CHOCOLATEYINSTALL=C:\ProgramData\chocolatey
CHOCOLATEYLASTPATHUPDATE=133185086718935289
CHOCOLATEYTOOLSLOCATION=C:\tools
CLINK_DIR=C:\Program Files (x86)\clink\0.4.9
COMMONPROGRAMFILES=C:\Program Files (x86)\Common Files
COMMONPROGRAMFILES(X86)=C:\Program Files (x86)\Common Files
COMMONPROGRAMW6432=C:\Program Files\Common Files
COMPUTERNAME=DESKTOP-RYZEN
COMSPEC=C:\WINDOWS\system32\cmd.exe
CONDA_BAT=d:\miniconda\condabin\conda.bat
CONDA_EXE=d:\miniconda\Scripts\conda.exe
CONDA_SHLVL=0
CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7
CUDA_PATH_V11_7=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7
DRIVERDATA=C:\Windows\System32\Drivers\DriverData
LOCALAPPDATA=C:\Users\matti\AppData\Local
NUMBER_OF_PROCESSORS=2
NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt\
OS=Windows_NT
PATH=d:\CPython27\lib\site-packages\pywin32_system32;d:\pypy_stuff\pypy\externals\bin;D:\CPython27;D:\pypy_stuff\pypy2.7-v7.3.18\Scripts;D:\pypy_stuff\pypy2.7-v7.3.18;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseHg\;C:\Program Files\Git\cmd;C:\ProgramData\chocolatey\bin;C:\WINDOWS\System32\OpenSSH
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_ARCHITEW6432=AMD64
PROCESSOR_IDENTIFIER=AMD64 Family 23 Model 113 Stepping 0, AuthenticAMD
PROCESSOR_LEVEL=23
PROCESSOR_REVISION=7100
PROGRAMDATA=C:\ProgramData
PROGRAMFILES=C:\Program Files (x86)
PROGRAMFILES(X86)=C:\Program Files (x86)
PROGRAMW6432=C:\Program Files
PROMPT=$P$G
PSMODULEPATH=%ProgramFiles%\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
PWD=d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build
PYPYCHERRYPICK=
PYPY_ENABLE_WINCONSOLEIO=1
PYTEST_XDIST_AUTO_NUM_WORKERS=4
PYTHONPATH=.;
RTOOLS40_HOME=C:\rtools40
RTOOLS43_HOME=C:\rtools43
RTOOLS44_HOME=C:\rtools44
SYSTEMDRIVE=C:
SYSTEMROOT=C:\WINDOWS
TEMP=D:\SystemTemp
TMP=D:\SystemTemp
TMPDIR=d:\systemtemp\pytest
USERDOMAIN=DESKTOP-RYZEN
USERNAME=matti
USERPROFILE=C:\Users\matti
VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
WINDIR=C:\WINDOWS
using PTY: False
using config pypy/testrunner_cfg.py
using config C:\Users\matti/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
++ 03:30:55 starting config/test [1 started in total]
++ 03:30:55 starting interpreter/astcompiler/test [2 started in total]
++ 03:30:55 starting interpreter/pyparser/test [3 started in total]
++ 03:30:55 starting interpreter/test [4 started in total]
__ config/test [1 done in total, somefailed=False] ____________________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.py
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 58.74 seconds ====================
++ 03:32:02 starting module/__builtin__/test [5 started in total]
__ interpreter/pyparser/test [2 done in total, somefailed=False] ______________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 192 items
interpreter\pyparser\test\apptest_parsestring.py ......
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_pyparse.py .........................................................................................................
interpreter\pyparser\test\test_pytokenizer.py ..............................
======================== 192 passed in 158.61 seconds =========================
++ 03:33:36 starting module/__pypy__/test [6 started in total]
__ interpreter/astcompiler/test [3 done in total, somefailed=False] ___________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 1512 items
interpreter\astcompiler\test\apptest_compiler.py ......
interpreter\astcompiler\test\apptest_exceptiongroup.py .........................
interpreter\astcompiler\test\apptest_misc.py ...............
interpreter\astcompiler\test\apptest_patma.py .........................................
interpreter\astcompiler\test\test_assemble.py .......................
interpreter\astcompiler\test\test_ast.py ............
interpreter\astcompiler\test\test_astbuilder.py .................................................................................................................
interpreter\astcompiler\test\test_compiler.py .................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
interpreter\astcompiler\test\test_misc.py ...............
interpreter\astcompiler\test\test_symtable.py ........................................
interpreter\astcompiler\test\test_unparse.py ................................
interpreter\astcompiler\test\test_validate.py .....................................................
======================== 1512 passed in 264.25 seconds ========================
++ 03:35:26 starting module/_abc/test [7 started in total]
__ module/__builtin__/test [4 done in total, somefailed=False] ________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
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 232.90 seconds ===================
++ 03:35:56 starting module/_ast/test [8 started in total]
__ module/_abc/test [5 done in total, somefailed=False] _______________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 6 items
module\_abc\test\apptest_abc.py ...
module\_abc\test\test_abc.py ...
========================== 6 passed in 92.42 seconds ==========================
++ 03:37:02 starting module/_cffi_backend/test [9 started in total]
__ module/__pypy__/test [6 done in total, somefailed=True] ____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
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 ...F...
module\__pypy__\test\test_identitydict.py ......
module\__pypy__\test\test_intop.py ...........
module\__pypy__\test\test_locals2fast.py .....
module\__pypy__\test\test_magic.py ..........
module\__pypy__\test\test_newmemoryview.py ........
module\__pypy__\test\test_os.py F
module\__pypy__\test\test_signal.py ..sss
module\__pypy__\test\test_special.py ............s.
================================== FAILURES ===================================
___________________ AppTestDebug.test_debug_read_timestamp ____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000025db0787130>
def test_debug_read_timestamp(self):
from __pypy__ import debug_read_timestamp
a = debug_read_timestamp()
b = debug_read_timestamp()
> assert b > a
E (application-level) AssertionError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\__pypy__\test\test_debug.py:52]:5: AssertionError
_________________________ AppTestOs.test_real_getenv __________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000025db144a1a8>
def test_real_getenv(self):
import __pypy__.os
import os
key = 'UNLIKELY_SET'
assert key not in os.environ
os.putenv(key, '42')
# this one skips Python cache
> assert __pypy__.os.real_getenv(key) == '42'
E (application-level) AssertionError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\__pypy__\test\test_os.py:4]:9: AssertionError
=========================== short test summary info ===========================
FAIL module\__pypy__\test\test_debug.py::AppTestDebug::()::test_debug_read_timestamp
FAIL module\__pypy__\test\test_os.py::AppTestOs::()::test_real_getenv
============== 2 failed, 75 passed, 4 skipped in 199.36 seconds ===============
++ 03:37:03 starting module/_codecs/test [10 started in total]
__ module/_ast/test [7 done in total, somefailed=False] _______________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 55 items
module\_ast\test\apptest_ast.py ...
module\_ast\test\test_ast.py ....................................................
========================= 55 passed in 142.32 seconds =========================
++ 03:38:24 starting module/_collections/test [11 started in total]
__ interpreter/test [8 done in total, somefailed=True] ________________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 1342 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 ..........................
interpreter\test\apptest_exctable_dis.py .........
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_pycode.py ....
interpreter\test\apptest_pyframe.py ................................................................
interpreter\test\apptest_raise.py .....................................................
interpreter\test\apptest_settrace_jump.py .
interpreter\test\apptest_sys_settrace.py ..............................................................................................................................................
interpreter\test\apptest_traceback.py ......F.
interpreter\test\apptest_unraisable.py ....
interpreter\test\apptest_with_leak.py .........
interpreter\test\test_app_main.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssF..
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 .............................................................................................................
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 F..
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 .......................
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 .........................................................
interpreter\test\test_targetpypy.py ..
interpreter\test\test_typedef.py ...................
interpreter\test\test_unicodehelper.py ..........
interpreter\test\test_zpy.py ssssssss
interpreter\test\test_zzpickle_and_slow.py s.....s..s..sss........ss...s.
================================== FAILURES ===================================
__________________________ 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
> assert can_colorize()
E (application-level) AssertionError: assert False
E + where False = <function can_colorize at 0x000002678c51d4e8>()
interpreter\test\apptest_traceback.py:177: AssertionError
__________________ AppTestAppMain.test_setup_bootstrap_path ___________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002678e521d00>
def test_setup_bootstrap_path(self):
# Check how sys.path is handled depending on if we can find a copy of
# the stdlib in setup_bootstrap_path.
import sys, os
old_sys_path = sys.path[:]
old_cwd = os.getcwd()
# make sure cwd does not contain a stdlib
if self.tmp_dir.startswith(self.trunkdir):
skip('TMPDIR is inside the PyPy source')
sys.path.append(self.goal_dir)
tmp_pypy_c = os.path.join(self.tmp_dir, 'pypy3-c')
try:
os.chdir(self.tmp_dir)
# If we are running PyPy with a libpypy3-c, the following
# lines find the stdlib anyway. Otherwise, it is not found.
expected_found = (
getattr(sys, 'pypy_translation_info', {})
.get('translation.shared'))
import app_main
app_main.setup_bootstrap_path(tmp_pypy_c)
if not sys.platform == 'win32':
assert sys.executable == ''
if not expected_found:
assert sys.path == old_sys_path + [self.goal_dir]
app_main.setup_bootstrap_path(self.fake_exe)
if not sys.platform == 'win32':
# an existing file is always 'executable' on windows
assert sys.executable == '' # not executable!
if not expected_found:
assert sys.path == old_sys_path + [self.goal_dir]
os.chmod(self.fake_exe, 0o755)
app_main.setup_bootstrap_path(self.fake_exe)
> assert sys.executable == self.fake_exe
E (application-level) AssertionError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\interpreter\test\test_app_main.py:1319]:38: AssertionError
_____________________ TestFSEncode.test_fsencode_fsdecode _____________________
self = <pypy.interpreter.test.test_fsencode.TestFSEncode instance at 0x000002679bdce760>
def test_fsencode_fsdecode(self):
space = self.space
strs = [u"/home/bar/baz", u"c:\\"]
if self.special_char:
strs.append(self.special_char)
for st in strs:
# check roundtrip
w_st = space.newtext(st.encode('utf8'), len(st))
w_enc = space.fsencode(w_st)
w_st2 = space.fsdecode(w_enc)
assert space.eq_w(w_st, w_st2)
> assert space.fsdecode_w(w_enc) == st
E assert '\xc3\xa4' == u'\xe4'
E - \xc3\xa4
E + \xe4
interpreter\test\test_fsencode.py:77: AssertionError
---------------------------- Captured stderr call -----------------------------
d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\interpreter\test\test_fsencode.py:77: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
assert space.fsdecode_w(w_enc) == st
d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\interpreter\test\test_fsencode.py:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
import sys
=========================== short test summary info ===========================
FAIL interpreter\test\apptest_traceback.py::test_colors_in_traceback
FAIL interpreter\test\test_app_main.py::AppTestAppMain::()::test_setup_bootstrap_path
FAIL interpreter\test\test_fsencode.py::TestFSEncode::()::test_fsencode_fsdecode
============ 3 failed, 1231 passed, 108 skipped in 482.60 seconds =============
++ 03:39:04 starting module/_continuation/test [12 started in total]
__ module/_collections/test [9 done in total, somefailed=False] _______________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 66 items
module\_collections\test\apptest_defaultdict.py ..............
module\_collections\test\apptest_deque.py ..........................................
module\_collections\test\apptest_ordereddict.py ..........
========================= 66 passed in 103.55 seconds =========================
++ 03:40:14 starting module/_cppyy/test [13 started in total]
__ module/_cppyy/test [10 done in total, somefailed=False] ____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items
======================== no tests ran in 0.01 seconds =========================
++ 03:40:27 starting module/_csv/test [14 started in total]
__ module/_codecs/test [11 done in total, somefailed=True] ____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 98 items
module\_codecs\test\apptest_codecs.py ..
module\_codecs\test\test_codecs.py ...........................................................................F......s......
module\_codecs\test\test_locale.py FFF...
module\_codecs\test\test_ztranslation.py .
================================== FAILURES ===================================
_____________________ AppTestPartialEvaluation.test_mbcs ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001e7d02ef050>
def test_mbcs(self):
import sys
if sys.platform != 'win32':
return
# sanity test
from _codecs import mbcs_encode, mbcs_decode
toencode = u'caf\xe9', 'caf\xe9'
try:
# test for non-latin1 codepage, more general test needed
import winreg
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,
r'System\CurrentControlSet\Control\Nls\CodePage')
if winreg.QueryValueEx(key, 'ACP')[0] == u'1255': # non-latin1
toencode = u'caf\xbf',b'caf\xbf'
except:
assert False, 'cannot test mbcs on this windows system, check code page'
assert u'test'.encode('mbcs') == b'test'
> assert toencode[0].encode('mbcs') == toencode[1]
E (application-level) AssertionError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_codecs\test\test_codecs.py:1380]:19: AssertionError
_____________________ TestLocaleCodec.test_encode_locale ______________________
self = <pypy.module._codecs.test.test_locale.TestLocaleCodec object at 0x000001e7d728c8a8>
def test_encode_locale(self):
self.setlocale("en_US.UTF-8")
for locale_encoder in (utf8_encode_locale_surrogateescape,
utf8_encode_locale_strict):
for val in u'foo', u' 日本', u'\U0001320C':
utf8 = val.encode('utf-8')
encoded = locale_encoder(utf8, len(val))
> assert encoded.decode('utf8') == val
E assert u'\u320c' == u'\U0001320c'
E - \u320c
E + \U0001320c
module\_codecs\test\test_locale.py:45: AssertionError
_______________ TestLocaleCodec.test_encode_locale_errorhandler _______________
self = <pypy.module._codecs.test.test_locale.TestLocaleCodec object at 0x000001e7d7080090>
def test_encode_locale_errorhandler(self):
self.setlocale("en_US.UTF-8")
locale_encoder = utf8_encode_locale_surrogateescape
utf8_encoder = self.getencoder('utf-8')
encode_error_handler = self.getstate().encode_error_handler
for val in u'foo\udc80bar', u'\udcff\U0001320C':
s = val.encode('utf8')
w_s = self.space.newtext(s)
expected = utf8_encoder(self.space, s, w_s, 'surrogateescape',
encode_error_handler)
utf8 = val.encode('utf-8')
> assert locale_encoder(utf8, len(val)) == expected
E assert '\xff\xe3\x88\x8c' == '\xff\xf0\x93\x88\x8c'
E - \xff\xe3\x88\x8c
E ? ^
E + \xff\xf0\x93\x88\x8c
E ? ^^^^^
module\_codecs\test\test_locale.py:58: AssertionError
_____________________ TestLocaleCodec.test_decode_locale ______________________
self = <pypy.module._codecs.test.test_locale.TestLocaleCodec object at 0x000001e7d5c74e20>
def test_decode_locale(self):
self.setlocale("en_US.UTF-8")
utf8_decoder = self.getdecoder('utf-8')
for locale_decoder in (str_decode_locale_surrogateescape,
str_decode_locale_strict):
for val in 'foo', ' \xe6\x97\xa5\xe6\x9c\xac', '\xf0\x93\x88\x8c':
w_s = self.space.newbytes(val)
assert (locale_decoder(val) ==
utf8_decoder(self.space, val, w_s, 'strict',
> True, None)[:2])
E assert ('\xef\xbf\xbd', 1) == ('\xf0\x93\x88\x8c', 1)
E At index 0 diff: '\xef\xbf\xbd' != '\xf0\x93\x88\x8c'
E Use -v to get the full diff
module\_codecs\test\test_locale.py:69: AssertionError
=========================== short test summary info ===========================
FAIL module\_codecs\test\test_codecs.py::AppTestPartialEvaluation::()::test_mbcs
FAIL module\_codecs\test\test_locale.py::TestLocaleCodec::()::test_encode_locale
FAIL module\_codecs\test\test_locale.py::TestLocaleCodec::()::test_encode_locale_errorhandler
FAIL module\_codecs\test\test_locale.py::TestLocaleCodec::()::test_decode_locale
============== 4 failed, 93 passed, 1 skipped in 202.70 seconds ===============
++ 03:40:28 starting module/_demo/test [15 started in total]
__ module/_continuation/test [12 done in total, somefailed=False] _____________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 32 items / 3 skipped
module\_continuation\test\test_generator.py ssss
module\_continuation\test\test_greenlet.py s.ssssss.sssssssssssssss.sss
=================== 3 passed, 32 skipped in 116.33 seconds ====================
++ 03:41:10 starting module/_hpy_universal/test/_vendored [16 started in total]
__ module/_demo/test [13 done in total, somefailed=False] _____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 38.79 seconds ==========================
++ 03:41:14 starting module/_hpy_universal/test/pypy [17 started in total]
__ module/_csv/test [14 done in total, somefailed=False] ______________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 .............
module\_csv\test\test_writer.py ......
module\_csv\test\test_ztranslation.py .
========================= 34 passed in 93.93 seconds ==========================
++ 03:42:04 starting module/_io/test [18 started in total]
__ module/_hpy_universal/test/_vendored [15 done in total, somefailed=False] __
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
('warning: setuptools.command.build does not exist in setuptools', '44.1.1', 'on', '2.7.18 (0d4dcfdded47, Oct 09 2024, 22:30:52)\n[PyPy 7.3.18-alpha0 with MSC v.1929 64 bit (AMD64)]')argparse.c
buildvalue.c
format.c
helpers.c
structseq.c
Microsoft (R) Library Manager Version 14.41.34123.0
Copyright (C) Microsoft Corporation. All rights reserved.
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items
======================== no tests ran in 0.01 seconds =========================
++ 03:42:24 starting module/_jitlog/test [19 started in total]
__ module/_hpy_universal/test/pypy [16 done in total, somefailed=False] _______
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
('warning: setuptools.command.build does not exist in setuptools', '44.1.1', 'on', '2.7.18 (0d4dcfdded47, Oct 09 2024, 22:30:52)\n[PyPy 7.3.18-alpha0 with MSC v.1929 64 bit (AMD64)]')argparse.c
buildvalue.c
format.c
helpers.c
structseq.c
Microsoft (R) Library Manager Version 14.41.34123.0
Copyright (C) Microsoft Corporation. All rights reserved.
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items
======================== no tests ran in 0.01 seconds =========================
++ 03:42:35 starting module/_locale/test [20 started in total]
__ module/_jitlog/test [17 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module\_jitlog\test\test__jitlog.py s
========================= 1 skipped in 86.17 seconds ==========================
++ 03:43:53 starting module/_lsprof/test [21 started in total]
__ module/_locale/test [18 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 15 items
module\_locale\test\test_locale.py .......ss.ss.s.
=================== 10 passed, 5 skipped in 164.43 seconds ====================
++ 03:45:24 starting module/_md5/test [22 started in total]
__ module/_lsprof/test [19 done in total, somefailed=True] ____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module\_lsprof\test\test_cprofile.py .F..F.
================================== FAILURES ===================================
________________________ AppTestCProfile.test_builtins ________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001fb7d7b0170>
def test_builtins(self):
import _lsprof
prof = _lsprof.Profiler()
lst = []
prof.enable()
lst.append(len(lst))
prof.disable()
stats = prof.getstats()
expected = (
"<built-in method builtins.len>",
"<method 'append' of 'list' objects>",
"<method 'disable' of '_lsprof.Profiler' objects>",
)
for entry in stats:
> assert entry.code in expected
E (application-level) AssertionError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_lsprof\test\test_cprofile.py:13]:15: AssertionError
____________________ AppTestCProfile.test_scale_of_result _____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001fb7d7b0170>
def test_scale_of_result(self):
import _lsprof, time
prof = _lsprof.Profiler()
def foo(n):
t = time.time()
while abs(t - time.time()) < 1.0:
pass # busy-wait for 1 second
def bar(n):
foo(n)
prof.enable()
bar(0)
prof.disable()
stats = prof.getstats()
entries = {}
for entry in stats:
entries[entry.code] = entry
efoo = entries[foo.__code__]
ebar = entries[bar.__code__]
> assert 0.9 < efoo.totaltime < 2.9
E (application-level) AssertionError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_lsprof\test\test_cprofile.py:130]:19: AssertionError
=========================== short test summary info ===========================
FAIL module\_lsprof\test\test_cprofile.py::AppTestCProfile::()::test_builtins
FAIL module\_lsprof\test\test_cprofile.py::AppTestCProfile::()::test_scale_of_result
==================== 2 failed, 4 passed in 132.69 seconds =====================
++ 03:46:13 starting module/_minimal_curses/test [23 started in total]
__ module/_md5/test [20 done in total, somefailed=False] ______________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 8 items
module\_md5\test\test_md5.py ........
========================== 8 passed in 61.90 seconds ==========================
++ 03:46:32 starting module/_multibytecodec/test [24 started in total]
__ module/_io/test [21 done in total, somefailed=True] ________________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 299 items
module\_io\test\apptest_bufferedio.py .
module\_io\test\apptest_bytesio.py .................
module\_io\test\apptest_io.py .......................F.....F..........F..
module\_io\test\apptest_stringio.py ...........................
module\_io\test\apptest_textio.py ..............................s.................
module\_io\test\test_bufferedio.py .....................ss......................ss........................ss................................
module\_io\test\test_fileio.py ..................s.................
module\_io\test\test_interp_textio.py ......FF.
module\_io\test\test_win32consoleio.py ......s......
================================== FAILURES ===================================
________________________________ test_telling _________________________________
tempfile = W_UnicodeObject('d:\\systemtemp\\pytest\\pytest-of-matti\\pytest-517\\tempfile')
def test_telling(tempfile):
with _io.open(tempfile, "w+", encoding="utf8") as f:
p0 = f.tell()
f.write("\xff\n")
p1 = f.tell()
f.write("\xff\n")
p2 = f.tell()
f.seek(0)
assert p0 == 0
> assert p1 == 3
E (application-level) AssertionError: assert 4 == 3
module\_io\test\apptest_io.py:287: AssertionError
____________________________ test_warn_on_dealloc _____________________________
tempfile = W_UnicodeObject('d:\\systemtemp\\pytest\\pytest-of-matti\\pytest-523\\tempfile')
def test_warn_on_dealloc(tempfile):
> _check_warn_on_dealloc(tempfile, 'wb', buffering=0)
module\_io\test\apptest_io.py:376:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = W_TupleObject(W_UnicodeObject('d:\\systemtemp\\pytest\\pytest-of-matti\\pytest-523\\tempfile'), W_UnicodeObject('wb'))
kwargs = W_DictObject(<pypy.objspace.std.kwargsdict.KwargsDictStrategy object at 0x0000022bc22df670>)
gc = <pypy.module.gc.moduledef.Module object at 0x0000022bc0d409c0>
warnings = <pypy.interpreter.module.Module object at 0x0000022bbf3024b8>
f = <pypy.objspace.std.noneobject.W_NoneObject object at 0x0000022bbefc2988>
r = W_UnicodeObject("<_io.FileIO name='d:\\\\systemtemp\\\\pytest\\\\pytest-of-matti\\\\pytest-523\\\\tempfile' mode='wb' closefd=True>")
w = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x0000...reter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000022bcb077b40>])
@py_assert2 = <pypy.objspace.std.noneobject.W_NoneObject object at 0x0000022bbefc2988>
@py_assert5 = W_UnicodeObject('{message : ResourceWarning("unclosed file <_io.FileIO name=\'...\pypy\\\\module\\\\_io\\\\test\\\\apptest_io.py\', lineno : 371, line : None}')
@py_assert4 = <pypy.objspace.std.noneobject.W_NoneObject object at 0x0000022bbefc2988>
@py_format7 = W_UnicodeObject('"<_io.FileIO name=\'d:\\\\\\\\systemtemp\\\\\\\\pytest\\\\\\\...ne : None}\' = str(<warnings.WarningMessage object at 0x0000022bcb077b40>)\n}')
@py_format9 = W_UnicodeObject('assert "<_io.FileIO name=\'d:\\\\\\\\systemtemp\\\\\\\\pytest...ne : None}\' = str(<warnings.WarningMessage object at 0x0000022bcb077b40>)\n}')
def _check_warn_on_dealloc(*args, **kwargs):
import gc
import warnings
f = open(*args, **kwargs)
r = repr(f)
gc.collect()
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
f = None
gc.collect()
assert len(w) == 1, len(w)
> assert r in str(w[0])
E (application-level) AssertionError: assert "<_io.FileIO name='d:\\\\systemtemp\\\\pytest\\\\pytest-of-matti\\\\pytest-523\\\\tempfile' mode='wb' closefd=True>" in '{message : ResourceWarning("unclosed file <_io.FileIO name=\'d:\\\\\\\\systemtemp\\\\\\\\pytest\\\\\\\\pytest-of-matti\\\\\\\\pytest-523\\\\\\\\tempfile\' mode=\'wb\' closefd=True>"), category : \'ResourceWarning\', filename : \'d:\\\\pypy_stuff\\\\buildbot64\\\\slave\\\\own-win-x86-64\\\\build\\\\pypy\\\\module\\\\_io\\\\test\\\\apptest_io.py\', lineno : 371, line : None}'
E + where '{message : ResourceWarning("unclosed file <_io.FileIO name=\'d:\\\\\\\\systemtemp\\\\\\\\pytest\\\\\\\\pytest-of-matti\\\\\\\\pytest-523\\\\\\\\tempfile\' mode=\'wb\' closefd=True>"), category : \'ResourceWarning\', filename : \'d:\\\\pypy_stuff\\\\buildbot64\\\\slave\\\\own-win-x86-64\\\\build\\\\pypy\\\\module\\\\_io\\\\test\\\\apptest_io.py\', lineno : 371, line : None}' = str(<warnings.WarningMessage object at 0x0000022bcb077b40>)
module\_io\test\apptest_io.py:373: AssertionError
___________________________ test_tell_univnewlines ____________________________
tempfile = W_UnicodeObject('d:\\systemtemp\\pytest\\pytest-of-matti\\pytest-532\\tempfile')
def test_tell_univnewlines(tempfile):
import io
import sys
NEWLINE = '\r\n'
with io.open(tempfile, "w") as fp:
fp.write(DATA_CRLF)
with io.open(tempfile, "r") as fp:
assert repr(fp.newlines) == repr(None)
data = fp.readline()
pos = fp.tell()
if "__pypy__" in sys.modules:
> assert repr(fp.newlines) == repr(NEWLINE)
E (application-level) AssertionError: assert "'\\r'" == "'\\r\\n'"
E + where "'\\r'" = repr('\r')
E + where '\r' = <_io.TextIOWrapper name='d:\\systemtemp\\pytest\\pytest-of-matti\\pytest-532\\tempfile' mode='r' encoding='utf-8'>.newlines
E + and "'\\r\\n'" = repr('\r\n')
module\_io\test\apptest_io.py:559: AssertionError
__________________________________ test_tell __________________________________
space = StdObjSpace
@given(content=st_readline(characters=st.characters(blacklist_categories='C')))
> def test_tell(space, content):
module\_io\test\test_interp_textio.py:147:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\virt_test\site-packages\hypothesis\core.py:563: in execute
result = self.test_runner(data, run)
..\virt_test\site-packages\hypothesis\executors.py:56: in default_new_style_executor
return function(data)
..\virt_test\site-packages\hypothesis\core.py:561: in run
return test(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, content = (u'\n', [0, -1])
@given(content=st_readline(characters=st.characters(blacklist_categories='C')))
def test_tell(space, content):
txt, limits = content
restxt = translate_newlines(txt)
resstr = restxt.encode('utf-8')
for read_chars_before_seeking in range(len(restxt)):
w_stream = W_BytesIO(space)
w_stream.descr_init(space, space.newbytes(txt.encode('utf-8')))
w_textio = W_TextIOWrapper(space)
w_textio.descr_init(
space, w_stream,
encoding='utf-8'
)
w_res1 = w_textio.read_w(space, space.newint(read_chars_before_seeking))
assert space.len_w(w_res1) <= read_chars_before_seeking
w_tell = w_textio.tell_w(space)
w_textio.seek_w(space, space.newint(0)) # seek to beginning
w_textio.seek_w(space, w_tell) # then back to position
w_res2 = w_textio.read_w(space)
w_res = space.add(w_res1, w_res2)
res = space.text_w(w_res)
> assert res == resstr
E assert '\n' == '\r\n'
E -
E + \r
module\_io\test\test_interp_textio.py:170: AssertionError
--------------------------------- Hypothesis ----------------------------------
Falsifying example: test_tell(space=StdObjSpace, content=(u'\n', [0, -1]))
___________________________ test_getstate_setstate ____________________________
space = StdObjSpace
@given(content=st_readline(characters=st.characters(blacklist_categories='C')))
> def test_getstate_setstate(space, content):
module\_io\test\test_interp_textio.py:173:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\virt_test\site-packages\hypothesis\core.py:563: in execute
result = self.test_runner(data, run)
..\virt_test\site-packages\hypothesis\executors.py:56: in default_new_style_executor
return function(data)
..\virt_test\site-packages\hypothesis\core.py:561: in run
return test(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, content = (u'\n', [0, -1])
@given(content=st_readline(characters=st.characters(blacklist_categories='C')))
def test_getstate_setstate(space, content):
txt, limits = content
restxt = translate_newlines(txt)
for read_chars_before_getstate in range(len(restxt)):
w_stream = W_BytesIO(space)
w_stream.descr_init(space, space.newbytes(txt.encode('utf-8')))
w_textio = W_TextIOWrapper(space)
w_textio.descr_init(
space, w_stream,
encoding='utf-8'
)
w_state_start = w_textio.w_decoder.getstate_w(space)
w_res1 = w_textio.read_w(space, space.newint(read_chars_before_getstate))
w_current_state = w_textio.w_decoder.getstate_w(space)
w_textio.w_decoder.setstate_w(space, w_state_start)
w_textio.w_decoder.setstate_w(space, w_current_state)
w_res2 = w_textio.read_w(space)
w_res = space.add(w_res1, w_res2)
res = space.text_w(w_res).decode("utf-8")
> assert res == restxt
E assert u'\n' == u'\r\n'
module\_io\test\test_interp_textio.py:194: AssertionError
--------------------------------- Hypothesis ----------------------------------
Falsifying example: test_getstate_setstate(space=StdObjSpace, content=(u'\n', [0, -1]))
=========================== short test summary info ===========================
FAIL module\_io\test\apptest_io.py::test_telling
FAIL module\_io\test\apptest_io.py::test_warn_on_dealloc
FAIL module\_io\test\apptest_io.py::test_tell_univnewlines
FAIL module\_io\test\test_interp_textio.py::test_tell
FAIL module\_io\test\test_interp_textio.py::test_getstate_setstate
============== 5 failed, 285 passed, 9 skipped in 276.43 seconds ==============
++ 03:46:42 starting module/_multiprocessing/test [25 started in total]
__ module/_minimal_curses/test [22 done in total, somefailed=False] ___________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
module\_minimal_curses\test\test_curses.py ssssss
========================= 6 skipped in 31.80 seconds ==========================
++ 03:46:47 starting module/_opcode/test [26 started in total]
__ module/_opcode/test [23 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 5 items
module\_opcode\test\apptest_opcode.py .....
========================== 5 passed in 40.87 seconds ==========================
++ 03:47:32 starting module/_pickle/test [27 started in total]
__ module/_multibytecodec/test [24 done in total, somefailed=True] ____________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 67 items
module\_multibytecodec\test\apptest_codecs.py ...................
module\_multibytecodec\test\apptest_incremental.py ...................F
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
================================== FAILURES ===================================
_________________________ test_incremental_big5hkscs __________________________
def test_incremental_big5hkscs():
import _codecs
import _io
with open(myfile + '/big5hkscs.txt', 'rb') as fid:
uni_str = fid.read()
with open(myfile + '/big5hkscs-utf8.txt', 'rb') as fid:
utf8str = fid.read()
UTF8Reader = _codecs.lookup('utf-8').streamreader
for sizehint in [None] + list(range(1, 33)) + [64, 128, 256, 512, 1024]:
istream = UTF8Reader(_io.BytesIO(utf8str))
ostream = _io.BytesIO()
encoder = IncrementalBig5hkscsEncoder()
while 1:
if sizehint is not None:
data = istream.read(sizehint)
else:
data = istream.read()
if not data:
break
> e = encoder.encode(data)
E (application-level) UnicodeEncodeError: 'big5hkscs' codec can't encode character '\U0002010c' in position 0: illegal multibyte sequence
module\_multibytecodec\test\apptest_incremental.py:270: UnicodeEncodeError
=========================== short test summary info ===========================
FAIL module\_multibytecodec\test\apptest_incremental.py::test_incremental_big5hkscs
=============== 1 failed, 64 passed, 2 skipped in 80.42 seconds ===============
++ 03:48:00 starting module/_pickle_support/test [28 started in total]
__ module/_pickle_support/test [25 done in total, somefailed=False] ___________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 1 items
module\_pickle_support\test\apptest__pickle_support.py .
========================== 1 passed in 47.79 seconds ==========================
++ 03:48:52 starting module/_posixsubprocess/test [29 started in total]
__ module/_multiprocessing/test [26 done in total, somefailed=True] ___________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 12 items
module\_multiprocessing\test\test_interp_semaphore.py s
module\_multiprocessing\test\test_semaphore.py s........E
module\_multiprocessing\test\test_win32.py .
module\_multiprocessing\test\test_ztranslation.py .
=================================== ERRORS ====================================
____________ ERROR at teardown of AppTestSemaphore.test_in_threads ____________
self = <CallInfo when='teardown' exception: {
array [ '%', 'L', 'E', '\x00' ]:
...
File "d:\pypy_stuff\buildbot64\slav...bot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\ctypefunc.py", line 523, in rawallocate
flavor='raw')
}>
func = <function <lambda> at 0x00000235c3034b60>, when = 'teardown'
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_teardown'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_in_threads'>, 'nextitem': <AppT...s, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_in_threads'>, 'nextitem': <AppTestMethod 'test_closesocket'>}
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 0x00000235b7891478>
hook = <_HookCaller 'pytest_runtest_teardown'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_in_threads'>, 'nextitem': <AppT...s, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_in_threads'>, 'nextitem': <AppTestMethod 'test_closesocket'>}
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_teardown'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_in_threads'>, 'nextitem': <AppT...s, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_in_threads'>, 'nextitem': <AppTestMethod 'test_closesocket'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
..\_pytest\vendored_packages\pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_in_threads'>, 'nextitem': <AppTestMethod 'test_closesocket'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
..\_pytest\vendored_packages\pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_teardown at 0x00000235be1a7bc8>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...losesocket'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
..\_pytest\vendored_packages\pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x00000235c0c25ea0>
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 0x00000235c0c25ea0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...losesocket'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_in_threads'>, 'nextitem': <AppTestMethod 'test_closesocket'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
..\_pytest\vendored_packages\pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.conftest.LeakFinder instance at 0x00000235b9156220>
item = <AppTestMethod 'test_in_threads'>
@pytest.hookimpl(trylast=True)
def pytest_runtest_teardown(self, item):
if not isinstance(item, py.test.collect.Function):
return
if (not getattr(item.obj, 'dont_track_allocations', False)
and leakfinder.TRACK_ALLOCATIONS):
kwds = {}
try:
kwds['do_collection'] = item.track_allocations_collect
except AttributeError:
pass
item._pypytest_leaks = leakfinder.stop_tracking_allocations(False,
**kwds)
else: # stop_tracking_allocations() already called
item._pypytest_leaks = None
# check for leaks, but only if the test passed so far
if getattr(item, '_success', False) and item._pypytest_leaks:
> raise leakfinder.MallocMismatch(item._pypytest_leaks)
E MallocMismatch: {
E
E array [ '%', 'L', 'E', '\x00' ]:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdataobj.py", line 13, in <module>
E from pypy.module._cffi_backend import misc
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\misc.py", line 125, in <module>
E FORMAT_LONGDOUBLE = rffi.str2charp("%LE")
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py", line 821, in str2charp
E array = lltype.malloc(TYPEP.TO, len(s) + 1, flavor='raw', track_allocation=True)
E
E <C object Struct cffi_ctxobj { ctx, info } at 0x235b8ad9af0>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\ffi_obj.py", line 738, in make_plain_ffi_object
E r.__init__(space, src_ctx)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\ffi_obj.py", line 59, in __init__
E self.ctxobj = parse_c_type.allocate_ctxobj(src_ctx)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\parse_c_type.py", line 71, in allocate_ctxobj
E p = lltype.malloc(CTXOBJ, flavor='raw', zero=True)
E
E <C object Array of Char {'nolength': True} at 0x235c2a2d8b0>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 131, in ffiobj_init
E ntypes = allocate_array(ffi, _CFFI_OPCODE_T, n)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 109, in allocate_array
E p = allocate(ffi, nitems * nbytes)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 102, in allocate
E p = lltype.malloc(rffi.CCHARP.TO, nbytes, flavor='raw', zero=True)
E
E <C object Array of Char {'nolength': True} at 0x235bfcee0c0>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\ffi_obj.py", line 191, in descr_init
E w__typenames, w__includes)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 146, in ffiobj_init
E p = allocate(ffi, size)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 102, in allocate
E p = lltype.malloc(rffi.CCHARP.TO, nbytes, flavor='raw', zero=True)
E
E <C object Array of Char {'nolength': True} at 0x235b7cd2480>:
E <C object Array of Char {'nolength': True} at 0x235b7cd21c0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1dc0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2500>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1fc0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2160>:
E <C object Array of Char {'nolength': True} at 0x235b7cd22c0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2400>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1f60>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1ec0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2260>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2080>:
E <C object Array of Char {'nolength': True} at 0x235b7cd24a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd23a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd21e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1f20>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2280>:
E <C object Array of Char {'nolength': True} at 0x235b7cd20a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd22e0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fcbb0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd24c0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd20e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd24e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2020>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1e00>:
E <C object Array of Char {'nolength': True} at 0x235b7cd20c0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2180>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1f80>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2200>:
E <C object Array of Char {'nolength': True} at 0x235b89a0fa0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1d20>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2000>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1e60>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2140>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1d60>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1f00>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3ba0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3b60>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3c00>:
E <C object Array of Char {'nolength': True} at 0x235b89a1060>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3bc0>:
E <C object Array of Char {'nolength': True} at 0x235b89a1000>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3be0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3540>:
E <C object Array of Char {'nolength': True} at 0x235b89a10f0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3d60>:
E <C object Array of Char {'nolength': True} at 0x235b7cd44a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3d40>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3ee0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4ce0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd47a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4820>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4bc0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4860>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4b00>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4be0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd48a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd45c0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4640>:
E <C object Array of Char {'nolength': True} at 0x235bb6fcea0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5100>:
E <C object Array of Char {'nolength': True} at 0x235bb6fd790>:
E <C object Array of Char {'nolength': True} at 0x235b7cd53a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4de0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5000>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4fc0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5160>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5460>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4da0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5220>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5120>:
E <C object Array of Char {'nolength': True} at 0x235b7cd54a0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fda10>:
E <C object Array of Char {'nolength': True} at 0x235bb6fdcb0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fcd70>:
E <C object Array of Char {'nolength': True} at 0x235b7cd53c0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fdd80>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4dc0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd51a0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fd940>:
E <C object Array of Char {'nolength': True} at 0x235bb6fdc00>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5360>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5040>:
E <C object Array of Char {'nolength': True} at 0x235b7cd50c0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fdec0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5020>:
E <C object Array of Char {'nolength': True} at 0x235bb6fd7e0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fdc40>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 153, in ffiobj_init
E nglobs[i].c_name = decoder.next_name()
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 92, in next_name
E p = rffi.str2charp(self.string[frm : i])
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py", line 821, in str2charp
E array = lltype.malloc(TYPEP.TO, len(s) + 1, flavor='raw', track_allocation=True)
E
E <C object Array of Char {'nolength': True} at 0x235badc3230>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 174, in ffiobj_init
E nstructs = allocate_array(ffi, STRUCT_UNION_S, n)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 109, in allocate_array
E p = allocate(ffi, nitems * nbytes)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 102, in allocate
E p = lltype.malloc(rffi.CCHARP.TO, nbytes, flavor='raw', zero=True)
E
E <C object Array of Char {'nolength': True} at 0x235bbddcc70>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 175, in ffiobj_init
E nfields = allocate_array(ffi, FIELD_S, nftot)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 109, in allocate_array
E p = allocate(ffi, nitems * nbytes)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 102, in allocate
E p = lltype.malloc(rffi.CCHARP.TO, nbytes, flavor='raw', zero=True)
E
E <C object Array of Char {'nolength': True} at 0x235bae0c600>:
E <C object Array of Char {'nolength': True} at 0x235bae0c210>:
E <C object Array of Char {'nolength': True} at 0x235bae0cb70>:
E <C object Array of Char {'nolength': True} at 0x235bae0cce0>:
E <C object Array of Char {'nolength': True} at 0x235bae0c980>:
E <C object Array of Char {'nolength': True} at 0x235bae0c370>:
E <C object Array of Char {'nolength': True} at 0x235bae0c120>:
E <C object Array of Char {'nolength': True} at 0x235bae0c7a0>:
E <C object Array of Char {'nolength': True} at 0x235bae0c380>:
E <C object Array of Char {'nolength': True} at 0x235bae0cef0>:
E <C object Array of Char {'nolength': True} at 0x235bae0d350>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5420>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4ee0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4f20>:
E <C object Array of Char {'nolength': True} at 0x235bae0d220>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5600>:
E <C object Array of Char {'nolength': True} at 0x235bb6fe0e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5ac0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd59c0>:
E <C object Array of Char {'nolength': True} at 0x235b89a15d0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5ae0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5960>:
E <C object Array of Char {'nolength': True} at 0x235b7cd57a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5900>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5840>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5b20>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5660>:
E <C object Array of Char {'nolength': True} at 0x235b89a10c0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fe420>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5b60>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5720>:
E <C object Array of Char {'nolength': True} at 0x235b7cd35a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd40e0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fe8e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4ac0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4920>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4e80>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 185, in ffiobj_init
E nstructs[i].c_name = decoder.next_name()
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 92, in next_name
E p = rffi.str2charp(self.string[frm : i])
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py", line 821, in str2charp
E array = lltype.malloc(TYPEP.TO, len(s) + 1, flavor='raw', track_allocation=True)
E
E <C object Array of Char {'nolength': True} at 0x235b7cd50a0>:
E <C object Array of Char {'nolength': True} at 0x235bae0c4b0>:
E <C object Array of Char {'nolength': True} at 0x235bae0c590>:
E <C object Array of Char {'nolength': True} at 0x235bae0c870>:
E <C object Array of Char {'nolength': True} at 0x235bae0c2d0>:
E <C object Array of Char {'nolength': True} at 0x235bae0c710>:
E <C object Array of Char {'nolength': True} at 0x235bae0c790>:
E <C object Array of Char {'nolength': True} at 0x235bae0c860>:
E <C object Array of Char {'nolength': True} at 0x235bae0c240>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5240>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5380>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4f40>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5260>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5180>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5280>:
E <C object Array of Char {'nolength': True} at 0x235b7cd52c0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd50e0>:
E <C object Array of Char {'nolength': True} at 0x235bae0ce90>:
E <C object Array of Char {'nolength': True} at 0x235bae0c400>:
E <C object Array of Char {'nolength': True} at 0x235bae0ccd0>:
E <C object Array of Char {'nolength': True} at 0x235bae0d130>:
E <C object Array of Char {'nolength': True} at 0x235bae0c350>:
E <C object Array of Char {'nolength': True} at 0x235bae0cb90>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4e00>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4e20>:
E <C object Array of Char {'nolength': True} at 0x235bae0c270>:
E <C object Array of Char {'nolength': True} at 0x235bae0cf20>:
E <C object Array of Char {'nolength': True} at 0x235bae0d400>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5060>:
E <C object Array of Char {'nolength': True} at 0x235bae0d5f0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5340>:
E <C object Array of Char {'nolength': True} at 0x235b7cd52e0>:
E <C object Array of Char {'nolength': True} at 0x235bae0d250>:
E <C object Array of Char {'nolength': True} at 0x235bae0c130>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5320>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5140>:
E <C object Array of Char {'nolength': True} at 0x235bae0c1e0>:
E <C object Array of Char {'nolength': True} at 0x235bae0cfe0>:
E <C object Array of Char {'nolength': True} at 0x235bae0d770>:
E <C object Array of Char {'nolength': True} at 0x235bae0dba0>:
E <C object Array of Char {'nolength': True} at 0x235bae0c420>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5300>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5440>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5480>:
E <C object Array of Char {'nolength': True} at 0x235bae0d300>:
E <C object Array of Char {'nolength': True} at 0x235b7cd54e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd53e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4d20>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4d60>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4f80>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5760>:
E <C object Array of Char {'nolength': True} at 0x235bae0d910>:
E <C object Array of Char {'nolength': True} at 0x235bae0ddf0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5740>:
E <C object Array of Char {'nolength': True} at 0x235bb6fd840>:
E <C object Array of Char {'nolength': True} at 0x235bb6fe1d0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fe560>:
E <C object Array of Char {'nolength': True} at 0x235bb6fcf30>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5540>:
E <C object Array of Char {'nolength': True} at 0x235bb6fd3f0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd59e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5a80>:
E <C object Array of Char {'nolength': True} at 0x235b7cd55c0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5780>:
E <C object Array of Char {'nolength': True} at 0x235bb6fdd10>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5920>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5aa0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5b00>:
E <C object Array of Char {'nolength': True} at 0x235b7cd56c0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5560>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5c40>:
E <C object Array of Char {'nolength': True} at 0x235bb6fe830>:
E <C object Array of Char {'nolength': True} at 0x235bb6fd4e0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fe0d0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd59a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5a60>:
E <C object Array of Char {'nolength': True} at 0x235b7cd55e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5c60>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5700>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5a00>:
E <C object Array of Char {'nolength': True} at 0x235b7cd58c0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd57c0>:
E <C object Array of Char {'nolength': True} at 0x235bb6febe0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5860>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5680>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5a40>:
E <C object Array of Char {'nolength': True} at 0x235b7cd57e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd56a0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fec50>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5b40>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5640>:
E <C object Array of Char {'nolength': True} at 0x235bb6fee70>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5520>:
E <C object Array of Char {'nolength': True} at 0x235bb6ff5a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5bc0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fd980>:
E <C object Array of Char {'nolength': True} at 0x235bb6ff160>:
E <C object Array of Char {'nolength': True} at 0x235bb6ff5e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5a20>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5800>:
E <C object Array of Char {'nolength': True} at 0x235b7cd56e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5b80>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5ba0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5c00>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5820>:
E <C object Array of Char {'nolength': True} at 0x235b7cd58a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5c20>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5940>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1fe0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd21a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1d80>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2060>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2340>:
E <C object Array of Char {'nolength': True} at 0x235b7cd1da0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2040>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2220>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2440>:
E <C object Array of Char {'nolength': True} at 0x235b7cd2300>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3ca0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3c20>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3660>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3fa0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3d80>:
E <C object Array of Char {'nolength': True} at 0x235bb6feb60>:
E <C object Array of Char {'nolength': True} at 0x235b7cd44e0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3fe0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4060>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4500>:
E <C object Array of Char {'nolength': True} at 0x235bb6fdaf0>:
E <C object Array of Char {'nolength': True} at 0x235bb6ffa10>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4540>:
E <C object Array of Char {'nolength': True} at 0x235bb6ff8b0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4ae0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4900>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4a60>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4fa0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd4e40>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5580>:
E <C object Array of Char {'nolength': True} at 0x235b7cd55a0>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5be0>:
E <C object Array of Char {'nolength': True} at 0x235bb6fdf70>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 209, in ffiobj_init
E nfields[nf].c_name = decoder.next_name()
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 92, in next_name
E p = rffi.str2charp(self.string[frm : i])
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py", line 821, in str2charp
E array = lltype.malloc(TYPEP.TO, len(s) + 1, flavor='raw', track_allocation=True)
E
E <C object Array of Char {'nolength': True} at 0x235c0889cb0>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 235, in ffiobj_init
E ntypenames = allocate_array(ffi, TYPENAME_S, n)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 109, in allocate_array
E p = allocate(ffi, nitems * nbytes)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 102, in allocate
E p = lltype.malloc(rffi.CCHARP.TO, nbytes, flavor='raw', zero=True)
E
E <C object Array of Char {'nolength': True} at 0x235b7cd1f40>:
E <C object Array of Char {'nolength': True} at 0x235b7cd44c0>:
E <C object Array of Char {'nolength': True} at 0x235b9119850>:
E <C object Array of Char {'nolength': True} at 0x235b7cd5620>:
E <C object Array of Char {'nolength': True} at 0x235b7cd3580>:
E <C object Array of Char {'nolength': True} at 0x235b7cd48c0>:
E <C object Array of Char {'nolength': True} at 0x235b6678610>:
E <C object Array of Char {'nolength': True} at 0x235b911a520>:
E <C object Array of Char {'nolength': True} at 0x235b66e38c0>:
E <C object Array of Char {'nolength': True} at 0x235b9119c40>:
E <C object Array of Char {'nolength': True} at 0x235b66e3b40>:
E <C object Array of Char {'nolength': True} at 0x235b66e3b20>:
E <C object Array of Char {'nolength': True} at 0x235b66e37c0>:
E <C object Array of Char {'nolength': True} at 0x235b66e3d60>:
E <C object Array of Char {'nolength': True} at 0x235b66e3ee0>:
E <C object Array of Char {'nolength': True} at 0x235b9119cf0>:
E <C object Array of Char {'nolength': True} at 0x235b66e3ac0>:
E <C object Array of Char {'nolength': True} at 0x235b89a1990>:
E <C object Array of Char {'nolength': True} at 0x235b66e3a60>:
E <C object Array of Char {'nolength': True} at 0x235b66e3d80>:
E <C object Array of Char {'nolength': True} at 0x235b9119ad0>:
E <C object Array of Char {'nolength': True} at 0x235b66e3c60>:
E <C object Array of Char {'nolength': True} at 0x235b66e3d00>:
E <C object Array of Char {'nolength': True} at 0x235b66e3be0>:
E <C object Array of Char {'nolength': True} at 0x235b66e3de0>:
E <C object Array of Char {'nolength': True} at 0x235b66e3b60>:
E <C object Array of Char {'nolength': True} at 0x235b66e3fa0>:
E <C object Array of Char {'nolength': True} at 0x235b66e3860>:
E <C object Array of Char {'nolength': True} at 0x235b89a18a0>:
E <C object Array of Char {'nolength': True} at 0x235b66e3880>:
E <C object Array of Char {'nolength': True} at 0x235b66e3d20>:
E <C object Array of Char {'nolength': True} at 0x235b89a18d0>:
E <C object Array of Char {'nolength': True} at 0x235b66e39a0>:
E <C object Array of Char {'nolength': True} at 0x235b66e3e60>:
E <C object Array of Char {'nolength': True} at 0x235b66e3900>:
E <C object Array of Char {'nolength': True} at 0x235b9119f20>:
E <C object Array of Char {'nolength': True} at 0x235b66e3c20>:
E <C object Array of Char {'nolength': True} at 0x235b66e3a40>:
E <C object Array of Char {'nolength': True} at 0x235b9119c60>:
E <C object Array of Char {'nolength': True} at 0x235b89a11e0>:
E <C object Array of Char {'nolength': True} at 0x235b66e3940>:
E <C object Array of Char {'nolength': True} at 0x235b66e3ae0>:
E <C object Array of Char {'nolength': True} at 0x235b66e37e0>:
E <C object Array of Char {'nolength': True} at 0x235b66e3840>:
E <C object Array of Char {'nolength': True} at 0x235b66e4420>:
E <C object Array of Char {'nolength': True} at 0x235b66e4080>:
E <C object Array of Char {'nolength': True} at 0x235b66e4600>:
E <C object Array of Char {'nolength': True} at 0x235b66e4140>:
E <C object Array of Char {'nolength': True} at 0x235b66e47a0>:
E <C object Array of Char {'nolength': True} at 0x235b9119b10>:
E <C object Array of Char {'nolength': True} at 0x235b66e43c0>:
E <C object Array of Char {'nolength': True} at 0x235b66e4220>:
E <C object Array of Char {'nolength': True} at 0x235b66e4780>:
E <C object Array of Char {'nolength': True} at 0x235b66e42e0>:
E <C object Array of Char {'nolength': True} at 0x235b66e4620>:
E <C object Array of Char {'nolength': True} at 0x235b66e4460>:
E <C object Array of Char {'nolength': True} at 0x235b9119e60>:
E <C object Array of Char {'nolength': True} at 0x235b66e40c0>:
E <C object Array of Char {'nolength': True} at 0x235b66e4660>:
E <C object Array of Char {'nolength': True} at 0x235b66e4740>:
E <C object Array of Char {'nolength': True} at 0x235b66e41c0>:
E <C object Array of Char {'nolength': True} at 0x235b89a1090>:
E <C object Array of Char {'nolength': True} at 0x235b911b3b0>:
E <C object Array of Char {'nolength': True} at 0x235b66e4100>:
E <C object Array of Char {'nolength': True} at 0x235b66e4160>:
E <C object Array of Char {'nolength': True} at 0x235b911ab50>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 239, in ffiobj_init
E ntypenames[i].c_name = decoder.next_name()
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 92, in next_name
E p = rffi.str2charp(self.string[frm : i])
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py", line 821, in str2charp
E array = lltype.malloc(TYPEP.TO, len(s) + 1, flavor='raw', track_allocation=True)
E
E <C object Struct CIF_DESCRIPTION { cif, abi, nargs, rtype, atypes, exchange_size, exchange_result, exchange_args } at 0x235c016be00>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\newtype.py", line 752, in _build_function_type
E fct = ctypefunc.W_CTypeFunc(space, fargs, fresult, ellipsis, abi)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\ctypefunc.py", line 53, in __init__
E builder.rawallocate(self)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\ctypefunc.py", line 523, in rawallocate
E flavor='raw')
E }
..\rpython\conftest.py:103: MallocMismatch
=============== 10 passed, 2 skipped, 1 error in 204.05 seconds ===============
++ 03:50:07 starting module/_pypyjson/test [30 started in total]
__ module/_posixsubprocess/test [27 done in total, somefailed=True] ___________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 0 items / 2 errors
=================================== ERRORS ====================================
__ ERROR collecting pypy/module/_posixsubprocess/test/apptest_subprocess.py ___
tool\pytest\apptest2.py:25: in collect
space = objspace.gettestobjspace(**spaceconfig)
tool\pytest\objspace.py:24: in gettestobjspace
space = maketestobjspace(config)
tool\pytest\objspace.py:34: in maketestobjspace
space = make_objspace(config)
tool\option.py:33: in make_objspace
return StdObjSpace(config)
interpreter\baseobjspace.py:458: in __init__
self.initialize()
objspace\std\objspace.py:115: in initialize
self.make_builtins()
interpreter\baseobjspace.py:666: in make_builtins
self.install_mixedmodule(mixedname)
interpreter\baseobjspace.py:707: in install_mixedmodule
self.setbuiltinmodule(mixedname)
interpreter\baseobjspace.py:544: in setbuiltinmodule
mod = Module(self, self.newtext(name))
interpreter\mixedmodule.py:27: in __init__
self.__class__.buildloaders()
module\fcntl\moduledef.py:17: in buildloaders
from pypy.module.fcntl import interp_fcntl
module\fcntl\interp_fcntl.py:44: in <module>
for k, v in platform.configure(CConfig).items():
..\rpython\rtyper\tool\rffi_platform.py:216: in configure
for name, result in zip(entries, results):
..\rpython\rtyper\tool\rffi_platform.py:241: in configure_entries
writer.path, eci, ignore_errors=ignore_errors))
..\rpython\rtyper\tool\rffi_platform.py:745: in run_example_code
output = build_executable_cache(files, eci, ignore_errors=ignore_errors)
..\rpython\tool\gcc_cache.py:28: in build_executable_cache
result = platform.execute(platform.compile(c_files, eci))
..\rpython\translator\platform\__init__.py:57: in compile
ofiles = self._compile_o_files(cfiles, eci, standalone)
..\rpython\translator\platform\__init__.py:79: in _compile_o_files
ofiles.append(self._compile_c_file(self.cc, cfile, compile_args))
..\rpython\translator\platform\windows.py:290: in _compile_c_file
self._execute_c_compiler(cc, args, oname)
..\rpython\translator\platform\__init__.py:143: in _execute_c_compiler
self._handle_error(returncode, stdout, stderr, outname)
..\rpython\translator\platform\windows.py:319: in _handle_error
raise CompilationError(stdout, stderr)
E CompilationError: CompilationError(err="""
E platcheck_64.c
E d:\systemtemp\pytest\usession-py3.11-319\platcheck_64.c(93): fatal error C1083: Cannot open include file: 'sys/file.h': No such file or directory
E """)
------------------------------- Captured stderr -------------------------------
[platform:Error] platcheck_64.c
[platform:Error] d:\systemtemp\pytest\usession-py3.11-319\platcheck_64.c(93): fatal error C1083: Cannot open include file: 'sys/file.h': No such file or directory
___ ERROR collecting pypy/module/_posixsubprocess/test/test_ztranslation.py ___
..\py\_path\local.py:650: in pyimport
__import__(modname)
module\_posixsubprocess\test\__init__.py:5: in <module>
pytest.skip("not on windows", allow_module_level=True)
E TypeError: skip() got an unexpected keyword argument 'allow_module_level'
========================== 2 error in 77.88 seconds ===========================
++ 03:50:15 starting module/_random/test [31 started in total]
__ module/_pickle/test [28 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 96 items
module\_pickle\test\apptest_optional_frames.py ..
module\_pickle\test\apptest_pickle.py ...............................................................s...
module\_pickle\test\apptest_pypy_extensions.py ...........................
=================== 95 passed, 1 skipped in 163.74 seconds ====================
++ 03:50:20 starting module/_rawffi/alt/test [32 started in total]
__ module/_random/test [29 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 52.51 seconds ==========================
++ 03:51:15 starting module/_rawffi/test [33 started in total]
__ module/_pypyjson/test [30 done in total, somefailed=False] _________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 55 items
module\_pypyjson\test\apptest__pypyjson.py ........
module\_pypyjson\test\test__pypyjson.py ............................................
module\_pypyjson\test\test_simd.py ...
========================= 55 passed in 79.47 seconds ==========================
++ 03:51:28 starting module/_socket/test [34 started in total]
__ module/_rawffi/alt/test [31 done in total, somefailed=False] _______________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 ..s..............................ss.ss....
module\_rawffi\alt\test\test_struct.py ...............
module\_rawffi\alt\test\test_type_converter.py ...........
==================== 68 passed, 5 skipped in 68.56 seconds ====================
++ 03:51:35 starting module/_sre/test [35 started in total]
__ module/_rawffi/test [32 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 84 items
module\_rawffi\test\apptest_rawffi.py .
module\_rawffi\test\test__rawffi.py .................s.................................s.................
module\_rawffi\test\test_exit.py s
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 165.54 seconds ====================
n: 2
Arg 0: 3
Arg 1: 15
++ 03:54:04 starting module/_vmprof/test [36 started in total]
__ module/_vmprof/test [33 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items
======================== no tests ran in 0.00 seconds =========================
++ 03:54:07 starting module/_warnings/test [37 started in total]
__ module/_sre/test [34 done in total, somefailed=False] ______________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 160 items
module\_sre\test\apptest_sre.py ..................................................................
module\_sre\test\test_app_sre.py ..................................................................
module\_sre\test\test_sre_buf.py ............................
======================== 160 passed in 174.07 seconds =========================
++ 03:54:32 starting module/_weakref/test [38 started in total]
__ module/_socket/test [35 done in total, somefailed=True] ____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 87 items
module\_socket\test\apptest_socket.py ..........ss.............F..s.....s...s.ss..s...s....s...sssss
module\_socket\test\test_sock_app.py .......s.........ss.s...
module\_socket\test\test_ztranslation.py .
================================== FAILURES ===================================
___________________________ test_recvmsg_issue2649 ____________________________
@pytest.mark.skipif(sys.platform == 'win32', reason="no recvmsg on win32")
@pytest.mark.skipif(sys.platform == 'darwin', reason="no MSG_ERRQUEUE on macos")
def test_recvmsg_issue2649():
import _socket as socket
listener = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
listener.bind(('127.0.0.1', 1234))
s = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
s.sendto(b'x', ('127.0.0.1', 1234))
> with pytest.raises(BlockingIOError):
queue = s.recvmsg(1024, 1024, socket.MSG_ERRQUEUE)
E (application-level) AssertionError: raises() expected <class 'BlockingIOError'>, but got <class 'AttributeError'>
module\_socket\test\apptest_socket.py:334: AssertionError
=========================== short test summary info ===========================
FAIL module\_socket\test\apptest_socket.py::test_recvmsg_issue2649
============== 1 failed, 67 passed, 19 skipped in 216.15 seconds ==============
++ 03:55:08 starting module/_winreg/test [39 started in total]
__ module/_warnings/test [36 done in total, somefailed=False] _________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 17 items
module\_warnings\test\apptest_warnings.py ........s.s.....
module\_warnings\test\test_warnings.py .
==================== 15 passed, 2 skipped in 95.94 seconds ====================
++ 03:55:52 starting module/array/test [40 started in total]
__ module/_winreg/test [37 done in total, somefailed=True] ____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 22 items
module\_winreg\test\test_winreg.py ..F...........s..ss...
================================== FAILURES ===================================
________________________ AppTestFfi.test_simple_write _________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000026f950d8368>
def test_simple_write(self):
from winreg import SetValue, QueryValue, REG_SZ
value = u"Some Default value"
SetValue(self.root_key, self.test_key_name, REG_SZ, value)
> assert QueryValue(self.root_key, self.test_key_name) == value
E (application-level) AssertionError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_winreg\test\test_winreg.py:76]:5: AssertionError
=========================== short test summary info ===========================
FAIL module\_winreg\test\test_winreg.py::AppTestFfi::()::test_simple_write
=============== 1 failed, 18 passed, 3 skipped in 39.08 seconds ===============
++ 03:55:54 starting module/atexit/test [41 started in total]
__ module/_cffi_backend/test [38 done in total, somefailed=True] ______________
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 467 items
module\_cffi_backend\test\test_c.py s.....................s........................................................ssss.s....................................................s.....s...................sss...........................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 .................s..
module\_cffi_backend\test\test_recompiler.py ..........F..................F...........................................................s..s............ssss..s.s.ss.......
module\_cffi_backend\test\test_unicode_literals.py .......
module\_cffi_backend\test\test_wchar_helper.py .
module\_cffi_backend\test\test_ztranslation.py s
================================== FAILURES ===================================
__________________ AppTestRecompiler.test_macro_check_value ___________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000021d71637b08>
def test_macro_check_value(self):
# the value '-0x80000000' in C sources does not have a clear meaning
# to me; it appears to have a different effect than '-2147483648'...
# Moreover, on 32-bits, -2147483648 is actually equal to
# -2147483648U, which in turn is equal to 2147483648U and so positive.
import sys
vals = ['42', '-42', '0x80000000', '-2147483648',
'0', '9223372036854775809ULL',
'-9223372036854775807LL']
if sys.maxsize <= 2**32:
vals.remove('-2147483648')
cdef_lines = ['#define FOO_%d_%d %s' % (i, j, vals[i])
for i in range(len(vals))
for j in range(len(vals))]
verify_lines = ['#define FOO_%d_%d %s' % (i, j, vals[j]) # [j], not [i]
for i in range(len(vals))
for j in range(len(vals))]
ffi, lib = self.prepare(
'\n'.join(cdef_lines),
'test_macro_check_value_ok',
'\n'.join(verify_lines))
for j in range(len(vals)):
c_got = int(vals[j].replace('U', '').replace('L', ''), 0)
c_compiler_msg = str(c_got)
if c_got > 0:
c_compiler_msg += ' (0x%x)' % (c_got,)
#
for i in range(len(vals)):
attrname = 'FOO_%d_%d' % (i, j)
if i == j:
x = getattr(lib, attrname)
assert x == c_got
else:
> e = raises(ffi.error, getattr, lib, attrname)
E (application-level) AssertionError: DID NOT RAISE
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\test\test_recompiler.py:237]:38: AssertionError
---------------------------- Captured stdout call -----------------------------
generating d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c
_CFFI_test_macro_check_value_ok.c
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(658): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(659): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(721): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(722): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(784): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(785): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(822): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(831): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(840): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(847): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(848): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(849): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(858): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(867): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(876): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(910): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(911): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(973): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(974): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(1036): warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.c(1037): warning C4146: unary minus operator applied to unsigned type, result still unsigned
Creating library d:\systemtemp\pytest\usession-py3.11-300\recompiler\Release\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.pypy-73.lib and object d:\systemtemp\pytest\usession-py3.11-300\recompiler\Release\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_macro_check_value_ok.pypy-73.exp
Generating code
Finished generating code
__________ AppTestRecompiler.test_verify_anonymous_enum_with_typedef __________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000021d71637b08>
def test_verify_anonymous_enum_with_typedef(self):
ffi, lib = self.prepare(
"typedef enum { AA, ... } e1;",
'test_verify_anonymous_enum_with_typedef1',
"typedef enum { BB, CC, AA } e1;")
assert lib.AA == 2
assert ffi.sizeof("e1") == ffi.sizeof("int")
assert repr(ffi.cast("e1", 2)) == "<cdata 'e1' 2: AA>"
#
import sys
ffi, lib = self.prepare(
"typedef enum { AA=%d } e1;" % sys.maxsize,
'test_verify_anonymous_enum_with_typedef2',
"typedef enum { AA=%d } e1;" % sys.maxsize)
> assert lib.AA == sys.maxsize
E (application-level) AssertionError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\test\test_recompiler.py:512]:15: AssertionError
---------------------------- Captured stdout call -----------------------------
generating d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_verify_anonymous_enum_with_typedef1.c
_CFFI_test_verify_anonymous_enum_with_typedef1.c
Creating library d:\systemtemp\pytest\usession-py3.11-300\recompiler\Release\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_verify_anonymous_enum_with_typedef1.pypy-73.lib and object d:\systemtemp\pytest\usession-py3.11-300\recompiler\Release\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_verify_anonymous_enum_with_typedef1.pypy-73.exp
Generating code
Finished generating code
generating d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_verify_anonymous_enum_with_typedef2.c
_CFFI_test_verify_anonymous_enum_with_typedef2.c
d:\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_verify_anonymous_enum_with_typedef2.c(573): warning C4309: 'initializing': truncation of constant value
Creating library d:\systemtemp\pytest\usession-py3.11-300\recompiler\Release\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_verify_anonymous_enum_with_typedef2.pypy-73.lib and object d:\systemtemp\pytest\usession-py3.11-300\recompiler\Release\systemtemp\pytest\usession-py3.11-300\recompiler\_CFFI_test_verify_anonymous_enum_with_typedef2.pypy-73.exp
Generating code
Finished generating code
=========================== short test summary info ===========================
FAIL module\_cffi_backend\test\test_recompiler.py::AppTestRecompiler::()::test_macro_check_value
FAIL module\_cffi_backend\test\test_recompiler.py::AppTestRecompiler::()::test_verify_anonymous_enum_with_typedef
============= 2 failed, 436 passed, 29 skipped in 1139.40 seconds =============
++ 03:56:05 starting module/binascii/test [42 started in total]
__ module/_weakref/test [39 done in total, somefailed=False] __________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 43 items
module\_weakref\test\apptest_weakref.py ...........................................
========================= 43 passed in 109.80 seconds =========================
++ 03:56:30 starting module/bz2/test [43 started in total]
__ module/atexit/test [40 done in total, somefailed=False] ____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 2 items
module\atexit\test\apptest_atexit.py ..
========================== 2 passed in 55.55 seconds ==========================
++ 03:56:54 starting module/cmath/test [44 started in total]
__ module/binascii/test [41 done in total, somefailed=False] __________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 18 items
module\binascii\test\test_binascii.py ..................
========================= 18 passed in 65.79 seconds ==========================
++ 03:57:12 starting module/cpyext/test/test_api.py [45 started in total]
__ module/bz2/test [42 done in total, somefailed=False] _______________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 1 items / 3 skipped
module\bz2\test\test_large.py s
========================= 4 skipped in 63.92 seconds ==========================
++ 03:57:38 starting module/cpyext/test/test_arraymodule.py [46 started in total]
__ module/cmath/test [43 done in total, somefailed=False] _____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 18 items
module\cmath\test\test_cmath.py ..................
========================= 18 passed in 45.80 seconds ==========================
++ 03:57:47 starting module/cpyext/test/test_async_iter.py [47 started in total]
__ module/array/test [44 done in total, somefailed=True] ______________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 64 items
module\array\test\apptest_array.py ...
module\array\test\test_array.py .....................s..................s................F..
module\array\test\test_ztranslation.py .
================================== FAILURES ===================================
___________________ AppTestArrayReconstructor.test_unicode ____________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000017b7d788480>
def test_unicode(self):
import array
array_reconstructor = array._array_reconstructor
UTF16_LE = 18
UTF16_BE = 19
UTF32_LE = 20
UTF32_BE = 21
teststr = "Bonne Journ\xe9e \U0002030a\U00020347"
testcases = (
(UTF16_LE, "UTF-16-LE"),
(UTF16_BE, "UTF-16-BE"),
(UTF32_LE, "UTF-32-LE"),
(UTF32_BE, "UTF-32-BE")
)
for testcase in testcases:
mformat_code, encoding = testcase
a = array.array('u', teststr)
b = array_reconstructor(
array.array, 'u', mformat_code, teststr.encode(encoding))
> assert a == b
E (application-level) AssertionError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\array\test\test_array.py:1272]:20: AssertionError
=========================== short test summary info ===========================
FAIL module\array\test\test_array.py::AppTestArrayReconstructor::()::test_unicode
============== 1 failed, 61 passed, 2 skipped in 179.38 seconds ===============
++ 03:58:55 starting module/cpyext/test/test_boolobject.py [48 started in total]
__ module/cpyext/test/test_api.py [45 done in total, somefailed=False] ________
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 4 items
module\cpyext\test\test_api.py ....
========================== 4 passed in 73.53 seconds ==========================
++ 03:59:17 starting module/cpyext/test/test_borrow.py [49 started in total]
__ module/cpyext/test/test_async_iter.py [46 done in total, somefailed=False] _
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 73.10 seconds ==========================
++ 03:59:44 starting module/cpyext/test/test_buffer.py [50 started in total]
__ module/cpyext/test/test_arraymodule.py [47 done in total, somefailed=False]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 176.63 seconds ====================
++ 04:01:25 starting module/cpyext/test/test_bytearrayobject.py [51 started in total]
__ module/cpyext/test/test_boolobject.py [48 done in total, somefailed=False] _
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 4 items
module\cpyext\test\test_boolobject.py ....
========================= 4 passed in 131.08 seconds ==========================
++ 04:01:58 starting module/cpyext/test/test_bytesobject.py [52 started in total]
__ module/cpyext/test/test_borrow.py [49 done in total, somefailed=False] _____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module\cpyext\test\test_borrow.py ...
========================= 3 passed in 147.50 seconds ==========================
++ 04:02:28 starting module/cpyext/test/test_capsule.py [53 started in total]
__ module/cpyext/test/test_buffer.py [50 done in total, somefailed=False] _____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 5 items
module\cpyext\test\test_buffer.py .....
========================= 5 passed in 166.03 seconds ==========================
++ 04:03:09 starting module/cpyext/test/test_cell.py [54 started in total]
__ module/cpyext/test/test_bytearrayobject.py [51 done in total, somefailed=True]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module\cpyext\test\test_bytearrayobject.py EEEEEE
=================================== ERRORS ====================================
______________ ERROR at setup of AppTestStringObject.test_basic _______________
self = <CallInfo when='setup' exception: CompilationError(out="""
""")>
func = <function <lambda> at 0x000002342dac0020>, when = 'setup'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
..\_pytest\runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
..\_pytest\runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_setup'>
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_basic'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_basic'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
..\_pytest\vendored_packages\pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x0000023426593440>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_basic'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_basic'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
..\_pytest\vendored_packages\pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_basic'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_basic'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
..\_pytest\vendored_packages\pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_basic'>, '__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 0x000002342c2125e8>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...test_basic'>, '__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 0x000002342d6c8020>
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 0x000002342d6c8020>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...test_basic'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_basic'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
..\_pytest\vendored_packages\pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_basic'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
..\_pytest\runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_basic'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
py.builtin._reraise(*col._prepare_exc)
for col in needed_collectors[len(self.stack):]:
self.stack.append(col)
try:
> col.setup()
..\_pytest\runner.py:408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
> super(AppClassCollector, self).setup()
tool\pytest\apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
setup_class = xunitsetup(self.obj, 'setup_class')
if setup_class is not None:
setup_class = getattr(setup_class, 'im_func', setup_class)
setup_class = getattr(setup_class, '__func__', setup_class)
> setup_class(self.obj)
..\_pytest\python.py:671:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'pypy.module.cpyext.test.test_bytearrayobject.AppTestStringObject'>
def setup_class(cls):
space = cls.space
cls.w_here = space.wrap(str(HERE))
cls.w_udir = space.wrap(str(udir))
cls.w_runappdirect = space.wrap(cls.runappdirect)
if not cls.runappdirect:
cls.sys_info = get_cpyext_info(space)
cls.w_debug_collect = space.wrap(interp2app(debug_collect))
cls.preload_builtins(space)
# Flush stdout once here to pre-create any file lock objects
# before we start counting allocations (moved from setup_method).
> space.call_method(space.sys.get("stdout"), "flush")
module\cpyext\test\test_cpyext.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
name = 'stdout'
def get(self, name):
space = self.space
> w_value = self.getdictvalue(space, name)
interpreter\mixedmodule.py:86:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
def getdictvalue(self, space, name):
w_value = space.finditem_str(self.w_dict, name)
if self.lazy and w_value is None:
> return self._load_lazily(space, name)
interpreter\mixedmodule.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
def _load_lazily(self, space, name):
w_name = space.new_interned_str(name)
try:
loader = self.loaders[name]
except KeyError:
return None
else:
> w_value = loader(space)
interpreter\mixedmodule.py:119:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
def afileloader(space):
> return app.wget(space, attrname)
interpreter\mixedmodule.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace, name = 'stdout'
def wget(self, space, name):
> w_globals = self.getwdict(space)
interpreter\gateway.py:1393:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
def getwdict(self, space):
> return space.fromcache(ApplevelCache).getorbuild(self)
interpreter\gateway.py:1386:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def getorbuild(self, key):
if lock: lock.acquire()
try:
try:
return self.content[key]
except KeyError:
if key in self._building:
raise RuntimeError("%s recursive building of %r" %
(self, key))
self._building[key] = True
try:
> result = self._build(key)
..\rpython\rlib\cache.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def _build(self, key):
> return self.build(key)
interpreter\baseobjspace.py:400:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
app = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
@not_rpython
def build(self, app):
"Called indirectly by Applevel.getwdict()."
> return build_applevel_dict(app, self.space)
interpreter\gateway.py:1437:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
@not_rpython
def build_applevel_dict(self, space):
w_glob = space.newdict(module=True)
space.setitem(w_glob, space.newtext('__name__'), space.newtext(self.modname))
space.exec_(self.source, w_glob, w_glob,
hidden_applevel=self.hidden_applevel,
> filename=self.filename)
interpreter\gateway.py:1448:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
statement = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
hidden_applevel = True
filename = 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'
@not_rpython
def exec_(self, statement, w_globals, w_locals, hidden_applevel=False,
filename=None):
"For internal debugging."
if filename is None:
filename = '?'
from pypy.interpreter.pycode import PyCode
if isinstance(statement, str):
statement = self._cached_compile(filename, statement, 'exec', 0, hidden_applevel)
if not isinstance(statement, PyCode):
raise TypeError('space.exec_(): expected a string, code or PyCode object')
w_key = self.newtext('__builtins__')
if not self.contains_w(w_globals, w_key):
self.setitem(w_globals, w_key, self.builtin)
> return statement.exec_code(self, w_globals, w_locals)
interpreter\baseobjspace.py:1408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
space = StdObjSpace
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_closure = None
def exec_code(self, space, w_globals, w_locals, w_closure=None):
"Implements the 'exec' statement."
# this should be on PyCode?
frame = space.createframe(self, w_globals, w_closure)
frame.setdictscope(w_locals, skip_free_vars=w_closure is not None)
> return frame.run()
interpreter\eval.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
name = None, qualname = None
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
pycode = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 24L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
self.CALL_METHOD(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD_KW.index:
> self.CALL_METHOD_KW(oparg, next_instr)
interpreter\pyopcode.py:315:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
n_arguments = 2, ignored = (24L,)
W_AbstractTupleObject = <class 'pypy.objspace.std.tupleobject.W_AbstractTupleObject'>
w_self = None, space = StdObjSpace
@jit.unroll_safe
def CALL_METHOD_KW(f, n_arguments, *ignored):
from pypy.objspace.std.tupleobject import W_AbstractTupleObject
# opargs contains the arg + kwarg count, excluding the implicit 'self'
w_self = f.peekvalue_maybe_none(n_arguments + 1)
space = f.space
# like in BUILD_CONST_KEY_MAP we can't use space.fixedview because then
# the immutability of the tuple is lost
w_tup_varnames = space.interp_w(W_AbstractTupleObject, f.popvalue())
n_keywords = space.len_w(w_tup_varnames)
keyword_names_w = [None] * n_keywords
keywords_w = [None] * n_keywords
for i in range(n_keywords):
keyword_names_w[i] = w_tup_varnames.getitem(space, i)
w_value = f.peekvalue(n_keywords - 1 - i)
keywords_w[i] = w_value
f.dropvalues(n_keywords)
n_arguments -= n_keywords
n = n_arguments + (w_self is not None)
arguments = f.popvalues(n) # includes w_self if it is not None
if w_self is None:
f.popvalue_maybe_none() # removes w_self, which is None
w_callable = f.popvalue()
args = f.argument_factory(
arguments, keyword_names_w, keywords_w, None, None,
methodcall=w_self is not None, w_function=w_callable)
if f.get_is_being_profiled() and function.is_builtin_code(w_callable):
w_result = f.space.call_args_and_c_profile(f, w_callable, args)
else:
> w_result = f.space.call_args(w_callable, args)
objspace\std\callmethod.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_text_int_text_or_none_text_or_none_text_or_none_int_W_Root object at 0x000002342f57f558>
space = StdObjSpace
scope_w = [W_IntObject(0), W_UnicodeObject('r'), W_IntObject(-1), W_UnicodeObject('utf-8'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, ...]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], space.text_w(scope_w[1]), space.gateway_int_w(scope_w[2]), space.text_or_none_w(scope_w[3]), space.text_or_none_w(scope_w[4]), space.text_or_none_w(scope_w[5]), space.gateway_int_w(scope_w[6]), scope_w[7])
<2604-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = 8192
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
space.newbool(bool(closefd)), w_opener)
else:
w_raw = W_FileIO(space)
w_raw.descr_init(space, w_file, rawmode, bool(closefd), w_opener)
w_result = w_raw
isatty = space.is_true(space.call_method(w_raw, "isatty"))
line_buffering = buffering == 1 or (buffering < 0 and isatty)
if line_buffering:
buffering = -1
if buffering < 0:
buffering = space.c_int_w(space.getattr(
w_raw, space.newtext("_blksize")))
if buffering < 0:
raise oefmt(space.w_ValueError, "invalid buffering size")
if buffering == 0:
if not binary:
raise oefmt(space.w_ValueError,
"can't have unbuffered text I/O")
return w_result
if updating:
w_buffer = W_BufferedRandom(space)
w_buffer.descr_init(space, w_raw, buffering)
elif writing or creating or appending:
w_buffer = W_BufferedWriter(space)
w_buffer.descr_init(space, w_raw, buffering)
elif reading:
w_buffer = W_BufferedReader(space)
w_buffer.descr_init(space, w_raw, buffering)
else:
raise oefmt(space.w_ValueError, "unknown mode: '%s'", mode)
w_result = w_buffer
if binary:
return w_result
w_wrapper = W_TextIOWrapper(space)
w_wrapper.descr_init(space, w_buffer, encoding,
space.newtext_or_none(errors),
space.newtext_or_none(newline),
> line_buffering)
module\_io\interp_io.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
space = StdObjSpace
w_buffer = <pypy.module._io.interp_bufferedio.W_BufferedReader object at 0x000002342f446758>
encoding = 'utf-8', w_errors = W_UnicodeObject('strict')
w_newline = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
line_buffering = True, write_through = 0
@unwrap_spec(encoding="text0_or_none", line_buffering=int, write_through=int)
def descr_init(self, space, w_buffer, encoding=None,
w_errors=None, w_newline=None, line_buffering=0,
write_through=0):
self.state = STATE_ZERO
self.w_buffer = w_buffer
self.w_encoding = w_encoding = _determine_encoding(space, encoding, w_buffer)
if space.is_none(w_errors) or w_errors is None:
w_errors = space.newtext("strict")
if not space.isinstance_w(w_errors, space.w_text):
raise oefmt(space.w_TypeError, "TextIOWrapper() argument 'errors' "
"must be str or None, not %N", w_errors)
io_check_errors(space, w_errors)
self.w_errors = w_errors
newline = unwrap_newline(space, w_newline)
self.line_buffering = bool(line_buffering)
self.write_through = bool(write_through)
self._set_newline(newline)
> self._set_encoder_decoder(w_encoding, w_errors)
module\_io\interp_textio.py:605:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
w_encoding = W_UnicodeObject('utf-8'), w_errors = W_UnicodeObject('strict')
def _set_encoder_decoder(self, w_encoding, w_errors):
space = self.space
w_codec = interp_codecs.lookup_codec(space,
> space.text_w(w_encoding))
module\_io\interp_textio.py:634:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8'
@unwrap_spec(encoding='text0')
def lookup_codec(space, encoding):
"""lookup(encoding) -> (encoder, decoder, stream_reader, stream_writer)
Looks up a codec tuple in the Python codec registry and returns
a tuple of functions.
"""
assert not (space.config.translating and not we_are_translated()), \
"lookup_codec() should not be called during translation"
state = space.fromcache(CodecState)
normalized_encoding = normalize(encoding)
w_result = state.get_codec_from_cache(normalized_encoding)
if w_result is not None:
return w_result
> return _lookup_codec_loop(space, encoding, normalized_encoding)
module\_codecs\interp_codecs.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8', normalized_encoding = 'utf_8'
def _lookup_codec_loop(space, encoding, normalized_encoding):
state = space.fromcache(CodecState)
if state.codec_need_encodings:
# registers new codecs.
# This import uses the "builtin" import method, and is needed
# to bootstrap the full importlib module.
w_import = space.getattr(space.builtin, space.newtext("__import__"))
> space.call_function(w_import, space.newtext("encodings"))
module\_codecs\interp_codecs.py:221:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),), nargs = 1
Function = <class 'pypy.interpreter.function.Function'>
_Method = <class 'pypy.interpreter.function._Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
> return w_func.funccall(*args_w)
interpreter\baseobjspace.py:1237:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),)
gateway = <module 'pypy.interpreter.gateway' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\interpreter\\gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
def funccall(self, *args_w): # speed hack
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
nargs = len(args_w)
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, args_w[0])
elif nargs == 2:
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, args_w[0], args_w[1])
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
return code.fastcall_3(self.space, self, args_w[0],
args_w[1], args_w[2])
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
return code.fastcall_4(self.space, self, args_w[0],
args_w[1], args_w[2], args_w[3])
elif (nargs | PyCode.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
if nargs < 5:
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in funccallunrolling:
if i < nargs:
new_frame.locals_cells_stack_w[i] = args_w[i]
return new_frame.run(self.name, self.qualname)
elif nargs >= 1 and fast_natural_arity == Code.PASSTHROUGHARGS1:
assert isinstance(code, gateway.BuiltinCodePassThroughArguments1)
return code.funcrun_obj(self, args_w[0],
Arguments(self.space,
list(args_w[1:])))
> return self.call_args(Arguments(self.space, list(args_w)))
interpreter\function.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_W_Root_W_Root_W_Root_W_Root object at 0x000002342c151be8>
space = StdObjSpace
scope_w = [W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], scope_w[1], scope_w[2], scope_w[3], scope_w[4])
<2115-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('encodings')
w_globals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_fromlist = W_TupleObject(), w_level = W_IntObject(0)
@unwrap_spec(w_globals=WrappedDefault(None), w_locals=WrappedDefault(None), w_fromlist=WrappedDefault(()),
w_level=WrappedDefault(0))
def interp___import__(space, w_name, w_globals, w_locals, w_fromlist,
w_level):
"""
Import a module. Because this function is meant for use by the Python
interpreter and not for general use, it is better to use
importlib.import_module() to programmatically import a module.
The globals argument is only used to determine the context;
they are not modified. The locals argument is unused. The fromlist
should be a list of names to emulate ``from name import ...'', or an
empty list to emulate ``import name''.
When importing a module from a package, note that __import__('A.B', ...)
returns package A when fromlist is empty, but its submodule B when
fromlist is not empty. The level argument is used to determine whether to
perform absolute or relative imports: 0 is absolute, while a positive number
is the number of parent directories to search relative to the current module."""
level = space.int_w(w_level)
if level == 0:
# fast path only for absolute imports without a "from" list, for now
# fromlist can be supported if we are importing from a module, not a
# package. to check that, look for the existence of __path__ attribute
# in w_mod
try:
name = space.text_w(w_name)
w_mod = _gcd_import(space, name)
have_fromlist = space.is_true(w_fromlist)
if not have_fromlist:
dotindex = name.find(".")
if dotindex < 0:
return w_mod
return _gcd_import(space, name[:dotindex])
except FastPathGiveUp:
pass
else:
assert have_fromlist
w_path = space.findattr(w_mod, space.newtext("__path__"))
if w_path is not None:
# hard case, a package! Call back into importlib
w_importlib = space.getbuiltinmodule('_frozen_importlib')
return space.call_method(w_importlib, "_handle_fromlist",
w_mod, w_fromlist,
space.w_default_importlib_import)
else:
return w_mod
try:
return space.call_function(
space.fromcache(FrozenCache).w_frozen_import, w_name, w_globals, w_locals, w_fromlist,
> w_level)
module\_frozen_importlib\interp_import.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function __import__>
args_w = (W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0))
nargs = 5
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
func = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def funcrun(self, func, args):
frame = self.space.createframe(self, func.w_func_globals,
func)
sig = self._signature
# speed hack
fresh_frame = jit.hint(frame, access_directly=True,
fresh_virtualizable=True)
args.parse_into_scope(None, fresh_frame.locals_cells_stack_w, func.qualname,
sig, func.defs_w, func.w_kw_defs)
fresh_frame.init_cells()
> return frame.run(func.name, func.qualname)
interpreter\pycode.py:280:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
name = '__import__', qualname = '__import__'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
oparg = 1, next_instr = 14L
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
return self._flat_pycall(code, nargs, frame, dropvalues)
elif fast_natural_arity & Code.FLATPYCALL:
natural_arity = fast_natural_arity & 0xff
if natural_arity > nargs >= natural_arity - len(self.defs_w):
assert isinstance(code, PyCode)
return self._flat_pycall_defaults(code, nargs, frame,
> natural_arity - nargs, dropvalues)
interpreter\function.py:193:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
defs_to_load = 2, dropvalues = 2
@jit.unroll_safe
def _flat_pycall_defaults(self, code, nargs, frame, defs_to_load, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
ndefs = len(self.defs_w)
start = ndefs - defs_to_load
i = nargs
for j in xrange(start, ndefs):
new_frame.locals_cells_stack_w[i] = self.defs_w[j]
i += 1
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:231:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
name = '_gcd_import', qualname = '_gcd_import'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 40
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
oparg = 2, next_instr = 40
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
name = '_find_and_load', qualname = '_find_and_load'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 82
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
oparg = 2, next_instr = 82
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>
code = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
name = '_find_and_load_unlocked', qualname = '_find_and_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
pycode = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 216
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
oparg = 1, next_instr = 216
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>
code = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
name = '_load_unlocked', qualname = '_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
pycode = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 132
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
oparg = 1, ignored = (132,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>
code = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
name = 'exec_module', qualname = '_LoaderBasics.exec_module'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
pycode = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 10L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
oparg = 1, ignored = (10L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>
code = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
name = 'get_code', qualname = 'SourceLoader.get_code'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
pycode = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 74L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
oparg = 1, ignored = (74L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>
code = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
name = 'get_data', qualname = 'FileLoader.get_data'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
pycode = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 26L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
oparg = 1, ignored = (26L,), n_args = 1, w_self = None, n = 1
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
> return code.fastcall_1(self.space, self, f_0)
interpreter\function.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
w_result = self.fastfunc_1(space, w1)
except DescrMismatch:
return self._type_unwrap_mismatch(space,
Arguments(space, [w1]))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:982:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
> w_result = self.fastfunc_1(space, w1)
interpreter\gateway.py:977:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
def open_code(space, w_file):
> return open(space, w_file, "rb")
module\_io\interp_io.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
> space.newbool(bool(closefd)), w_opener)
module\_io\interp_io.py:120:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args_w = (W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None)
nargs = 4, Function = <class 'pypy.interpreter.function.Function'>
_Method = <class 'pypy.interpreter.function._Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
return w_obj.call_args(args)
if isinstance(w_obj, Method):
return w_obj.call_args(args)
w_descr = space.lookup(w_obj, '__call__')
if w_descr is None:
raise oefmt(space.w_TypeError,
"'%T' object is not callable", w_obj)
> return space.get_and_call_args(w_descr, w_obj, args)
objspace\descroperation.py:199:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
w_result = self.func__args__(space, w_obj, args)
except DescrMismatch:
return self._type_unwrap_mismatch(space, args.prepend(w_obj))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:941:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
> w_result = self.func__args__(space, w_obj, args)
interpreter\gateway.py:937:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def _call(space, w_obj, args):
self = space.descr_self_interp_w(self_type, w_obj)
> return func(self, space, args)
<282-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:4:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <W_TypeObject '_io.FileIO' at 0x2342f626d78>, space = StdObjSpace
__args__ = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def descr_call(self, space, __args__):
promote(self)
# invoke the __new__ of the type
if not we_are_jitted():
# note that the annotator will figure out that self.w_new_function
# can only be None if the newshortcut config option is not set
w_newfunc = self.w_new_function
else:
# for the JIT it is better to take the slow path because normal lookup
# is nicely optimized, but the self.w_new_function attribute is not
# known to the JIT
w_newfunc = None
if w_newfunc is None:
w_newtype, w_newdescr = self.lookup_where('__new__')
if w_newdescr is None: # see test_crash_mro_without_object_1
raise oefmt(space.w_TypeError, "cannot create '%N' instances",
self)
#
# issue #2666
if space.config.objspace.usemodules.cpyext:
w_newtype, w_newdescr = self.hack_which_new_to_call(
w_newtype, w_newdescr)
#
w_newfunc = space.get(w_newdescr, space.w_None, w_type=self)
if (space.config.objspace.std.newshortcut and
not we_are_jitted() and space._side_effects_ok() and
isinstance(w_newtype, W_TypeObject)):
self.w_new_function = w_newfunc
w_newobject = space.call_obj_args(w_newfunc, self, __args__)
call_init = space.isinstance_w(w_newobject, self)
# maybe invoke the __init__ of the type
if (call_init and not (space.is_w(self, space.w_type) and
not __args__.keyword_names_w and len(__args__.arguments_w) == 1)):
w_descr = space.lookup(w_newobject, '__init__')
if w_descr is not None: # see test_crash_mro_without_object_2
w_result = space.get_and_call_args(w_descr, w_newobject,
> __args__)
objspace\std\typeobject.py:743:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_W_FileIO_ObjSpace_W_Root_text_int_W_Root object at 0x000002342e1b8db0>
space = StdObjSpace
scope_w = [<pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>, W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\s...\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None]
def _run(self, space, scope_w):
> return self.behavior(space.interp_w(W_FileIO, scope_w[0]), space, scope_w[1], space.text_w(scope_w[2]), space.gateway_int_w(scope_w[3]), scope_w[4])
<2459-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'r', closefd = 1, w_opener = None
@unwrap_spec(mode='text', closefd=int)
def descr_init(self, space, w_name, mode='r', closefd=True, w_opener=None):
if self.fd >= 0:
if self.closefd:
self._close(space)
else:
self.fd = -1
if space.isinstance_w(w_name, space.w_float):
raise oefmt(space.w_TypeError,
"integer argument expected, got float")
fd = -1
try:
fd = space.c_int_w(w_name)
except OperationError as e:
pass
else:
if fd < 0:
raise oefmt(space.w_ValueError, "negative file descriptor")
self.readable, self.writable, self.created, self.appending, flags = decode_mode(space, mode)
if rposix.O_CLOEXEC is not None:
flags |= rposix.O_CLOEXEC
fd_is_own = False
try:
if fd >= 0:
self.fd = fd
self.closefd = bool(closefd)
space.audit("open", [space.newint(fd), space.newtext(mode), space.newint(closefd)])
else:
space.audit("open", [w_name, space.newtext(mode), space.newint(1)])
self.closefd = True
if not closefd:
raise oefmt(space.w_ValueError,
"Cannot use closefd=False with file name")
if space.is_none(w_opener):
> self.fd = _open_fd(space, w_name, flags)
module\_io\interp_fileio.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
flags = 32768
def _open_fd(space, w_name, flags):
from pypy.module.posix.interp_posix import dispatch_filename, fspath
w_path = fspath(space, w_name)
while True:
try:
fd = dispatch_filename(rposix.open)(
> space, w_path, flags, 0666)
module\_io\interp_fileio.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_fname = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
args = (32768, 438)
fname = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
@specialize.argtype(1)
def dispatch(space, w_fname, *args):
if allow_fd_fn is not None:
try:
fd = space.c_int_w(w_fname)
except OperationError:
pass
else:
return allow_fd_fn(fd, *args)
if space.isinstance_w(w_fname, space.w_unicode):
fname = FileEncoder(space, w_fname)
> return func(fname, *args)
module\posix\interp_posix.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
flags = 32768, mode = 438
@replace_os_function('open')
@specialize.argtype(0)
@enforceargs(NOT_CONSTANT, int, int, typecheck=False)
def open(path, flags, mode):
if _WIN32:
utf8 = _as_utf80(path)
with rffi.scoped_utf82wcharp(utf8) as buf:
> fd = c_wopen(buf, flags, mode)
..\rpython\rlib\rposix.py:468:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<* DEAD Array of UniChar {'nolength': True} >, 32768, 438)
real_args = (<* DEAD Array of UniChar {'nolength': True} >, 32768L, 438L)
to_free = (), i = 2
def wrapper(*args):
assert len(args) == nb_args
real_args = ()
# XXX 'to_free' leaks if an allocation fails with MemoryError
# and was not the first in this function
to_free = ()
for i, TARGET in unrolling_arg_tps:
arg = args[i]
if TARGET == CCHARP or TARGET is VOIDP:
if arg is None:
from rpython.rtyper.annlowlevel import llstr
arg = lltype.nullptr(CCHARP.TO) # None => (char*)NULL
to_free = to_free + (arg, llstr(None), '\x04')
elif isinstance(arg, str):
tup = get_nonmovingbuffer_ll_final_null(arg)
to_free = to_free + tup
arg = tup[0]
elif isinstance(arg, unicode):
_oops()
elif TARGET == CWCHARP:
if arg is None:
arg = lltype.nullptr(CWCHARP.TO) # None => (wchar_t*)NULL
to_free = to_free + (arg,)
elif isinstance(arg, unicode):
arg = unicode2wcharp(arg)
to_free = to_free + (arg,)
elif _isfunctype(TARGET) and not _isllptr(arg):
# XXX pass additional arguments
use_gil = invoke_around_handlers
arg = llhelper(TARGET, _make_wrapper_for(TARGET, arg,
callbackholder,
use_gil))
else:
SOURCE = lltype.typeOf(arg)
if SOURCE != TARGET:
if TARGET is lltype.Float:
arg = float(arg)
elif ((isinstance(SOURCE, lltype.Number)
or SOURCE is lltype.Bool)
and (isinstance(TARGET, lltype.Number)
or TARGET is lltype.Bool)):
arg = cast(TARGET, arg)
real_args = real_args + (arg,)
> res = call_external_function(*real_args)
..\rpython\rtyper\lltypesystem\rffi.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a0 = <* DEAD Array of UniChar {'nolength': True} >, a1 = 32768L, a2 = 438L
def call_external_function(a0, a1, a2):
rgil.release()
# NB. it is essential that no exception checking occurs here!
if 1:
from rpython.rlib import rposix
rposix._errno_before(1)
if we_are_translated():
res = funcptr(a0, a1, a2)
else:
try: # only when non-translated
res = funcptr(a0, a1, a2)
except:
rgil.acquire()
raise
if 1:
from rpython.rlib import rposix
> rposix._errno_after(1)
<91-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py:217>:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
save_err = 1
@specialize.call_location()
def _errno_after(save_err):
if _WIN32:
if save_err & rffi.RFFI_SAVE_LASTERROR:
err = rwin32._GetLastError()
# careful, setraw() overwrites GetLastError.
# We must read it first, before the errno handling.
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
elif save_err & rffi.RFFI_SAVE_WSALASTERROR:
from rpython.rlib import _rsocket_rffi
err = _rsocket_rffi._WSAGetLastError()
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
if save_err & rffi.RFFI_SAVE_ERRNO:
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_errno.setraw(_get_errno())
else:
> rthread.tlfield_rpy_errno.setraw(_get_errno())
..\rpython\rlib\rposix.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <* fn get_errno>, args = ()
rffi = <module 'rpython.rtyper.lltypesystem.rffi' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\rtyper\\lltypesystem\\rffi.pyc'>
def __call__(self, *args):
from rpython.rtyper.lltypesystem import rffi
if isinstance(self._T, FuncType):
if len(args) != len(self._T.ARGS):
raise TypeError("calling %r with wrong argument number: %r" %
(self._T, args))
for i, a, ARG in zip(range(len(self._T.ARGS)), args, self._T.ARGS):
if typeOf(a) != ARG:
# ARG could be Void
if ARG == Void:
try:
value = getattr(self._obj, '_void' + str(i))
except AttributeError:
pass
else:
assert a == value
# None is acceptable for any pointer
elif isinstance(ARG, Ptr) and a is None:
pass
# Any pointer is convertible to void*
elif ARG is rffi.VOIDP and isinstance(typeOf(a), Ptr):
pass
# special case: ARG can be a container type, in which
# case a should be a pointer to it. This must also be
# special-cased in the backends.
elif (isinstance(ARG, ContainerType) and
typeOf(a) == Ptr(ARG)):
pass
else:
args_repr = [typeOf(arg) for arg in args]
raise TypeError("calling %r with wrong argument "
"types: %r" % (self._T, args_repr))
callb = self._obj._callable
if callb is None:
raise RuntimeError("calling undefined function")
> return callb(*args)
..\rpython\rtyper\lltypesystem\lltype.py:1384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.rtyper.lltypesystem.ll2ctypes.LL2CtypesCallable object at 0x0000023428d928a8>
argvalues = ()
def __call__(self, *argvalues):
with rlock:
if self.trampoline is None:
# lazily build the corresponding ctypes function object
cfunc = get_ctypes_callable(self.funcptr, self.calling_conv,
> self.natural_arity)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1339:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
funcptr = <* fn get_errno>, calling_conv = 'c', natural_arity = -1
def get_ctypes_callable(funcptr, calling_conv, natural_arity):
if not ctypes:
raise ImportError("ctypes is needed to use ll2ctypes")
def get_on_lib(lib, elem):
""" Wrapper to always use lib[func] instead of lib.func
"""
try:
return lib[elem]
except AttributeError:
pass
old_eci = funcptr._obj.compilation_info
funcname = funcptr._obj._name
if hasattr(old_eci, '_with_ctypes'):
old_eci = old_eci._with_ctypes
try:
eci = _eci_cache[old_eci]
except KeyError:
eci = old_eci.compile_shared_lib(ignore_a_files=True,
defines=['RPYTHON_LL2CTYPES'],
> symbolic=True)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1236:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
ignore_a_files = False, debug_mode = True, defines = ['RPYTHON_LL2CTYPES']
symbolic = True
def compile_shared_lib(self, outputfilename=None, ignore_a_files=False,
debug_mode=True, defines=[], symbolic=False):
self = self.convert_sources_to_files()
if ignore_a_files:
if not [fn for fn in self.link_files if fn.endswith('.a')]:
ignore_a_files = False # there are none
if not self.separate_module_files and not ignore_a_files:
return self # xxx there was some condition about win32 here
else:
#basepath = py.path.local(self.separate_module_files[0]).dirpath()
basepath = udir.join('shared_cache')
if outputfilename is None:
# find more or less unique name there
pth = basepath.join('externmod').new(ext=host.so_ext)
num = 0
while pth.check():
pth = basepath.join(
'externmod_%d' % (num,)).new(ext=host.so_ext)
num += 1
basepath.ensure(dir=1)
outputfilename = str(pth.dirpath().join(pth.purebasename))
d = self._copy_attributes()
if ignore_a_files:
d['link_files'] = [fn for fn in d['link_files']
if not fn.endswith('.a')]
if debug_mode and sys.platform != 'win32':
d['compile_extra'] = d['compile_extra'] + ('-g', '-O0')
d['compile_extra'] = d['compile_extra'] + (
'-DRPY_EXTERN=RPY_EXPORTED',)
for define in defines:
d['compile_extra'] += ('-D%s' % define,)
# On ELF platforms (Linux), prevent symbol interposition: when the host
# interpreter (e.g. pypy2.7) also exports symbols like pypysig_counter,
# the shared lib's own references would otherwise resolve to the host's
# copy via the GOT. -Bsymbolic makes the shared lib bind its own global
# symbol references to its own definitions. Only needed when running
# under a host interpreter (tests), not during translation.
if symbolic and sys.platform not in ('win32', 'darwin'):
d['link_extra'] = d['link_extra'] + ('-Wl,-Bsymbolic',)
self = ExternalCompilationInfo(**d)
lib = str(host.compile([], self, outputfilename=outputfilename,
> standalone=False))
..\rpython\translator\tool\cbuild.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cfiles = []
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def compile(self, cfiles, eci, outputfilename=None, standalone=True):
ofiles = self._compile_o_files(cfiles, eci, standalone)
> return self._finish_linking(ofiles, eci, outputfilename, standalone)
..\rpython\translator\platform\__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def _finish_linking(self, ofiles, eci, outputfilename, standalone):
if outputfilename is None:
outputfilename = ofiles[0].purebasename
if ofiles:
dirname = ofiles[0].dirpath()
else:
dirname = udir.join('module_cache')
exe_name = dirname.join(outputfilename, abs=True)
if standalone:
if self.exe_ext:
exe_name += '.' + self.exe_ext
else:
exe_name += '.' + self.so_ext
if eci.use_cpp_linker:
cc_link = 'g++' # XXX hard-coded so far
else:
cc_link = self.cc
largs = self._link_args_from_eci(eci, standalone)
> return self._link(cc_link, ofiles, largs, standalone, exe_name)
..\rpython\translator\platform\__init__.py:235:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'cl.exe'
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
link_args = ['/nologo', '/LARGEADDRESSAWARE', '/STACK:3145728', '/MANIFEST:EMBED', 'kernel32.lib']
standalone = False
exe_name = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _link(self, cc, ofiles, link_args, standalone, exe_name):
args = ['/nologo'] + [str(ofile) for ofile in ofiles] + link_args
args += ['/out:%s' % (exe_name,), '/incremental:no']
if not standalone:
args = self._args_for_shared(args)
# Tell the linker to embed a manifest with the default
# UAC level asInvoker (Visual Studio 2008 +)
args += ["/MANIFEST:EMBED"]
> self._execute_c_compiler(self.link, args, exe_name)
..\rpython\translator\platform\windows.py:303:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'link.exe'
args = ['/dll', '/nologo', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj', '/nologo', '/LARGEADDRESSAWARE', ...]
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
cwd = None
def _execute_c_compiler(self, cc, args, outname, cwd=None):
#log.execute(cc + ' ' + ' '.join(args))
# 'cc' can also contain some options for the C compiler;
# e.g. it can be "gcc -m32". We handle it by splitting on ' '.
cclist = cc.split()
cc = cclist[0]
args = cclist[1:] + args
returncode, stdout, stderr = _run_subprocess(cc, args, self.c_environ,
cwd)
> self._handle_error(returncode, stdout, stderr, outname)
..\rpython\translator\platform\__init__.py:143:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, returncode = 3221225477, stdout = ''
stderr = ''
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _handle_error(self, returncode, stdout, stderr, outname):
if returncode != 0:
# Microsoft compilers write compilation errors to stdout
stderr = stdout + stderr
errorfile = outname.new(ext='errors')
errorfile.write(stderr, mode='wb')
if self.log_errors:
stderrlines = stderr.splitlines()
for line in stderrlines:
log.Error(line)
# ^^^ don't use ERROR, because it might actually be fine.
# Also, ERROR confuses lib-python/conftest.py.
> raise CompilationError(stdout, stderr)
E CompilationError: CompilationError(out="""
E """)
..\rpython\translator\platform\windows.py:319: CompilationError
______ ERROR at setup of AppTestStringObject.test_bytearray_buffer_init _______
self = <CallInfo when='setup' exception: CompilationError(out="""
""")>
func = <function <lambda> at 0x000002343060c110>, when = 'setup'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
..\_pytest\runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
..\_pytest\runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_setup'>
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_buffer_init'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_bytearray_buffer_init'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
..\_pytest\vendored_packages\pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x0000023426593440>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_buffer_init'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_bytearray_buffer_init'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
..\_pytest\vendored_packages\pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_buffer_init'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_bytearray_buffer_init'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
..\_pytest\vendored_packages\pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_buffer_init'>, '__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 0x000002342ff7dce0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...uffer_init'>, '__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 0x0000023434c2f8a0>
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 0x0000023434c2f8a0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...uffer_init'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_buffer_init'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
..\_pytest\vendored_packages\pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_bytearray_buffer_init'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
..\_pytest\runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_bytearray_buffer_init'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
> py.builtin._reraise(*col._prepare_exc)
..\_pytest\runner.py:404:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_basic'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
py.builtin._reraise(*col._prepare_exc)
for col in needed_collectors[len(self.stack):]:
self.stack.append(col)
try:
> col.setup()
..\_pytest\runner.py:408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
> super(AppClassCollector, self).setup()
tool\pytest\apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
setup_class = xunitsetup(self.obj, 'setup_class')
if setup_class is not None:
setup_class = getattr(setup_class, 'im_func', setup_class)
setup_class = getattr(setup_class, '__func__', setup_class)
> setup_class(self.obj)
..\_pytest\python.py:671:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'pypy.module.cpyext.test.test_bytearrayobject.AppTestStringObject'>
def setup_class(cls):
space = cls.space
cls.w_here = space.wrap(str(HERE))
cls.w_udir = space.wrap(str(udir))
cls.w_runappdirect = space.wrap(cls.runappdirect)
if not cls.runappdirect:
cls.sys_info = get_cpyext_info(space)
cls.w_debug_collect = space.wrap(interp2app(debug_collect))
cls.preload_builtins(space)
# Flush stdout once here to pre-create any file lock objects
# before we start counting allocations (moved from setup_method).
> space.call_method(space.sys.get("stdout"), "flush")
module\cpyext\test\test_cpyext.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
name = 'stdout'
def get(self, name):
space = self.space
> w_value = self.getdictvalue(space, name)
interpreter\mixedmodule.py:86:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
def getdictvalue(self, space, name):
w_value = space.finditem_str(self.w_dict, name)
if self.lazy and w_value is None:
> return self._load_lazily(space, name)
interpreter\mixedmodule.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
def _load_lazily(self, space, name):
w_name = space.new_interned_str(name)
try:
loader = self.loaders[name]
except KeyError:
return None
else:
> w_value = loader(space)
interpreter\mixedmodule.py:119:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
def afileloader(space):
> return app.wget(space, attrname)
interpreter\mixedmodule.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace, name = 'stdout'
def wget(self, space, name):
> w_globals = self.getwdict(space)
interpreter\gateway.py:1393:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
def getwdict(self, space):
> return space.fromcache(ApplevelCache).getorbuild(self)
interpreter\gateway.py:1386:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def getorbuild(self, key):
if lock: lock.acquire()
try:
try:
return self.content[key]
except KeyError:
if key in self._building:
raise RuntimeError("%s recursive building of %r" %
(self, key))
self._building[key] = True
try:
> result = self._build(key)
..\rpython\rlib\cache.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def _build(self, key):
> return self.build(key)
interpreter\baseobjspace.py:400:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
app = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
@not_rpython
def build(self, app):
"Called indirectly by Applevel.getwdict()."
> return build_applevel_dict(app, self.space)
interpreter\gateway.py:1437:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
@not_rpython
def build_applevel_dict(self, space):
w_glob = space.newdict(module=True)
space.setitem(w_glob, space.newtext('__name__'), space.newtext(self.modname))
space.exec_(self.source, w_glob, w_glob,
hidden_applevel=self.hidden_applevel,
> filename=self.filename)
interpreter\gateway.py:1448:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
statement = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
hidden_applevel = True
filename = 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'
@not_rpython
def exec_(self, statement, w_globals, w_locals, hidden_applevel=False,
filename=None):
"For internal debugging."
if filename is None:
filename = '?'
from pypy.interpreter.pycode import PyCode
if isinstance(statement, str):
statement = self._cached_compile(filename, statement, 'exec', 0, hidden_applevel)
if not isinstance(statement, PyCode):
raise TypeError('space.exec_(): expected a string, code or PyCode object')
w_key = self.newtext('__builtins__')
if not self.contains_w(w_globals, w_key):
self.setitem(w_globals, w_key, self.builtin)
> return statement.exec_code(self, w_globals, w_locals)
interpreter\baseobjspace.py:1408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
space = StdObjSpace
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_closure = None
def exec_code(self, space, w_globals, w_locals, w_closure=None):
"Implements the 'exec' statement."
# this should be on PyCode?
frame = space.createframe(self, w_globals, w_closure)
frame.setdictscope(w_locals, skip_free_vars=w_closure is not None)
> return frame.run()
interpreter\eval.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
name = None, qualname = None
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
pycode = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 24L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
self.CALL_METHOD(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD_KW.index:
> self.CALL_METHOD_KW(oparg, next_instr)
interpreter\pyopcode.py:315:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
n_arguments = 2, ignored = (24L,)
W_AbstractTupleObject = <class 'pypy.objspace.std.tupleobject.W_AbstractTupleObject'>
w_self = None, space = StdObjSpace
@jit.unroll_safe
def CALL_METHOD_KW(f, n_arguments, *ignored):
from pypy.objspace.std.tupleobject import W_AbstractTupleObject
# opargs contains the arg + kwarg count, excluding the implicit 'self'
w_self = f.peekvalue_maybe_none(n_arguments + 1)
space = f.space
# like in BUILD_CONST_KEY_MAP we can't use space.fixedview because then
# the immutability of the tuple is lost
w_tup_varnames = space.interp_w(W_AbstractTupleObject, f.popvalue())
n_keywords = space.len_w(w_tup_varnames)
keyword_names_w = [None] * n_keywords
keywords_w = [None] * n_keywords
for i in range(n_keywords):
keyword_names_w[i] = w_tup_varnames.getitem(space, i)
w_value = f.peekvalue(n_keywords - 1 - i)
keywords_w[i] = w_value
f.dropvalues(n_keywords)
n_arguments -= n_keywords
n = n_arguments + (w_self is not None)
arguments = f.popvalues(n) # includes w_self if it is not None
if w_self is None:
f.popvalue_maybe_none() # removes w_self, which is None
w_callable = f.popvalue()
args = f.argument_factory(
arguments, keyword_names_w, keywords_w, None, None,
methodcall=w_self is not None, w_function=w_callable)
if f.get_is_being_profiled() and function.is_builtin_code(w_callable):
w_result = f.space.call_args_and_c_profile(f, w_callable, args)
else:
> w_result = f.space.call_args(w_callable, args)
objspace\std\callmethod.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_text_int_text_or_none_text_or_none_text_or_none_int_W_Root object at 0x000002342f57f558>
space = StdObjSpace
scope_w = [W_IntObject(0), W_UnicodeObject('r'), W_IntObject(-1), W_UnicodeObject('utf-8'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, ...]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], space.text_w(scope_w[1]), space.gateway_int_w(scope_w[2]), space.text_or_none_w(scope_w[3]), space.text_or_none_w(scope_w[4]), space.text_or_none_w(scope_w[5]), space.gateway_int_w(scope_w[6]), scope_w[7])
<2604-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = 8192
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
space.newbool(bool(closefd)), w_opener)
else:
w_raw = W_FileIO(space)
w_raw.descr_init(space, w_file, rawmode, bool(closefd), w_opener)
w_result = w_raw
isatty = space.is_true(space.call_method(w_raw, "isatty"))
line_buffering = buffering == 1 or (buffering < 0 and isatty)
if line_buffering:
buffering = -1
if buffering < 0:
buffering = space.c_int_w(space.getattr(
w_raw, space.newtext("_blksize")))
if buffering < 0:
raise oefmt(space.w_ValueError, "invalid buffering size")
if buffering == 0:
if not binary:
raise oefmt(space.w_ValueError,
"can't have unbuffered text I/O")
return w_result
if updating:
w_buffer = W_BufferedRandom(space)
w_buffer.descr_init(space, w_raw, buffering)
elif writing or creating or appending:
w_buffer = W_BufferedWriter(space)
w_buffer.descr_init(space, w_raw, buffering)
elif reading:
w_buffer = W_BufferedReader(space)
w_buffer.descr_init(space, w_raw, buffering)
else:
raise oefmt(space.w_ValueError, "unknown mode: '%s'", mode)
w_result = w_buffer
if binary:
return w_result
w_wrapper = W_TextIOWrapper(space)
w_wrapper.descr_init(space, w_buffer, encoding,
space.newtext_or_none(errors),
space.newtext_or_none(newline),
> line_buffering)
module\_io\interp_io.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
space = StdObjSpace
w_buffer = <pypy.module._io.interp_bufferedio.W_BufferedReader object at 0x000002342f446758>
encoding = 'utf-8', w_errors = W_UnicodeObject('strict')
w_newline = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
line_buffering = True, write_through = 0
@unwrap_spec(encoding="text0_or_none", line_buffering=int, write_through=int)
def descr_init(self, space, w_buffer, encoding=None,
w_errors=None, w_newline=None, line_buffering=0,
write_through=0):
self.state = STATE_ZERO
self.w_buffer = w_buffer
self.w_encoding = w_encoding = _determine_encoding(space, encoding, w_buffer)
if space.is_none(w_errors) or w_errors is None:
w_errors = space.newtext("strict")
if not space.isinstance_w(w_errors, space.w_text):
raise oefmt(space.w_TypeError, "TextIOWrapper() argument 'errors' "
"must be str or None, not %N", w_errors)
io_check_errors(space, w_errors)
self.w_errors = w_errors
newline = unwrap_newline(space, w_newline)
self.line_buffering = bool(line_buffering)
self.write_through = bool(write_through)
self._set_newline(newline)
> self._set_encoder_decoder(w_encoding, w_errors)
module\_io\interp_textio.py:605:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
w_encoding = W_UnicodeObject('utf-8'), w_errors = W_UnicodeObject('strict')
def _set_encoder_decoder(self, w_encoding, w_errors):
space = self.space
w_codec = interp_codecs.lookup_codec(space,
> space.text_w(w_encoding))
module\_io\interp_textio.py:634:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8'
@unwrap_spec(encoding='text0')
def lookup_codec(space, encoding):
"""lookup(encoding) -> (encoder, decoder, stream_reader, stream_writer)
Looks up a codec tuple in the Python codec registry and returns
a tuple of functions.
"""
assert not (space.config.translating and not we_are_translated()), \
"lookup_codec() should not be called during translation"
state = space.fromcache(CodecState)
normalized_encoding = normalize(encoding)
w_result = state.get_codec_from_cache(normalized_encoding)
if w_result is not None:
return w_result
> return _lookup_codec_loop(space, encoding, normalized_encoding)
module\_codecs\interp_codecs.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8', normalized_encoding = 'utf_8'
def _lookup_codec_loop(space, encoding, normalized_encoding):
state = space.fromcache(CodecState)
if state.codec_need_encodings:
# registers new codecs.
# This import uses the "builtin" import method, and is needed
# to bootstrap the full importlib module.
w_import = space.getattr(space.builtin, space.newtext("__import__"))
> space.call_function(w_import, space.newtext("encodings"))
module\_codecs\interp_codecs.py:221:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),), nargs = 1
Function = <class 'pypy.interpreter.function.Function'>
_Method = <class 'pypy.interpreter.function._Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
> return w_func.funccall(*args_w)
interpreter\baseobjspace.py:1237:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),)
gateway = <module 'pypy.interpreter.gateway' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\interpreter\\gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
def funccall(self, *args_w): # speed hack
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
nargs = len(args_w)
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, args_w[0])
elif nargs == 2:
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, args_w[0], args_w[1])
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
return code.fastcall_3(self.space, self, args_w[0],
args_w[1], args_w[2])
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
return code.fastcall_4(self.space, self, args_w[0],
args_w[1], args_w[2], args_w[3])
elif (nargs | PyCode.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
if nargs < 5:
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in funccallunrolling:
if i < nargs:
new_frame.locals_cells_stack_w[i] = args_w[i]
return new_frame.run(self.name, self.qualname)
elif nargs >= 1 and fast_natural_arity == Code.PASSTHROUGHARGS1:
assert isinstance(code, gateway.BuiltinCodePassThroughArguments1)
return code.funcrun_obj(self, args_w[0],
Arguments(self.space,
list(args_w[1:])))
> return self.call_args(Arguments(self.space, list(args_w)))
interpreter\function.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_W_Root_W_Root_W_Root_W_Root object at 0x000002342c151be8>
space = StdObjSpace
scope_w = [W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], scope_w[1], scope_w[2], scope_w[3], scope_w[4])
<2115-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('encodings')
w_globals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_fromlist = W_TupleObject(), w_level = W_IntObject(0)
@unwrap_spec(w_globals=WrappedDefault(None), w_locals=WrappedDefault(None), w_fromlist=WrappedDefault(()),
w_level=WrappedDefault(0))
def interp___import__(space, w_name, w_globals, w_locals, w_fromlist,
w_level):
"""
Import a module. Because this function is meant for use by the Python
interpreter and not for general use, it is better to use
importlib.import_module() to programmatically import a module.
The globals argument is only used to determine the context;
they are not modified. The locals argument is unused. The fromlist
should be a list of names to emulate ``from name import ...'', or an
empty list to emulate ``import name''.
When importing a module from a package, note that __import__('A.B', ...)
returns package A when fromlist is empty, but its submodule B when
fromlist is not empty. The level argument is used to determine whether to
perform absolute or relative imports: 0 is absolute, while a positive number
is the number of parent directories to search relative to the current module."""
level = space.int_w(w_level)
if level == 0:
# fast path only for absolute imports without a "from" list, for now
# fromlist can be supported if we are importing from a module, not a
# package. to check that, look for the existence of __path__ attribute
# in w_mod
try:
name = space.text_w(w_name)
w_mod = _gcd_import(space, name)
have_fromlist = space.is_true(w_fromlist)
if not have_fromlist:
dotindex = name.find(".")
if dotindex < 0:
return w_mod
return _gcd_import(space, name[:dotindex])
except FastPathGiveUp:
pass
else:
assert have_fromlist
w_path = space.findattr(w_mod, space.newtext("__path__"))
if w_path is not None:
# hard case, a package! Call back into importlib
w_importlib = space.getbuiltinmodule('_frozen_importlib')
return space.call_method(w_importlib, "_handle_fromlist",
w_mod, w_fromlist,
space.w_default_importlib_import)
else:
return w_mod
try:
return space.call_function(
space.fromcache(FrozenCache).w_frozen_import, w_name, w_globals, w_locals, w_fromlist,
> w_level)
module\_frozen_importlib\interp_import.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function __import__>
args_w = (W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0))
nargs = 5
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
func = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def funcrun(self, func, args):
frame = self.space.createframe(self, func.w_func_globals,
func)
sig = self._signature
# speed hack
fresh_frame = jit.hint(frame, access_directly=True,
fresh_virtualizable=True)
args.parse_into_scope(None, fresh_frame.locals_cells_stack_w, func.qualname,
sig, func.defs_w, func.w_kw_defs)
fresh_frame.init_cells()
> return frame.run(func.name, func.qualname)
interpreter\pycode.py:280:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
name = '__import__', qualname = '__import__'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
oparg = 1, next_instr = 14L
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
return self._flat_pycall(code, nargs, frame, dropvalues)
elif fast_natural_arity & Code.FLATPYCALL:
natural_arity = fast_natural_arity & 0xff
if natural_arity > nargs >= natural_arity - len(self.defs_w):
assert isinstance(code, PyCode)
return self._flat_pycall_defaults(code, nargs, frame,
> natural_arity - nargs, dropvalues)
interpreter\function.py:193:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
defs_to_load = 2, dropvalues = 2
@jit.unroll_safe
def _flat_pycall_defaults(self, code, nargs, frame, defs_to_load, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
ndefs = len(self.defs_w)
start = ndefs - defs_to_load
i = nargs
for j in xrange(start, ndefs):
new_frame.locals_cells_stack_w[i] = self.defs_w[j]
i += 1
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:231:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
name = '_gcd_import', qualname = '_gcd_import'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 40
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
oparg = 2, next_instr = 40
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
name = '_find_and_load', qualname = '_find_and_load'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 82
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
oparg = 2, next_instr = 82
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>
code = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
name = '_find_and_load_unlocked', qualname = '_find_and_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
pycode = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 216
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
oparg = 1, next_instr = 216
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>
code = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
name = '_load_unlocked', qualname = '_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
pycode = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 132
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
oparg = 1, ignored = (132,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>
code = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
name = 'exec_module', qualname = '_LoaderBasics.exec_module'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
pycode = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 10L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
oparg = 1, ignored = (10L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>
code = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
name = 'get_code', qualname = 'SourceLoader.get_code'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
pycode = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 74L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
oparg = 1, ignored = (74L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>
code = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
name = 'get_data', qualname = 'FileLoader.get_data'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
pycode = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 26L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
oparg = 1, ignored = (26L,), n_args = 1, w_self = None, n = 1
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
> return code.fastcall_1(self.space, self, f_0)
interpreter\function.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
w_result = self.fastfunc_1(space, w1)
except DescrMismatch:
return self._type_unwrap_mismatch(space,
Arguments(space, [w1]))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:982:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
> w_result = self.fastfunc_1(space, w1)
interpreter\gateway.py:977:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
def open_code(space, w_file):
> return open(space, w_file, "rb")
module\_io\interp_io.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
> space.newbool(bool(closefd)), w_opener)
module\_io\interp_io.py:120:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args_w = (W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None)
nargs = 4, Function = <class 'pypy.interpreter.function.Function'>
_Method = <class 'pypy.interpreter.function._Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
return w_obj.call_args(args)
if isinstance(w_obj, Method):
return w_obj.call_args(args)
w_descr = space.lookup(w_obj, '__call__')
if w_descr is None:
raise oefmt(space.w_TypeError,
"'%T' object is not callable", w_obj)
> return space.get_and_call_args(w_descr, w_obj, args)
objspace\descroperation.py:199:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
w_result = self.func__args__(space, w_obj, args)
except DescrMismatch:
return self._type_unwrap_mismatch(space, args.prepend(w_obj))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:941:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
> w_result = self.func__args__(space, w_obj, args)
interpreter\gateway.py:937:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def _call(space, w_obj, args):
self = space.descr_self_interp_w(self_type, w_obj)
> return func(self, space, args)
<282-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:4:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <W_TypeObject '_io.FileIO' at 0x2342f626d78>, space = StdObjSpace
__args__ = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def descr_call(self, space, __args__):
promote(self)
# invoke the __new__ of the type
if not we_are_jitted():
# note that the annotator will figure out that self.w_new_function
# can only be None if the newshortcut config option is not set
w_newfunc = self.w_new_function
else:
# for the JIT it is better to take the slow path because normal lookup
# is nicely optimized, but the self.w_new_function attribute is not
# known to the JIT
w_newfunc = None
if w_newfunc is None:
w_newtype, w_newdescr = self.lookup_where('__new__')
if w_newdescr is None: # see test_crash_mro_without_object_1
raise oefmt(space.w_TypeError, "cannot create '%N' instances",
self)
#
# issue #2666
if space.config.objspace.usemodules.cpyext:
w_newtype, w_newdescr = self.hack_which_new_to_call(
w_newtype, w_newdescr)
#
w_newfunc = space.get(w_newdescr, space.w_None, w_type=self)
if (space.config.objspace.std.newshortcut and
not we_are_jitted() and space._side_effects_ok() and
isinstance(w_newtype, W_TypeObject)):
self.w_new_function = w_newfunc
w_newobject = space.call_obj_args(w_newfunc, self, __args__)
call_init = space.isinstance_w(w_newobject, self)
# maybe invoke the __init__ of the type
if (call_init and not (space.is_w(self, space.w_type) and
not __args__.keyword_names_w and len(__args__.arguments_w) == 1)):
w_descr = space.lookup(w_newobject, '__init__')
if w_descr is not None: # see test_crash_mro_without_object_2
w_result = space.get_and_call_args(w_descr, w_newobject,
> __args__)
objspace\std\typeobject.py:743:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_W_FileIO_ObjSpace_W_Root_text_int_W_Root object at 0x000002342e1b8db0>
space = StdObjSpace
scope_w = [<pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>, W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\s...\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None]
def _run(self, space, scope_w):
> return self.behavior(space.interp_w(W_FileIO, scope_w[0]), space, scope_w[1], space.text_w(scope_w[2]), space.gateway_int_w(scope_w[3]), scope_w[4])
<2459-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'r', closefd = 1, w_opener = None
@unwrap_spec(mode='text', closefd=int)
def descr_init(self, space, w_name, mode='r', closefd=True, w_opener=None):
if self.fd >= 0:
if self.closefd:
self._close(space)
else:
self.fd = -1
if space.isinstance_w(w_name, space.w_float):
raise oefmt(space.w_TypeError,
"integer argument expected, got float")
fd = -1
try:
fd = space.c_int_w(w_name)
except OperationError as e:
pass
else:
if fd < 0:
raise oefmt(space.w_ValueError, "negative file descriptor")
self.readable, self.writable, self.created, self.appending, flags = decode_mode(space, mode)
if rposix.O_CLOEXEC is not None:
flags |= rposix.O_CLOEXEC
fd_is_own = False
try:
if fd >= 0:
self.fd = fd
self.closefd = bool(closefd)
space.audit("open", [space.newint(fd), space.newtext(mode), space.newint(closefd)])
else:
space.audit("open", [w_name, space.newtext(mode), space.newint(1)])
self.closefd = True
if not closefd:
raise oefmt(space.w_ValueError,
"Cannot use closefd=False with file name")
if space.is_none(w_opener):
> self.fd = _open_fd(space, w_name, flags)
module\_io\interp_fileio.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
flags = 32768
def _open_fd(space, w_name, flags):
from pypy.module.posix.interp_posix import dispatch_filename, fspath
w_path = fspath(space, w_name)
while True:
try:
fd = dispatch_filename(rposix.open)(
> space, w_path, flags, 0666)
module\_io\interp_fileio.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_fname = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
args = (32768, 438)
fname = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
@specialize.argtype(1)
def dispatch(space, w_fname, *args):
if allow_fd_fn is not None:
try:
fd = space.c_int_w(w_fname)
except OperationError:
pass
else:
return allow_fd_fn(fd, *args)
if space.isinstance_w(w_fname, space.w_unicode):
fname = FileEncoder(space, w_fname)
> return func(fname, *args)
module\posix\interp_posix.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
flags = 32768, mode = 438
@replace_os_function('open')
@specialize.argtype(0)
@enforceargs(NOT_CONSTANT, int, int, typecheck=False)
def open(path, flags, mode):
if _WIN32:
utf8 = _as_utf80(path)
with rffi.scoped_utf82wcharp(utf8) as buf:
> fd = c_wopen(buf, flags, mode)
..\rpython\rlib\rposix.py:468:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<* DEAD Array of UniChar {'nolength': True} >, 32768, 438)
real_args = (<* DEAD Array of UniChar {'nolength': True} >, 32768L, 438L)
to_free = (), i = 2
def wrapper(*args):
assert len(args) == nb_args
real_args = ()
# XXX 'to_free' leaks if an allocation fails with MemoryError
# and was not the first in this function
to_free = ()
for i, TARGET in unrolling_arg_tps:
arg = args[i]
if TARGET == CCHARP or TARGET is VOIDP:
if arg is None:
from rpython.rtyper.annlowlevel import llstr
arg = lltype.nullptr(CCHARP.TO) # None => (char*)NULL
to_free = to_free + (arg, llstr(None), '\x04')
elif isinstance(arg, str):
tup = get_nonmovingbuffer_ll_final_null(arg)
to_free = to_free + tup
arg = tup[0]
elif isinstance(arg, unicode):
_oops()
elif TARGET == CWCHARP:
if arg is None:
arg = lltype.nullptr(CWCHARP.TO) # None => (wchar_t*)NULL
to_free = to_free + (arg,)
elif isinstance(arg, unicode):
arg = unicode2wcharp(arg)
to_free = to_free + (arg,)
elif _isfunctype(TARGET) and not _isllptr(arg):
# XXX pass additional arguments
use_gil = invoke_around_handlers
arg = llhelper(TARGET, _make_wrapper_for(TARGET, arg,
callbackholder,
use_gil))
else:
SOURCE = lltype.typeOf(arg)
if SOURCE != TARGET:
if TARGET is lltype.Float:
arg = float(arg)
elif ((isinstance(SOURCE, lltype.Number)
or SOURCE is lltype.Bool)
and (isinstance(TARGET, lltype.Number)
or TARGET is lltype.Bool)):
arg = cast(TARGET, arg)
real_args = real_args + (arg,)
> res = call_external_function(*real_args)
..\rpython\rtyper\lltypesystem\rffi.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a0 = <* DEAD Array of UniChar {'nolength': True} >, a1 = 32768L, a2 = 438L
def call_external_function(a0, a1, a2):
rgil.release()
# NB. it is essential that no exception checking occurs here!
if 1:
from rpython.rlib import rposix
rposix._errno_before(1)
if we_are_translated():
res = funcptr(a0, a1, a2)
else:
try: # only when non-translated
res = funcptr(a0, a1, a2)
except:
rgil.acquire()
raise
if 1:
from rpython.rlib import rposix
> rposix._errno_after(1)
<91-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py:217>:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
save_err = 1
@specialize.call_location()
def _errno_after(save_err):
if _WIN32:
if save_err & rffi.RFFI_SAVE_LASTERROR:
err = rwin32._GetLastError()
# careful, setraw() overwrites GetLastError.
# We must read it first, before the errno handling.
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
elif save_err & rffi.RFFI_SAVE_WSALASTERROR:
from rpython.rlib import _rsocket_rffi
err = _rsocket_rffi._WSAGetLastError()
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
if save_err & rffi.RFFI_SAVE_ERRNO:
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_errno.setraw(_get_errno())
else:
> rthread.tlfield_rpy_errno.setraw(_get_errno())
..\rpython\rlib\rposix.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <* fn get_errno>, args = ()
rffi = <module 'rpython.rtyper.lltypesystem.rffi' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\rtyper\\lltypesystem\\rffi.pyc'>
def __call__(self, *args):
from rpython.rtyper.lltypesystem import rffi
if isinstance(self._T, FuncType):
if len(args) != len(self._T.ARGS):
raise TypeError("calling %r with wrong argument number: %r" %
(self._T, args))
for i, a, ARG in zip(range(len(self._T.ARGS)), args, self._T.ARGS):
if typeOf(a) != ARG:
# ARG could be Void
if ARG == Void:
try:
value = getattr(self._obj, '_void' + str(i))
except AttributeError:
pass
else:
assert a == value
# None is acceptable for any pointer
elif isinstance(ARG, Ptr) and a is None:
pass
# Any pointer is convertible to void*
elif ARG is rffi.VOIDP and isinstance(typeOf(a), Ptr):
pass
# special case: ARG can be a container type, in which
# case a should be a pointer to it. This must also be
# special-cased in the backends.
elif (isinstance(ARG, ContainerType) and
typeOf(a) == Ptr(ARG)):
pass
else:
args_repr = [typeOf(arg) for arg in args]
raise TypeError("calling %r with wrong argument "
"types: %r" % (self._T, args_repr))
callb = self._obj._callable
if callb is None:
raise RuntimeError("calling undefined function")
> return callb(*args)
..\rpython\rtyper\lltypesystem\lltype.py:1384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.rtyper.lltypesystem.ll2ctypes.LL2CtypesCallable object at 0x0000023428d928a8>
argvalues = ()
def __call__(self, *argvalues):
with rlock:
if self.trampoline is None:
# lazily build the corresponding ctypes function object
cfunc = get_ctypes_callable(self.funcptr, self.calling_conv,
> self.natural_arity)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1339:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
funcptr = <* fn get_errno>, calling_conv = 'c', natural_arity = -1
def get_ctypes_callable(funcptr, calling_conv, natural_arity):
if not ctypes:
raise ImportError("ctypes is needed to use ll2ctypes")
def get_on_lib(lib, elem):
""" Wrapper to always use lib[func] instead of lib.func
"""
try:
return lib[elem]
except AttributeError:
pass
old_eci = funcptr._obj.compilation_info
funcname = funcptr._obj._name
if hasattr(old_eci, '_with_ctypes'):
old_eci = old_eci._with_ctypes
try:
eci = _eci_cache[old_eci]
except KeyError:
eci = old_eci.compile_shared_lib(ignore_a_files=True,
defines=['RPYTHON_LL2CTYPES'],
> symbolic=True)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1236:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
ignore_a_files = False, debug_mode = True, defines = ['RPYTHON_LL2CTYPES']
symbolic = True
def compile_shared_lib(self, outputfilename=None, ignore_a_files=False,
debug_mode=True, defines=[], symbolic=False):
self = self.convert_sources_to_files()
if ignore_a_files:
if not [fn for fn in self.link_files if fn.endswith('.a')]:
ignore_a_files = False # there are none
if not self.separate_module_files and not ignore_a_files:
return self # xxx there was some condition about win32 here
else:
#basepath = py.path.local(self.separate_module_files[0]).dirpath()
basepath = udir.join('shared_cache')
if outputfilename is None:
# find more or less unique name there
pth = basepath.join('externmod').new(ext=host.so_ext)
num = 0
while pth.check():
pth = basepath.join(
'externmod_%d' % (num,)).new(ext=host.so_ext)
num += 1
basepath.ensure(dir=1)
outputfilename = str(pth.dirpath().join(pth.purebasename))
d = self._copy_attributes()
if ignore_a_files:
d['link_files'] = [fn for fn in d['link_files']
if not fn.endswith('.a')]
if debug_mode and sys.platform != 'win32':
d['compile_extra'] = d['compile_extra'] + ('-g', '-O0')
d['compile_extra'] = d['compile_extra'] + (
'-DRPY_EXTERN=RPY_EXPORTED',)
for define in defines:
d['compile_extra'] += ('-D%s' % define,)
# On ELF platforms (Linux), prevent symbol interposition: when the host
# interpreter (e.g. pypy2.7) also exports symbols like pypysig_counter,
# the shared lib's own references would otherwise resolve to the host's
# copy via the GOT. -Bsymbolic makes the shared lib bind its own global
# symbol references to its own definitions. Only needed when running
# under a host interpreter (tests), not during translation.
if symbolic and sys.platform not in ('win32', 'darwin'):
d['link_extra'] = d['link_extra'] + ('-Wl,-Bsymbolic',)
self = ExternalCompilationInfo(**d)
lib = str(host.compile([], self, outputfilename=outputfilename,
> standalone=False))
..\rpython\translator\tool\cbuild.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cfiles = []
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def compile(self, cfiles, eci, outputfilename=None, standalone=True):
ofiles = self._compile_o_files(cfiles, eci, standalone)
> return self._finish_linking(ofiles, eci, outputfilename, standalone)
..\rpython\translator\platform\__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def _finish_linking(self, ofiles, eci, outputfilename, standalone):
if outputfilename is None:
outputfilename = ofiles[0].purebasename
if ofiles:
dirname = ofiles[0].dirpath()
else:
dirname = udir.join('module_cache')
exe_name = dirname.join(outputfilename, abs=True)
if standalone:
if self.exe_ext:
exe_name += '.' + self.exe_ext
else:
exe_name += '.' + self.so_ext
if eci.use_cpp_linker:
cc_link = 'g++' # XXX hard-coded so far
else:
cc_link = self.cc
largs = self._link_args_from_eci(eci, standalone)
> return self._link(cc_link, ofiles, largs, standalone, exe_name)
..\rpython\translator\platform\__init__.py:235:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'cl.exe'
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
link_args = ['/nologo', '/LARGEADDRESSAWARE', '/STACK:3145728', '/MANIFEST:EMBED', 'kernel32.lib']
standalone = False
exe_name = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _link(self, cc, ofiles, link_args, standalone, exe_name):
args = ['/nologo'] + [str(ofile) for ofile in ofiles] + link_args
args += ['/out:%s' % (exe_name,), '/incremental:no']
if not standalone:
args = self._args_for_shared(args)
# Tell the linker to embed a manifest with the default
# UAC level asInvoker (Visual Studio 2008 +)
args += ["/MANIFEST:EMBED"]
> self._execute_c_compiler(self.link, args, exe_name)
..\rpython\translator\platform\windows.py:303:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'link.exe'
args = ['/dll', '/nologo', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj', '/nologo', '/LARGEADDRESSAWARE', ...]
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
cwd = None
def _execute_c_compiler(self, cc, args, outname, cwd=None):
#log.execute(cc + ' ' + ' '.join(args))
# 'cc' can also contain some options for the C compiler;
# e.g. it can be "gcc -m32". We handle it by splitting on ' '.
cclist = cc.split()
cc = cclist[0]
args = cclist[1:] + args
returncode, stdout, stderr = _run_subprocess(cc, args, self.c_environ,
cwd)
> self._handle_error(returncode, stdout, stderr, outname)
..\rpython\translator\platform\__init__.py:143:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, returncode = 3221225477, stdout = ''
stderr = ''
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _handle_error(self, returncode, stdout, stderr, outname):
if returncode != 0:
# Microsoft compilers write compilation errors to stdout
stderr = stdout + stderr
errorfile = outname.new(ext='errors')
errorfile.write(stderr, mode='wb')
if self.log_errors:
stderrlines = stderr.splitlines()
for line in stderrlines:
log.Error(line)
# ^^^ don't use ERROR, because it might actually be fine.
# Also, ERROR confuses lib-python/conftest.py.
> raise CompilationError(stdout, stderr)
E CompilationError: CompilationError(out="""
E """)
..\rpython\translator\platform\windows.py:319: CompilationError
________ ERROR at setup of AppTestStringObject.test_bytearray_mutable _________
self = <CallInfo when='setup' exception: CompilationError(out="""
""")>
func = <function <lambda> at 0x000002342f68cf98>, when = 'setup'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
..\_pytest\runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
..\_pytest\runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_setup'>
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_mutable'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_bytearray_mutable'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
..\_pytest\vendored_packages\pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x0000023426593440>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_mutable'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_bytearray_mutable'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
..\_pytest\vendored_packages\pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_mutable'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_bytearray_mutable'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
..\_pytest\vendored_packages\pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_mutable'>, '__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 0x000002342c389740>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ay_mutable'>, '__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 0x0000023438b21660>
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 0x0000023438b21660>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ay_mutable'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_mutable'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
..\_pytest\vendored_packages\pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_bytearray_mutable'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
..\_pytest\runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_bytearray_mutable'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
> py.builtin._reraise(*col._prepare_exc)
..\_pytest\runner.py:404:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_basic'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
py.builtin._reraise(*col._prepare_exc)
for col in needed_collectors[len(self.stack):]:
self.stack.append(col)
try:
> col.setup()
..\_pytest\runner.py:408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
> super(AppClassCollector, self).setup()
tool\pytest\apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
setup_class = xunitsetup(self.obj, 'setup_class')
if setup_class is not None:
setup_class = getattr(setup_class, 'im_func', setup_class)
setup_class = getattr(setup_class, '__func__', setup_class)
> setup_class(self.obj)
..\_pytest\python.py:671:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'pypy.module.cpyext.test.test_bytearrayobject.AppTestStringObject'>
def setup_class(cls):
space = cls.space
cls.w_here = space.wrap(str(HERE))
cls.w_udir = space.wrap(str(udir))
cls.w_runappdirect = space.wrap(cls.runappdirect)
if not cls.runappdirect:
cls.sys_info = get_cpyext_info(space)
cls.w_debug_collect = space.wrap(interp2app(debug_collect))
cls.preload_builtins(space)
# Flush stdout once here to pre-create any file lock objects
# before we start counting allocations (moved from setup_method).
> space.call_method(space.sys.get("stdout"), "flush")
module\cpyext\test\test_cpyext.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
name = 'stdout'
def get(self, name):
space = self.space
> w_value = self.getdictvalue(space, name)
interpreter\mixedmodule.py:86:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
def getdictvalue(self, space, name):
w_value = space.finditem_str(self.w_dict, name)
if self.lazy and w_value is None:
> return self._load_lazily(space, name)
interpreter\mixedmodule.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
def _load_lazily(self, space, name):
w_name = space.new_interned_str(name)
try:
loader = self.loaders[name]
except KeyError:
return None
else:
> w_value = loader(space)
interpreter\mixedmodule.py:119:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
def afileloader(space):
> return app.wget(space, attrname)
interpreter\mixedmodule.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace, name = 'stdout'
def wget(self, space, name):
> w_globals = self.getwdict(space)
interpreter\gateway.py:1393:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
def getwdict(self, space):
> return space.fromcache(ApplevelCache).getorbuild(self)
interpreter\gateway.py:1386:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def getorbuild(self, key):
if lock: lock.acquire()
try:
try:
return self.content[key]
except KeyError:
if key in self._building:
raise RuntimeError("%s recursive building of %r" %
(self, key))
self._building[key] = True
try:
> result = self._build(key)
..\rpython\rlib\cache.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def _build(self, key):
> return self.build(key)
interpreter\baseobjspace.py:400:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
app = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
@not_rpython
def build(self, app):
"Called indirectly by Applevel.getwdict()."
> return build_applevel_dict(app, self.space)
interpreter\gateway.py:1437:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
@not_rpython
def build_applevel_dict(self, space):
w_glob = space.newdict(module=True)
space.setitem(w_glob, space.newtext('__name__'), space.newtext(self.modname))
space.exec_(self.source, w_glob, w_glob,
hidden_applevel=self.hidden_applevel,
> filename=self.filename)
interpreter\gateway.py:1448:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
statement = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
hidden_applevel = True
filename = 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'
@not_rpython
def exec_(self, statement, w_globals, w_locals, hidden_applevel=False,
filename=None):
"For internal debugging."
if filename is None:
filename = '?'
from pypy.interpreter.pycode import PyCode
if isinstance(statement, str):
statement = self._cached_compile(filename, statement, 'exec', 0, hidden_applevel)
if not isinstance(statement, PyCode):
raise TypeError('space.exec_(): expected a string, code or PyCode object')
w_key = self.newtext('__builtins__')
if not self.contains_w(w_globals, w_key):
self.setitem(w_globals, w_key, self.builtin)
> return statement.exec_code(self, w_globals, w_locals)
interpreter\baseobjspace.py:1408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
space = StdObjSpace
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_closure = None
def exec_code(self, space, w_globals, w_locals, w_closure=None):
"Implements the 'exec' statement."
# this should be on PyCode?
frame = space.createframe(self, w_globals, w_closure)
frame.setdictscope(w_locals, skip_free_vars=w_closure is not None)
> return frame.run()
interpreter\eval.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
name = None, qualname = None
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
pycode = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 24L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
self.CALL_METHOD(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD_KW.index:
> self.CALL_METHOD_KW(oparg, next_instr)
interpreter\pyopcode.py:315:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
n_arguments = 2, ignored = (24L,)
W_AbstractTupleObject = <class 'pypy.objspace.std.tupleobject.W_AbstractTupleObject'>
w_self = None, space = StdObjSpace
@jit.unroll_safe
def CALL_METHOD_KW(f, n_arguments, *ignored):
from pypy.objspace.std.tupleobject import W_AbstractTupleObject
# opargs contains the arg + kwarg count, excluding the implicit 'self'
w_self = f.peekvalue_maybe_none(n_arguments + 1)
space = f.space
# like in BUILD_CONST_KEY_MAP we can't use space.fixedview because then
# the immutability of the tuple is lost
w_tup_varnames = space.interp_w(W_AbstractTupleObject, f.popvalue())
n_keywords = space.len_w(w_tup_varnames)
keyword_names_w = [None] * n_keywords
keywords_w = [None] * n_keywords
for i in range(n_keywords):
keyword_names_w[i] = w_tup_varnames.getitem(space, i)
w_value = f.peekvalue(n_keywords - 1 - i)
keywords_w[i] = w_value
f.dropvalues(n_keywords)
n_arguments -= n_keywords
n = n_arguments + (w_self is not None)
arguments = f.popvalues(n) # includes w_self if it is not None
if w_self is None:
f.popvalue_maybe_none() # removes w_self, which is None
w_callable = f.popvalue()
args = f.argument_factory(
arguments, keyword_names_w, keywords_w, None, None,
methodcall=w_self is not None, w_function=w_callable)
if f.get_is_being_profiled() and function.is_builtin_code(w_callable):
w_result = f.space.call_args_and_c_profile(f, w_callable, args)
else:
> w_result = f.space.call_args(w_callable, args)
objspace\std\callmethod.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_text_int_text_or_none_text_or_none_text_or_none_int_W_Root object at 0x000002342f57f558>
space = StdObjSpace
scope_w = [W_IntObject(0), W_UnicodeObject('r'), W_IntObject(-1), W_UnicodeObject('utf-8'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, ...]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], space.text_w(scope_w[1]), space.gateway_int_w(scope_w[2]), space.text_or_none_w(scope_w[3]), space.text_or_none_w(scope_w[4]), space.text_or_none_w(scope_w[5]), space.gateway_int_w(scope_w[6]), scope_w[7])
<2604-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = 8192
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
space.newbool(bool(closefd)), w_opener)
else:
w_raw = W_FileIO(space)
w_raw.descr_init(space, w_file, rawmode, bool(closefd), w_opener)
w_result = w_raw
isatty = space.is_true(space.call_method(w_raw, "isatty"))
line_buffering = buffering == 1 or (buffering < 0 and isatty)
if line_buffering:
buffering = -1
if buffering < 0:
buffering = space.c_int_w(space.getattr(
w_raw, space.newtext("_blksize")))
if buffering < 0:
raise oefmt(space.w_ValueError, "invalid buffering size")
if buffering == 0:
if not binary:
raise oefmt(space.w_ValueError,
"can't have unbuffered text I/O")
return w_result
if updating:
w_buffer = W_BufferedRandom(space)
w_buffer.descr_init(space, w_raw, buffering)
elif writing or creating or appending:
w_buffer = W_BufferedWriter(space)
w_buffer.descr_init(space, w_raw, buffering)
elif reading:
w_buffer = W_BufferedReader(space)
w_buffer.descr_init(space, w_raw, buffering)
else:
raise oefmt(space.w_ValueError, "unknown mode: '%s'", mode)
w_result = w_buffer
if binary:
return w_result
w_wrapper = W_TextIOWrapper(space)
w_wrapper.descr_init(space, w_buffer, encoding,
space.newtext_or_none(errors),
space.newtext_or_none(newline),
> line_buffering)
module\_io\interp_io.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
space = StdObjSpace
w_buffer = <pypy.module._io.interp_bufferedio.W_BufferedReader object at 0x000002342f446758>
encoding = 'utf-8', w_errors = W_UnicodeObject('strict')
w_newline = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
line_buffering = True, write_through = 0
@unwrap_spec(encoding="text0_or_none", line_buffering=int, write_through=int)
def descr_init(self, space, w_buffer, encoding=None,
w_errors=None, w_newline=None, line_buffering=0,
write_through=0):
self.state = STATE_ZERO
self.w_buffer = w_buffer
self.w_encoding = w_encoding = _determine_encoding(space, encoding, w_buffer)
if space.is_none(w_errors) or w_errors is None:
w_errors = space.newtext("strict")
if not space.isinstance_w(w_errors, space.w_text):
raise oefmt(space.w_TypeError, "TextIOWrapper() argument 'errors' "
"must be str or None, not %N", w_errors)
io_check_errors(space, w_errors)
self.w_errors = w_errors
newline = unwrap_newline(space, w_newline)
self.line_buffering = bool(line_buffering)
self.write_through = bool(write_through)
self._set_newline(newline)
> self._set_encoder_decoder(w_encoding, w_errors)
module\_io\interp_textio.py:605:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
w_encoding = W_UnicodeObject('utf-8'), w_errors = W_UnicodeObject('strict')
def _set_encoder_decoder(self, w_encoding, w_errors):
space = self.space
w_codec = interp_codecs.lookup_codec(space,
> space.text_w(w_encoding))
module\_io\interp_textio.py:634:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8'
@unwrap_spec(encoding='text0')
def lookup_codec(space, encoding):
"""lookup(encoding) -> (encoder, decoder, stream_reader, stream_writer)
Looks up a codec tuple in the Python codec registry and returns
a tuple of functions.
"""
assert not (space.config.translating and not we_are_translated()), \
"lookup_codec() should not be called during translation"
state = space.fromcache(CodecState)
normalized_encoding = normalize(encoding)
w_result = state.get_codec_from_cache(normalized_encoding)
if w_result is not None:
return w_result
> return _lookup_codec_loop(space, encoding, normalized_encoding)
module\_codecs\interp_codecs.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8', normalized_encoding = 'utf_8'
def _lookup_codec_loop(space, encoding, normalized_encoding):
state = space.fromcache(CodecState)
if state.codec_need_encodings:
# registers new codecs.
# This import uses the "builtin" import method, and is needed
# to bootstrap the full importlib module.
w_import = space.getattr(space.builtin, space.newtext("__import__"))
> space.call_function(w_import, space.newtext("encodings"))
module\_codecs\interp_codecs.py:221:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),), nargs = 1
Function = <class 'pypy.interpreter.function.Function'>
_Method = <class 'pypy.interpreter.function._Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
> return w_func.funccall(*args_w)
interpreter\baseobjspace.py:1237:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),)
gateway = <module 'pypy.interpreter.gateway' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\interpreter\\gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
def funccall(self, *args_w): # speed hack
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
nargs = len(args_w)
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, args_w[0])
elif nargs == 2:
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, args_w[0], args_w[1])
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
return code.fastcall_3(self.space, self, args_w[0],
args_w[1], args_w[2])
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
return code.fastcall_4(self.space, self, args_w[0],
args_w[1], args_w[2], args_w[3])
elif (nargs | PyCode.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
if nargs < 5:
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in funccallunrolling:
if i < nargs:
new_frame.locals_cells_stack_w[i] = args_w[i]
return new_frame.run(self.name, self.qualname)
elif nargs >= 1 and fast_natural_arity == Code.PASSTHROUGHARGS1:
assert isinstance(code, gateway.BuiltinCodePassThroughArguments1)
return code.funcrun_obj(self, args_w[0],
Arguments(self.space,
list(args_w[1:])))
> return self.call_args(Arguments(self.space, list(args_w)))
interpreter\function.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_W_Root_W_Root_W_Root_W_Root object at 0x000002342c151be8>
space = StdObjSpace
scope_w = [W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], scope_w[1], scope_w[2], scope_w[3], scope_w[4])
<2115-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('encodings')
w_globals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_fromlist = W_TupleObject(), w_level = W_IntObject(0)
@unwrap_spec(w_globals=WrappedDefault(None), w_locals=WrappedDefault(None), w_fromlist=WrappedDefault(()),
w_level=WrappedDefault(0))
def interp___import__(space, w_name, w_globals, w_locals, w_fromlist,
w_level):
"""
Import a module. Because this function is meant for use by the Python
interpreter and not for general use, it is better to use
importlib.import_module() to programmatically import a module.
The globals argument is only used to determine the context;
they are not modified. The locals argument is unused. The fromlist
should be a list of names to emulate ``from name import ...'', or an
empty list to emulate ``import name''.
When importing a module from a package, note that __import__('A.B', ...)
returns package A when fromlist is empty, but its submodule B when
fromlist is not empty. The level argument is used to determine whether to
perform absolute or relative imports: 0 is absolute, while a positive number
is the number of parent directories to search relative to the current module."""
level = space.int_w(w_level)
if level == 0:
# fast path only for absolute imports without a "from" list, for now
# fromlist can be supported if we are importing from a module, not a
# package. to check that, look for the existence of __path__ attribute
# in w_mod
try:
name = space.text_w(w_name)
w_mod = _gcd_import(space, name)
have_fromlist = space.is_true(w_fromlist)
if not have_fromlist:
dotindex = name.find(".")
if dotindex < 0:
return w_mod
return _gcd_import(space, name[:dotindex])
except FastPathGiveUp:
pass
else:
assert have_fromlist
w_path = space.findattr(w_mod, space.newtext("__path__"))
if w_path is not None:
# hard case, a package! Call back into importlib
w_importlib = space.getbuiltinmodule('_frozen_importlib')
return space.call_method(w_importlib, "_handle_fromlist",
w_mod, w_fromlist,
space.w_default_importlib_import)
else:
return w_mod
try:
return space.call_function(
space.fromcache(FrozenCache).w_frozen_import, w_name, w_globals, w_locals, w_fromlist,
> w_level)
module\_frozen_importlib\interp_import.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function __import__>
args_w = (W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0))
nargs = 5
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
func = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def funcrun(self, func, args):
frame = self.space.createframe(self, func.w_func_globals,
func)
sig = self._signature
# speed hack
fresh_frame = jit.hint(frame, access_directly=True,
fresh_virtualizable=True)
args.parse_into_scope(None, fresh_frame.locals_cells_stack_w, func.qualname,
sig, func.defs_w, func.w_kw_defs)
fresh_frame.init_cells()
> return frame.run(func.name, func.qualname)
interpreter\pycode.py:280:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
name = '__import__', qualname = '__import__'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
oparg = 1, next_instr = 14L
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
return self._flat_pycall(code, nargs, frame, dropvalues)
elif fast_natural_arity & Code.FLATPYCALL:
natural_arity = fast_natural_arity & 0xff
if natural_arity > nargs >= natural_arity - len(self.defs_w):
assert isinstance(code, PyCode)
return self._flat_pycall_defaults(code, nargs, frame,
> natural_arity - nargs, dropvalues)
interpreter\function.py:193:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
defs_to_load = 2, dropvalues = 2
@jit.unroll_safe
def _flat_pycall_defaults(self, code, nargs, frame, defs_to_load, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
ndefs = len(self.defs_w)
start = ndefs - defs_to_load
i = nargs
for j in xrange(start, ndefs):
new_frame.locals_cells_stack_w[i] = self.defs_w[j]
i += 1
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:231:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
name = '_gcd_import', qualname = '_gcd_import'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 40
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
oparg = 2, next_instr = 40
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
name = '_find_and_load', qualname = '_find_and_load'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 82
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
oparg = 2, next_instr = 82
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>
code = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
name = '_find_and_load_unlocked', qualname = '_find_and_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
pycode = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 216
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
oparg = 1, next_instr = 216
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>
code = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
name = '_load_unlocked', qualname = '_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
pycode = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 132
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
oparg = 1, ignored = (132,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>
code = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
name = 'exec_module', qualname = '_LoaderBasics.exec_module'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
pycode = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 10L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
oparg = 1, ignored = (10L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>
code = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
name = 'get_code', qualname = 'SourceLoader.get_code'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
pycode = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 74L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
oparg = 1, ignored = (74L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>
code = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
name = 'get_data', qualname = 'FileLoader.get_data'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
pycode = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 26L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
oparg = 1, ignored = (26L,), n_args = 1, w_self = None, n = 1
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
> return code.fastcall_1(self.space, self, f_0)
interpreter\function.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
w_result = self.fastfunc_1(space, w1)
except DescrMismatch:
return self._type_unwrap_mismatch(space,
Arguments(space, [w1]))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:982:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
> w_result = self.fastfunc_1(space, w1)
interpreter\gateway.py:977:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
def open_code(space, w_file):
> return open(space, w_file, "rb")
module\_io\interp_io.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
> space.newbool(bool(closefd)), w_opener)
module\_io\interp_io.py:120:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args_w = (W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None)
nargs = 4, Function = <class 'pypy.interpreter.function.Function'>
_Method = <class 'pypy.interpreter.function._Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
return w_obj.call_args(args)
if isinstance(w_obj, Method):
return w_obj.call_args(args)
w_descr = space.lookup(w_obj, '__call__')
if w_descr is None:
raise oefmt(space.w_TypeError,
"'%T' object is not callable", w_obj)
> return space.get_and_call_args(w_descr, w_obj, args)
objspace\descroperation.py:199:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
w_result = self.func__args__(space, w_obj, args)
except DescrMismatch:
return self._type_unwrap_mismatch(space, args.prepend(w_obj))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:941:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
> w_result = self.func__args__(space, w_obj, args)
interpreter\gateway.py:937:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def _call(space, w_obj, args):
self = space.descr_self_interp_w(self_type, w_obj)
> return func(self, space, args)
<282-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:4:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <W_TypeObject '_io.FileIO' at 0x2342f626d78>, space = StdObjSpace
__args__ = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def descr_call(self, space, __args__):
promote(self)
# invoke the __new__ of the type
if not we_are_jitted():
# note that the annotator will figure out that self.w_new_function
# can only be None if the newshortcut config option is not set
w_newfunc = self.w_new_function
else:
# for the JIT it is better to take the slow path because normal lookup
# is nicely optimized, but the self.w_new_function attribute is not
# known to the JIT
w_newfunc = None
if w_newfunc is None:
w_newtype, w_newdescr = self.lookup_where('__new__')
if w_newdescr is None: # see test_crash_mro_without_object_1
raise oefmt(space.w_TypeError, "cannot create '%N' instances",
self)
#
# issue #2666
if space.config.objspace.usemodules.cpyext:
w_newtype, w_newdescr = self.hack_which_new_to_call(
w_newtype, w_newdescr)
#
w_newfunc = space.get(w_newdescr, space.w_None, w_type=self)
if (space.config.objspace.std.newshortcut and
not we_are_jitted() and space._side_effects_ok() and
isinstance(w_newtype, W_TypeObject)):
self.w_new_function = w_newfunc
w_newobject = space.call_obj_args(w_newfunc, self, __args__)
call_init = space.isinstance_w(w_newobject, self)
# maybe invoke the __init__ of the type
if (call_init and not (space.is_w(self, space.w_type) and
not __args__.keyword_names_w and len(__args__.arguments_w) == 1)):
w_descr = space.lookup(w_newobject, '__init__')
if w_descr is not None: # see test_crash_mro_without_object_2
w_result = space.get_and_call_args(w_descr, w_newobject,
> __args__)
objspace\std\typeobject.py:743:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_W_FileIO_ObjSpace_W_Root_text_int_W_Root object at 0x000002342e1b8db0>
space = StdObjSpace
scope_w = [<pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>, W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\s...\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None]
def _run(self, space, scope_w):
> return self.behavior(space.interp_w(W_FileIO, scope_w[0]), space, scope_w[1], space.text_w(scope_w[2]), space.gateway_int_w(scope_w[3]), scope_w[4])
<2459-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'r', closefd = 1, w_opener = None
@unwrap_spec(mode='text', closefd=int)
def descr_init(self, space, w_name, mode='r', closefd=True, w_opener=None):
if self.fd >= 0:
if self.closefd:
self._close(space)
else:
self.fd = -1
if space.isinstance_w(w_name, space.w_float):
raise oefmt(space.w_TypeError,
"integer argument expected, got float")
fd = -1
try:
fd = space.c_int_w(w_name)
except OperationError as e:
pass
else:
if fd < 0:
raise oefmt(space.w_ValueError, "negative file descriptor")
self.readable, self.writable, self.created, self.appending, flags = decode_mode(space, mode)
if rposix.O_CLOEXEC is not None:
flags |= rposix.O_CLOEXEC
fd_is_own = False
try:
if fd >= 0:
self.fd = fd
self.closefd = bool(closefd)
space.audit("open", [space.newint(fd), space.newtext(mode), space.newint(closefd)])
else:
space.audit("open", [w_name, space.newtext(mode), space.newint(1)])
self.closefd = True
if not closefd:
raise oefmt(space.w_ValueError,
"Cannot use closefd=False with file name")
if space.is_none(w_opener):
> self.fd = _open_fd(space, w_name, flags)
module\_io\interp_fileio.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
flags = 32768
def _open_fd(space, w_name, flags):
from pypy.module.posix.interp_posix import dispatch_filename, fspath
w_path = fspath(space, w_name)
while True:
try:
fd = dispatch_filename(rposix.open)(
> space, w_path, flags, 0666)
module\_io\interp_fileio.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_fname = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
args = (32768, 438)
fname = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
@specialize.argtype(1)
def dispatch(space, w_fname, *args):
if allow_fd_fn is not None:
try:
fd = space.c_int_w(w_fname)
except OperationError:
pass
else:
return allow_fd_fn(fd, *args)
if space.isinstance_w(w_fname, space.w_unicode):
fname = FileEncoder(space, w_fname)
> return func(fname, *args)
module\posix\interp_posix.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
flags = 32768, mode = 438
@replace_os_function('open')
@specialize.argtype(0)
@enforceargs(NOT_CONSTANT, int, int, typecheck=False)
def open(path, flags, mode):
if _WIN32:
utf8 = _as_utf80(path)
with rffi.scoped_utf82wcharp(utf8) as buf:
> fd = c_wopen(buf, flags, mode)
..\rpython\rlib\rposix.py:468:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<* DEAD Array of UniChar {'nolength': True} >, 32768, 438)
real_args = (<* DEAD Array of UniChar {'nolength': True} >, 32768L, 438L)
to_free = (), i = 2
def wrapper(*args):
assert len(args) == nb_args
real_args = ()
# XXX 'to_free' leaks if an allocation fails with MemoryError
# and was not the first in this function
to_free = ()
for i, TARGET in unrolling_arg_tps:
arg = args[i]
if TARGET == CCHARP or TARGET is VOIDP:
if arg is None:
from rpython.rtyper.annlowlevel import llstr
arg = lltype.nullptr(CCHARP.TO) # None => (char*)NULL
to_free = to_free + (arg, llstr(None), '\x04')
elif isinstance(arg, str):
tup = get_nonmovingbuffer_ll_final_null(arg)
to_free = to_free + tup
arg = tup[0]
elif isinstance(arg, unicode):
_oops()
elif TARGET == CWCHARP:
if arg is None:
arg = lltype.nullptr(CWCHARP.TO) # None => (wchar_t*)NULL
to_free = to_free + (arg,)
elif isinstance(arg, unicode):
arg = unicode2wcharp(arg)
to_free = to_free + (arg,)
elif _isfunctype(TARGET) and not _isllptr(arg):
# XXX pass additional arguments
use_gil = invoke_around_handlers
arg = llhelper(TARGET, _make_wrapper_for(TARGET, arg,
callbackholder,
use_gil))
else:
SOURCE = lltype.typeOf(arg)
if SOURCE != TARGET:
if TARGET is lltype.Float:
arg = float(arg)
elif ((isinstance(SOURCE, lltype.Number)
or SOURCE is lltype.Bool)
and (isinstance(TARGET, lltype.Number)
or TARGET is lltype.Bool)):
arg = cast(TARGET, arg)
real_args = real_args + (arg,)
> res = call_external_function(*real_args)
..\rpython\rtyper\lltypesystem\rffi.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a0 = <* DEAD Array of UniChar {'nolength': True} >, a1 = 32768L, a2 = 438L
def call_external_function(a0, a1, a2):
rgil.release()
# NB. it is essential that no exception checking occurs here!
if 1:
from rpython.rlib import rposix
rposix._errno_before(1)
if we_are_translated():
res = funcptr(a0, a1, a2)
else:
try: # only when non-translated
res = funcptr(a0, a1, a2)
except:
rgil.acquire()
raise
if 1:
from rpython.rlib import rposix
> rposix._errno_after(1)
<91-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py:217>:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
save_err = 1
@specialize.call_location()
def _errno_after(save_err):
if _WIN32:
if save_err & rffi.RFFI_SAVE_LASTERROR:
err = rwin32._GetLastError()
# careful, setraw() overwrites GetLastError.
# We must read it first, before the errno handling.
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
elif save_err & rffi.RFFI_SAVE_WSALASTERROR:
from rpython.rlib import _rsocket_rffi
err = _rsocket_rffi._WSAGetLastError()
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
if save_err & rffi.RFFI_SAVE_ERRNO:
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_errno.setraw(_get_errno())
else:
> rthread.tlfield_rpy_errno.setraw(_get_errno())
..\rpython\rlib\rposix.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <* fn get_errno>, args = ()
rffi = <module 'rpython.rtyper.lltypesystem.rffi' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\rtyper\\lltypesystem\\rffi.pyc'>
def __call__(self, *args):
from rpython.rtyper.lltypesystem import rffi
if isinstance(self._T, FuncType):
if len(args) != len(self._T.ARGS):
raise TypeError("calling %r with wrong argument number: %r" %
(self._T, args))
for i, a, ARG in zip(range(len(self._T.ARGS)), args, self._T.ARGS):
if typeOf(a) != ARG:
# ARG could be Void
if ARG == Void:
try:
value = getattr(self._obj, '_void' + str(i))
except AttributeError:
pass
else:
assert a == value
# None is acceptable for any pointer
elif isinstance(ARG, Ptr) and a is None:
pass
# Any pointer is convertible to void*
elif ARG is rffi.VOIDP and isinstance(typeOf(a), Ptr):
pass
# special case: ARG can be a container type, in which
# case a should be a pointer to it. This must also be
# special-cased in the backends.
elif (isinstance(ARG, ContainerType) and
typeOf(a) == Ptr(ARG)):
pass
else:
args_repr = [typeOf(arg) for arg in args]
raise TypeError("calling %r with wrong argument "
"types: %r" % (self._T, args_repr))
callb = self._obj._callable
if callb is None:
raise RuntimeError("calling undefined function")
> return callb(*args)
..\rpython\rtyper\lltypesystem\lltype.py:1384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.rtyper.lltypesystem.ll2ctypes.LL2CtypesCallable object at 0x0000023428d928a8>
argvalues = ()
def __call__(self, *argvalues):
with rlock:
if self.trampoline is None:
# lazily build the corresponding ctypes function object
cfunc = get_ctypes_callable(self.funcptr, self.calling_conv,
> self.natural_arity)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1339:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
funcptr = <* fn get_errno>, calling_conv = 'c', natural_arity = -1
def get_ctypes_callable(funcptr, calling_conv, natural_arity):
if not ctypes:
raise ImportError("ctypes is needed to use ll2ctypes")
def get_on_lib(lib, elem):
""" Wrapper to always use lib[func] instead of lib.func
"""
try:
return lib[elem]
except AttributeError:
pass
old_eci = funcptr._obj.compilation_info
funcname = funcptr._obj._name
if hasattr(old_eci, '_with_ctypes'):
old_eci = old_eci._with_ctypes
try:
eci = _eci_cache[old_eci]
except KeyError:
eci = old_eci.compile_shared_lib(ignore_a_files=True,
defines=['RPYTHON_LL2CTYPES'],
> symbolic=True)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1236:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
ignore_a_files = False, debug_mode = True, defines = ['RPYTHON_LL2CTYPES']
symbolic = True
def compile_shared_lib(self, outputfilename=None, ignore_a_files=False,
debug_mode=True, defines=[], symbolic=False):
self = self.convert_sources_to_files()
if ignore_a_files:
if not [fn for fn in self.link_files if fn.endswith('.a')]:
ignore_a_files = False # there are none
if not self.separate_module_files and not ignore_a_files:
return self # xxx there was some condition about win32 here
else:
#basepath = py.path.local(self.separate_module_files[0]).dirpath()
basepath = udir.join('shared_cache')
if outputfilename is None:
# find more or less unique name there
pth = basepath.join('externmod').new(ext=host.so_ext)
num = 0
while pth.check():
pth = basepath.join(
'externmod_%d' % (num,)).new(ext=host.so_ext)
num += 1
basepath.ensure(dir=1)
outputfilename = str(pth.dirpath().join(pth.purebasename))
d = self._copy_attributes()
if ignore_a_files:
d['link_files'] = [fn for fn in d['link_files']
if not fn.endswith('.a')]
if debug_mode and sys.platform != 'win32':
d['compile_extra'] = d['compile_extra'] + ('-g', '-O0')
d['compile_extra'] = d['compile_extra'] + (
'-DRPY_EXTERN=RPY_EXPORTED',)
for define in defines:
d['compile_extra'] += ('-D%s' % define,)
# On ELF platforms (Linux), prevent symbol interposition: when the host
# interpreter (e.g. pypy2.7) also exports symbols like pypysig_counter,
# the shared lib's own references would otherwise resolve to the host's
# copy via the GOT. -Bsymbolic makes the shared lib bind its own global
# symbol references to its own definitions. Only needed when running
# under a host interpreter (tests), not during translation.
if symbolic and sys.platform not in ('win32', 'darwin'):
d['link_extra'] = d['link_extra'] + ('-Wl,-Bsymbolic',)
self = ExternalCompilationInfo(**d)
lib = str(host.compile([], self, outputfilename=outputfilename,
> standalone=False))
..\rpython\translator\tool\cbuild.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cfiles = []
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def compile(self, cfiles, eci, outputfilename=None, standalone=True):
ofiles = self._compile_o_files(cfiles, eci, standalone)
> return self._finish_linking(ofiles, eci, outputfilename, standalone)
..\rpython\translator\platform\__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def _finish_linking(self, ofiles, eci, outputfilename, standalone):
if outputfilename is None:
outputfilename = ofiles[0].purebasename
if ofiles:
dirname = ofiles[0].dirpath()
else:
dirname = udir.join('module_cache')
exe_name = dirname.join(outputfilename, abs=True)
if standalone:
if self.exe_ext:
exe_name += '.' + self.exe_ext
else:
exe_name += '.' + self.so_ext
if eci.use_cpp_linker:
cc_link = 'g++' # XXX hard-coded so far
else:
cc_link = self.cc
largs = self._link_args_from_eci(eci, standalone)
> return self._link(cc_link, ofiles, largs, standalone, exe_name)
..\rpython\translator\platform\__init__.py:235:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'cl.exe'
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
link_args = ['/nologo', '/LARGEADDRESSAWARE', '/STACK:3145728', '/MANIFEST:EMBED', 'kernel32.lib']
standalone = False
exe_name = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _link(self, cc, ofiles, link_args, standalone, exe_name):
args = ['/nologo'] + [str(ofile) for ofile in ofiles] + link_args
args += ['/out:%s' % (exe_name,), '/incremental:no']
if not standalone:
args = self._args_for_shared(args)
# Tell the linker to embed a manifest with the default
# UAC level asInvoker (Visual Studio 2008 +)
args += ["/MANIFEST:EMBED"]
> self._execute_c_compiler(self.link, args, exe_name)
..\rpython\translator\platform\windows.py:303:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'link.exe'
args = ['/dll', '/nologo', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj', '/nologo', '/LARGEADDRESSAWARE', ...]
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
cwd = None
def _execute_c_compiler(self, cc, args, outname, cwd=None):
#log.execute(cc + ' ' + ' '.join(args))
# 'cc' can also contain some options for the C compiler;
# e.g. it can be "gcc -m32". We handle it by splitting on ' '.
cclist = cc.split()
cc = cclist[0]
args = cclist[1:] + args
returncode, stdout, stderr = _run_subprocess(cc, args, self.c_environ,
cwd)
> self._handle_error(returncode, stdout, stderr, outname)
..\rpython\translator\platform\__init__.py:143:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, returncode = 3221225477, stdout = ''
stderr = ''
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _handle_error(self, returncode, stdout, stderr, outname):
if returncode != 0:
# Microsoft compilers write compilation errors to stdout
stderr = stdout + stderr
errorfile = outname.new(ext='errors')
errorfile.write(stderr, mode='wb')
if self.log_errors:
stderrlines = stderr.splitlines()
for line in stderrlines:
log.Error(line)
# ^^^ don't use ERROR, because it might actually be fine.
# Also, ERROR confuses lib-python/conftest.py.
> raise CompilationError(stdout, stderr)
E CompilationError: CompilationError(out="""
E """)
..\rpython\translator\platform\windows.py:319: CompilationError
___________ ERROR at setup of AppTestStringObject.test_AsByteArray ____________
self = <CallInfo when='setup' exception: CompilationError(out="""
""")>
func = <function <lambda> at 0x00000234314859e8>, when = 'setup'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
..\_pytest\runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
..\_pytest\runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_setup'>
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_AsByteArray'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_AsByteArray'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
..\_pytest\vendored_packages\pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x0000023426593440>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_AsByteArray'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_AsByteArray'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
..\_pytest\vendored_packages\pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_AsByteArray'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_AsByteArray'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
..\_pytest\vendored_packages\pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_AsByteArray'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
..\_pytest\vendored_packages\pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_setup at 0x000002342ff97b78>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...sByteArray'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
..\_pytest\vendored_packages\pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x0000023430a50c20>
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
> _reraise(*ex) # noqa
..\_pytest\vendored_packages\pluggy.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x0000023430a50c20>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...sByteArray'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_AsByteArray'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
..\_pytest\vendored_packages\pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_AsByteArray'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
..\_pytest\runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_AsByteArray'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
> py.builtin._reraise(*col._prepare_exc)
..\_pytest\runner.py:404:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_basic'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
py.builtin._reraise(*col._prepare_exc)
for col in needed_collectors[len(self.stack):]:
self.stack.append(col)
try:
> col.setup()
..\_pytest\runner.py:408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
> super(AppClassCollector, self).setup()
tool\pytest\apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
setup_class = xunitsetup(self.obj, 'setup_class')
if setup_class is not None:
setup_class = getattr(setup_class, 'im_func', setup_class)
setup_class = getattr(setup_class, '__func__', setup_class)
> setup_class(self.obj)
..\_pytest\python.py:671:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'pypy.module.cpyext.test.test_bytearrayobject.AppTestStringObject'>
def setup_class(cls):
space = cls.space
cls.w_here = space.wrap(str(HERE))
cls.w_udir = space.wrap(str(udir))
cls.w_runappdirect = space.wrap(cls.runappdirect)
if not cls.runappdirect:
cls.sys_info = get_cpyext_info(space)
cls.w_debug_collect = space.wrap(interp2app(debug_collect))
cls.preload_builtins(space)
# Flush stdout once here to pre-create any file lock objects
# before we start counting allocations (moved from setup_method).
> space.call_method(space.sys.get("stdout"), "flush")
module\cpyext\test\test_cpyext.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
name = 'stdout'
def get(self, name):
space = self.space
> w_value = self.getdictvalue(space, name)
interpreter\mixedmodule.py:86:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
def getdictvalue(self, space, name):
w_value = space.finditem_str(self.w_dict, name)
if self.lazy and w_value is None:
> return self._load_lazily(space, name)
interpreter\mixedmodule.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
def _load_lazily(self, space, name):
w_name = space.new_interned_str(name)
try:
loader = self.loaders[name]
except KeyError:
return None
else:
> w_value = loader(space)
interpreter\mixedmodule.py:119:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
def afileloader(space):
> return app.wget(space, attrname)
interpreter\mixedmodule.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace, name = 'stdout'
def wget(self, space, name):
> w_globals = self.getwdict(space)
interpreter\gateway.py:1393:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
def getwdict(self, space):
> return space.fromcache(ApplevelCache).getorbuild(self)
interpreter\gateway.py:1386:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def getorbuild(self, key):
if lock: lock.acquire()
try:
try:
return self.content[key]
except KeyError:
if key in self._building:
raise RuntimeError("%s recursive building of %r" %
(self, key))
self._building[key] = True
try:
> result = self._build(key)
..\rpython\rlib\cache.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def _build(self, key):
> return self.build(key)
interpreter\baseobjspace.py:400:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
app = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
@not_rpython
def build(self, app):
"Called indirectly by Applevel.getwdict()."
> return build_applevel_dict(app, self.space)
interpreter\gateway.py:1437:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
@not_rpython
def build_applevel_dict(self, space):
w_glob = space.newdict(module=True)
space.setitem(w_glob, space.newtext('__name__'), space.newtext(self.modname))
space.exec_(self.source, w_glob, w_glob,
hidden_applevel=self.hidden_applevel,
> filename=self.filename)
interpreter\gateway.py:1448:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
statement = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
hidden_applevel = True
filename = 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'
@not_rpython
def exec_(self, statement, w_globals, w_locals, hidden_applevel=False,
filename=None):
"For internal debugging."
if filename is None:
filename = '?'
from pypy.interpreter.pycode import PyCode
if isinstance(statement, str):
statement = self._cached_compile(filename, statement, 'exec', 0, hidden_applevel)
if not isinstance(statement, PyCode):
raise TypeError('space.exec_(): expected a string, code or PyCode object')
w_key = self.newtext('__builtins__')
if not self.contains_w(w_globals, w_key):
self.setitem(w_globals, w_key, self.builtin)
> return statement.exec_code(self, w_globals, w_locals)
interpreter\baseobjspace.py:1408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
space = StdObjSpace
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_closure = None
def exec_code(self, space, w_globals, w_locals, w_closure=None):
"Implements the 'exec' statement."
# this should be on PyCode?
frame = space.createframe(self, w_globals, w_closure)
frame.setdictscope(w_locals, skip_free_vars=w_closure is not None)
> return frame.run()
interpreter\eval.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
name = None, qualname = None
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
pycode = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 24L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
self.CALL_METHOD(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD_KW.index:
> self.CALL_METHOD_KW(oparg, next_instr)
interpreter\pyopcode.py:315:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
n_arguments = 2, ignored = (24L,)
W_AbstractTupleObject = <class 'pypy.objspace.std.tupleobject.W_AbstractTupleObject'>
w_self = None, space = StdObjSpace
@jit.unroll_safe
def CALL_METHOD_KW(f, n_arguments, *ignored):
from pypy.objspace.std.tupleobject import W_AbstractTupleObject
# opargs contains the arg + kwarg count, excluding the implicit 'self'
w_self = f.peekvalue_maybe_none(n_arguments + 1)
space = f.space
# like in BUILD_CONST_KEY_MAP we can't use space.fixedview because then
# the immutability of the tuple is lost
w_tup_varnames = space.interp_w(W_AbstractTupleObject, f.popvalue())
n_keywords = space.len_w(w_tup_varnames)
keyword_names_w = [None] * n_keywords
keywords_w = [None] * n_keywords
for i in range(n_keywords):
keyword_names_w[i] = w_tup_varnames.getitem(space, i)
w_value = f.peekvalue(n_keywords - 1 - i)
keywords_w[i] = w_value
f.dropvalues(n_keywords)
n_arguments -= n_keywords
n = n_arguments + (w_self is not None)
arguments = f.popvalues(n) # includes w_self if it is not None
if w_self is None:
f.popvalue_maybe_none() # removes w_self, which is None
w_callable = f.popvalue()
args = f.argument_factory(
arguments, keyword_names_w, keywords_w, None, None,
methodcall=w_self is not None, w_function=w_callable)
if f.get_is_being_profiled() and function.is_builtin_code(w_callable):
w_result = f.space.call_args_and_c_profile(f, w_callable, args)
else:
> w_result = f.space.call_args(w_callable, args)
objspace\std\callmethod.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_text_int_text_or_none_text_or_none_text_or_none_int_W_Root object at 0x000002342f57f558>
space = StdObjSpace
scope_w = [W_IntObject(0), W_UnicodeObject('r'), W_IntObject(-1), W_UnicodeObject('utf-8'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, ...]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], space.text_w(scope_w[1]), space.gateway_int_w(scope_w[2]), space.text_or_none_w(scope_w[3]), space.text_or_none_w(scope_w[4]), space.text_or_none_w(scope_w[5]), space.gateway_int_w(scope_w[6]), scope_w[7])
<2604-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = 8192
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
space.newbool(bool(closefd)), w_opener)
else:
w_raw = W_FileIO(space)
w_raw.descr_init(space, w_file, rawmode, bool(closefd), w_opener)
w_result = w_raw
isatty = space.is_true(space.call_method(w_raw, "isatty"))
line_buffering = buffering == 1 or (buffering < 0 and isatty)
if line_buffering:
buffering = -1
if buffering < 0:
buffering = space.c_int_w(space.getattr(
w_raw, space.newtext("_blksize")))
if buffering < 0:
raise oefmt(space.w_ValueError, "invalid buffering size")
if buffering == 0:
if not binary:
raise oefmt(space.w_ValueError,
"can't have unbuffered text I/O")
return w_result
if updating:
w_buffer = W_BufferedRandom(space)
w_buffer.descr_init(space, w_raw, buffering)
elif writing or creating or appending:
w_buffer = W_BufferedWriter(space)
w_buffer.descr_init(space, w_raw, buffering)
elif reading:
w_buffer = W_BufferedReader(space)
w_buffer.descr_init(space, w_raw, buffering)
else:
raise oefmt(space.w_ValueError, "unknown mode: '%s'", mode)
w_result = w_buffer
if binary:
return w_result
w_wrapper = W_TextIOWrapper(space)
w_wrapper.descr_init(space, w_buffer, encoding,
space.newtext_or_none(errors),
space.newtext_or_none(newline),
> line_buffering)
module\_io\interp_io.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
space = StdObjSpace
w_buffer = <pypy.module._io.interp_bufferedio.W_BufferedReader object at 0x000002342f446758>
encoding = 'utf-8', w_errors = W_UnicodeObject('strict')
w_newline = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
line_buffering = True, write_through = 0
@unwrap_spec(encoding="text0_or_none", line_buffering=int, write_through=int)
def descr_init(self, space, w_buffer, encoding=None,
w_errors=None, w_newline=None, line_buffering=0,
write_through=0):
self.state = STATE_ZERO
self.w_buffer = w_buffer
self.w_encoding = w_encoding = _determine_encoding(space, encoding, w_buffer)
if space.is_none(w_errors) or w_errors is None:
w_errors = space.newtext("strict")
if not space.isinstance_w(w_errors, space.w_text):
raise oefmt(space.w_TypeError, "TextIOWrapper() argument 'errors' "
"must be str or None, not %N", w_errors)
io_check_errors(space, w_errors)
self.w_errors = w_errors
newline = unwrap_newline(space, w_newline)
self.line_buffering = bool(line_buffering)
self.write_through = bool(write_through)
self._set_newline(newline)
> self._set_encoder_decoder(w_encoding, w_errors)
module\_io\interp_textio.py:605:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
w_encoding = W_UnicodeObject('utf-8'), w_errors = W_UnicodeObject('strict')
def _set_encoder_decoder(self, w_encoding, w_errors):
space = self.space
w_codec = interp_codecs.lookup_codec(space,
> space.text_w(w_encoding))
module\_io\interp_textio.py:634:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8'
@unwrap_spec(encoding='text0')
def lookup_codec(space, encoding):
"""lookup(encoding) -> (encoder, decoder, stream_reader, stream_writer)
Looks up a codec tuple in the Python codec registry and returns
a tuple of functions.
"""
assert not (space.config.translating and not we_are_translated()), \
"lookup_codec() should not be called during translation"
state = space.fromcache(CodecState)
normalized_encoding = normalize(encoding)
w_result = state.get_codec_from_cache(normalized_encoding)
if w_result is not None:
return w_result
> return _lookup_codec_loop(space, encoding, normalized_encoding)
module\_codecs\interp_codecs.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8', normalized_encoding = 'utf_8'
def _lookup_codec_loop(space, encoding, normalized_encoding):
state = space.fromcache(CodecState)
if state.codec_need_encodings:
# registers new codecs.
# This import uses the "builtin" import method, and is needed
# to bootstrap the full importlib module.
w_import = space.getattr(space.builtin, space.newtext("__import__"))
> space.call_function(w_import, space.newtext("encodings"))
module\_codecs\interp_codecs.py:221:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),), nargs = 1
Function = <class 'pypy.interpreter.function.Function'>
_Method = <class 'pypy.interpreter.function._Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
> return w_func.funccall(*args_w)
interpreter\baseobjspace.py:1237:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),)
gateway = <module 'pypy.interpreter.gateway' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\interpreter\\gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
def funccall(self, *args_w): # speed hack
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
nargs = len(args_w)
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, args_w[0])
elif nargs == 2:
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, args_w[0], args_w[1])
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
return code.fastcall_3(self.space, self, args_w[0],
args_w[1], args_w[2])
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
return code.fastcall_4(self.space, self, args_w[0],
args_w[1], args_w[2], args_w[3])
elif (nargs | PyCode.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
if nargs < 5:
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in funccallunrolling:
if i < nargs:
new_frame.locals_cells_stack_w[i] = args_w[i]
return new_frame.run(self.name, self.qualname)
elif nargs >= 1 and fast_natural_arity == Code.PASSTHROUGHARGS1:
assert isinstance(code, gateway.BuiltinCodePassThroughArguments1)
return code.funcrun_obj(self, args_w[0],
Arguments(self.space,
list(args_w[1:])))
> return self.call_args(Arguments(self.space, list(args_w)))
interpreter\function.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_W_Root_W_Root_W_Root_W_Root object at 0x000002342c151be8>
space = StdObjSpace
scope_w = [W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], scope_w[1], scope_w[2], scope_w[3], scope_w[4])
<2115-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('encodings')
w_globals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_fromlist = W_TupleObject(), w_level = W_IntObject(0)
@unwrap_spec(w_globals=WrappedDefault(None), w_locals=WrappedDefault(None), w_fromlist=WrappedDefault(()),
w_level=WrappedDefault(0))
def interp___import__(space, w_name, w_globals, w_locals, w_fromlist,
w_level):
"""
Import a module. Because this function is meant for use by the Python
interpreter and not for general use, it is better to use
importlib.import_module() to programmatically import a module.
The globals argument is only used to determine the context;
they are not modified. The locals argument is unused. The fromlist
should be a list of names to emulate ``from name import ...'', or an
empty list to emulate ``import name''.
When importing a module from a package, note that __import__('A.B', ...)
returns package A when fromlist is empty, but its submodule B when
fromlist is not empty. The level argument is used to determine whether to
perform absolute or relative imports: 0 is absolute, while a positive number
is the number of parent directories to search relative to the current module."""
level = space.int_w(w_level)
if level == 0:
# fast path only for absolute imports without a "from" list, for now
# fromlist can be supported if we are importing from a module, not a
# package. to check that, look for the existence of __path__ attribute
# in w_mod
try:
name = space.text_w(w_name)
w_mod = _gcd_import(space, name)
have_fromlist = space.is_true(w_fromlist)
if not have_fromlist:
dotindex = name.find(".")
if dotindex < 0:
return w_mod
return _gcd_import(space, name[:dotindex])
except FastPathGiveUp:
pass
else:
assert have_fromlist
w_path = space.findattr(w_mod, space.newtext("__path__"))
if w_path is not None:
# hard case, a package! Call back into importlib
w_importlib = space.getbuiltinmodule('_frozen_importlib')
return space.call_method(w_importlib, "_handle_fromlist",
w_mod, w_fromlist,
space.w_default_importlib_import)
else:
return w_mod
try:
return space.call_function(
space.fromcache(FrozenCache).w_frozen_import, w_name, w_globals, w_locals, w_fromlist,
> w_level)
module\_frozen_importlib\interp_import.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function __import__>
args_w = (W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0))
nargs = 5
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
func = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def funcrun(self, func, args):
frame = self.space.createframe(self, func.w_func_globals,
func)
sig = self._signature
# speed hack
fresh_frame = jit.hint(frame, access_directly=True,
fresh_virtualizable=True)
args.parse_into_scope(None, fresh_frame.locals_cells_stack_w, func.qualname,
sig, func.defs_w, func.w_kw_defs)
fresh_frame.init_cells()
> return frame.run(func.name, func.qualname)
interpreter\pycode.py:280:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
name = '__import__', qualname = '__import__'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
oparg = 1, next_instr = 14L
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
return self._flat_pycall(code, nargs, frame, dropvalues)
elif fast_natural_arity & Code.FLATPYCALL:
natural_arity = fast_natural_arity & 0xff
if natural_arity > nargs >= natural_arity - len(self.defs_w):
assert isinstance(code, PyCode)
return self._flat_pycall_defaults(code, nargs, frame,
> natural_arity - nargs, dropvalues)
interpreter\function.py:193:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
defs_to_load = 2, dropvalues = 2
@jit.unroll_safe
def _flat_pycall_defaults(self, code, nargs, frame, defs_to_load, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
ndefs = len(self.defs_w)
start = ndefs - defs_to_load
i = nargs
for j in xrange(start, ndefs):
new_frame.locals_cells_stack_w[i] = self.defs_w[j]
i += 1
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:231:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
name = '_gcd_import', qualname = '_gcd_import'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 40
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
oparg = 2, next_instr = 40
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
name = '_find_and_load', qualname = '_find_and_load'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 82
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
oparg = 2, next_instr = 82
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>
code = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
name = '_find_and_load_unlocked', qualname = '_find_and_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
pycode = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 216
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
oparg = 1, next_instr = 216
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>
code = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
name = '_load_unlocked', qualname = '_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
pycode = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 132
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
oparg = 1, ignored = (132,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>
code = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
name = 'exec_module', qualname = '_LoaderBasics.exec_module'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
pycode = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 10L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
oparg = 1, ignored = (10L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>
code = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
name = 'get_code', qualname = 'SourceLoader.get_code'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
pycode = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 74L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
oparg = 1, ignored = (74L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>
code = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
name = 'get_data', qualname = 'FileLoader.get_data'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
pycode = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 26L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
oparg = 1, ignored = (26L,), n_args = 1, w_self = None, n = 1
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
> return code.fastcall_1(self.space, self, f_0)
interpreter\function.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
w_result = self.fastfunc_1(space, w1)
except DescrMismatch:
return self._type_unwrap_mismatch(space,
Arguments(space, [w1]))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:982:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
> w_result = self.fastfunc_1(space, w1)
interpreter\gateway.py:977:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
def open_code(space, w_file):
> return open(space, w_file, "rb")
module\_io\interp_io.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
> space.newbool(bool(closefd)), w_opener)
module\_io\interp_io.py:120:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args_w = (W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None)
nargs = 4, Function = <class 'pypy.interpreter.function.Function'>
_Method = <class 'pypy.interpreter.function._Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
return w_obj.call_args(args)
if isinstance(w_obj, Method):
return w_obj.call_args(args)
w_descr = space.lookup(w_obj, '__call__')
if w_descr is None:
raise oefmt(space.w_TypeError,
"'%T' object is not callable", w_obj)
> return space.get_and_call_args(w_descr, w_obj, args)
objspace\descroperation.py:199:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
w_result = self.func__args__(space, w_obj, args)
except DescrMismatch:
return self._type_unwrap_mismatch(space, args.prepend(w_obj))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:941:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
> w_result = self.func__args__(space, w_obj, args)
interpreter\gateway.py:937:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def _call(space, w_obj, args):
self = space.descr_self_interp_w(self_type, w_obj)
> return func(self, space, args)
<282-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:4:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <W_TypeObject '_io.FileIO' at 0x2342f626d78>, space = StdObjSpace
__args__ = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def descr_call(self, space, __args__):
promote(self)
# invoke the __new__ of the type
if not we_are_jitted():
# note that the annotator will figure out that self.w_new_function
# can only be None if the newshortcut config option is not set
w_newfunc = self.w_new_function
else:
# for the JIT it is better to take the slow path because normal lookup
# is nicely optimized, but the self.w_new_function attribute is not
# known to the JIT
w_newfunc = None
if w_newfunc is None:
w_newtype, w_newdescr = self.lookup_where('__new__')
if w_newdescr is None: # see test_crash_mro_without_object_1
raise oefmt(space.w_TypeError, "cannot create '%N' instances",
self)
#
# issue #2666
if space.config.objspace.usemodules.cpyext:
w_newtype, w_newdescr = self.hack_which_new_to_call(
w_newtype, w_newdescr)
#
w_newfunc = space.get(w_newdescr, space.w_None, w_type=self)
if (space.config.objspace.std.newshortcut and
not we_are_jitted() and space._side_effects_ok() and
isinstance(w_newtype, W_TypeObject)):
self.w_new_function = w_newfunc
w_newobject = space.call_obj_args(w_newfunc, self, __args__)
call_init = space.isinstance_w(w_newobject, self)
# maybe invoke the __init__ of the type
if (call_init and not (space.is_w(self, space.w_type) and
not __args__.keyword_names_w and len(__args__.arguments_w) == 1)):
w_descr = space.lookup(w_newobject, '__init__')
if w_descr is not None: # see test_crash_mro_without_object_2
w_result = space.get_and_call_args(w_descr, w_newobject,
> __args__)
objspace\std\typeobject.py:743:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_W_FileIO_ObjSpace_W_Root_text_int_W_Root object at 0x000002342e1b8db0>
space = StdObjSpace
scope_w = [<pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>, W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\s...\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None]
def _run(self, space, scope_w):
> return self.behavior(space.interp_w(W_FileIO, scope_w[0]), space, scope_w[1], space.text_w(scope_w[2]), space.gateway_int_w(scope_w[3]), scope_w[4])
<2459-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'r', closefd = 1, w_opener = None
@unwrap_spec(mode='text', closefd=int)
def descr_init(self, space, w_name, mode='r', closefd=True, w_opener=None):
if self.fd >= 0:
if self.closefd:
self._close(space)
else:
self.fd = -1
if space.isinstance_w(w_name, space.w_float):
raise oefmt(space.w_TypeError,
"integer argument expected, got float")
fd = -1
try:
fd = space.c_int_w(w_name)
except OperationError as e:
pass
else:
if fd < 0:
raise oefmt(space.w_ValueError, "negative file descriptor")
self.readable, self.writable, self.created, self.appending, flags = decode_mode(space, mode)
if rposix.O_CLOEXEC is not None:
flags |= rposix.O_CLOEXEC
fd_is_own = False
try:
if fd >= 0:
self.fd = fd
self.closefd = bool(closefd)
space.audit("open", [space.newint(fd), space.newtext(mode), space.newint(closefd)])
else:
space.audit("open", [w_name, space.newtext(mode), space.newint(1)])
self.closefd = True
if not closefd:
raise oefmt(space.w_ValueError,
"Cannot use closefd=False with file name")
if space.is_none(w_opener):
> self.fd = _open_fd(space, w_name, flags)
module\_io\interp_fileio.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
flags = 32768
def _open_fd(space, w_name, flags):
from pypy.module.posix.interp_posix import dispatch_filename, fspath
w_path = fspath(space, w_name)
while True:
try:
fd = dispatch_filename(rposix.open)(
> space, w_path, flags, 0666)
module\_io\interp_fileio.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_fname = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
args = (32768, 438)
fname = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
@specialize.argtype(1)
def dispatch(space, w_fname, *args):
if allow_fd_fn is not None:
try:
fd = space.c_int_w(w_fname)
except OperationError:
pass
else:
return allow_fd_fn(fd, *args)
if space.isinstance_w(w_fname, space.w_unicode):
fname = FileEncoder(space, w_fname)
> return func(fname, *args)
module\posix\interp_posix.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
flags = 32768, mode = 438
@replace_os_function('open')
@specialize.argtype(0)
@enforceargs(NOT_CONSTANT, int, int, typecheck=False)
def open(path, flags, mode):
if _WIN32:
utf8 = _as_utf80(path)
with rffi.scoped_utf82wcharp(utf8) as buf:
> fd = c_wopen(buf, flags, mode)
..\rpython\rlib\rposix.py:468:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<* DEAD Array of UniChar {'nolength': True} >, 32768, 438)
real_args = (<* DEAD Array of UniChar {'nolength': True} >, 32768L, 438L)
to_free = (), i = 2
def wrapper(*args):
assert len(args) == nb_args
real_args = ()
# XXX 'to_free' leaks if an allocation fails with MemoryError
# and was not the first in this function
to_free = ()
for i, TARGET in unrolling_arg_tps:
arg = args[i]
if TARGET == CCHARP or TARGET is VOIDP:
if arg is None:
from rpython.rtyper.annlowlevel import llstr
arg = lltype.nullptr(CCHARP.TO) # None => (char*)NULL
to_free = to_free + (arg, llstr(None), '\x04')
elif isinstance(arg, str):
tup = get_nonmovingbuffer_ll_final_null(arg)
to_free = to_free + tup
arg = tup[0]
elif isinstance(arg, unicode):
_oops()
elif TARGET == CWCHARP:
if arg is None:
arg = lltype.nullptr(CWCHARP.TO) # None => (wchar_t*)NULL
to_free = to_free + (arg,)
elif isinstance(arg, unicode):
arg = unicode2wcharp(arg)
to_free = to_free + (arg,)
elif _isfunctype(TARGET) and not _isllptr(arg):
# XXX pass additional arguments
use_gil = invoke_around_handlers
arg = llhelper(TARGET, _make_wrapper_for(TARGET, arg,
callbackholder,
use_gil))
else:
SOURCE = lltype.typeOf(arg)
if SOURCE != TARGET:
if TARGET is lltype.Float:
arg = float(arg)
elif ((isinstance(SOURCE, lltype.Number)
or SOURCE is lltype.Bool)
and (isinstance(TARGET, lltype.Number)
or TARGET is lltype.Bool)):
arg = cast(TARGET, arg)
real_args = real_args + (arg,)
> res = call_external_function(*real_args)
..\rpython\rtyper\lltypesystem\rffi.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a0 = <* DEAD Array of UniChar {'nolength': True} >, a1 = 32768L, a2 = 438L
def call_external_function(a0, a1, a2):
rgil.release()
# NB. it is essential that no exception checking occurs here!
if 1:
from rpython.rlib import rposix
rposix._errno_before(1)
if we_are_translated():
res = funcptr(a0, a1, a2)
else:
try: # only when non-translated
res = funcptr(a0, a1, a2)
except:
rgil.acquire()
raise
if 1:
from rpython.rlib import rposix
> rposix._errno_after(1)
<91-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py:217>:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
save_err = 1
@specialize.call_location()
def _errno_after(save_err):
if _WIN32:
if save_err & rffi.RFFI_SAVE_LASTERROR:
err = rwin32._GetLastError()
# careful, setraw() overwrites GetLastError.
# We must read it first, before the errno handling.
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
elif save_err & rffi.RFFI_SAVE_WSALASTERROR:
from rpython.rlib import _rsocket_rffi
err = _rsocket_rffi._WSAGetLastError()
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
if save_err & rffi.RFFI_SAVE_ERRNO:
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_errno.setraw(_get_errno())
else:
> rthread.tlfield_rpy_errno.setraw(_get_errno())
..\rpython\rlib\rposix.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <* fn get_errno>, args = ()
rffi = <module 'rpython.rtyper.lltypesystem.rffi' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\rtyper\\lltypesystem\\rffi.pyc'>
def __call__(self, *args):
from rpython.rtyper.lltypesystem import rffi
if isinstance(self._T, FuncType):
if len(args) != len(self._T.ARGS):
raise TypeError("calling %r with wrong argument number: %r" %
(self._T, args))
for i, a, ARG in zip(range(len(self._T.ARGS)), args, self._T.ARGS):
if typeOf(a) != ARG:
# ARG could be Void
if ARG == Void:
try:
value = getattr(self._obj, '_void' + str(i))
except AttributeError:
pass
else:
assert a == value
# None is acceptable for any pointer
elif isinstance(ARG, Ptr) and a is None:
pass
# Any pointer is convertible to void*
elif ARG is rffi.VOIDP and isinstance(typeOf(a), Ptr):
pass
# special case: ARG can be a container type, in which
# case a should be a pointer to it. This must also be
# special-cased in the backends.
elif (isinstance(ARG, ContainerType) and
typeOf(a) == Ptr(ARG)):
pass
else:
args_repr = [typeOf(arg) for arg in args]
raise TypeError("calling %r with wrong argument "
"types: %r" % (self._T, args_repr))
callb = self._obj._callable
if callb is None:
raise RuntimeError("calling undefined function")
> return callb(*args)
..\rpython\rtyper\lltypesystem\lltype.py:1384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.rtyper.lltypesystem.ll2ctypes.LL2CtypesCallable object at 0x0000023428d928a8>
argvalues = ()
def __call__(self, *argvalues):
with rlock:
if self.trampoline is None:
# lazily build the corresponding ctypes function object
cfunc = get_ctypes_callable(self.funcptr, self.calling_conv,
> self.natural_arity)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1339:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
funcptr = <* fn get_errno>, calling_conv = 'c', natural_arity = -1
def get_ctypes_callable(funcptr, calling_conv, natural_arity):
if not ctypes:
raise ImportError("ctypes is needed to use ll2ctypes")
def get_on_lib(lib, elem):
""" Wrapper to always use lib[func] instead of lib.func
"""
try:
return lib[elem]
except AttributeError:
pass
old_eci = funcptr._obj.compilation_info
funcname = funcptr._obj._name
if hasattr(old_eci, '_with_ctypes'):
old_eci = old_eci._with_ctypes
try:
eci = _eci_cache[old_eci]
except KeyError:
eci = old_eci.compile_shared_lib(ignore_a_files=True,
defines=['RPYTHON_LL2CTYPES'],
> symbolic=True)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1236:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
ignore_a_files = False, debug_mode = True, defines = ['RPYTHON_LL2CTYPES']
symbolic = True
def compile_shared_lib(self, outputfilename=None, ignore_a_files=False,
debug_mode=True, defines=[], symbolic=False):
self = self.convert_sources_to_files()
if ignore_a_files:
if not [fn for fn in self.link_files if fn.endswith('.a')]:
ignore_a_files = False # there are none
if not self.separate_module_files and not ignore_a_files:
return self # xxx there was some condition about win32 here
else:
#basepath = py.path.local(self.separate_module_files[0]).dirpath()
basepath = udir.join('shared_cache')
if outputfilename is None:
# find more or less unique name there
pth = basepath.join('externmod').new(ext=host.so_ext)
num = 0
while pth.check():
pth = basepath.join(
'externmod_%d' % (num,)).new(ext=host.so_ext)
num += 1
basepath.ensure(dir=1)
outputfilename = str(pth.dirpath().join(pth.purebasename))
d = self._copy_attributes()
if ignore_a_files:
d['link_files'] = [fn for fn in d['link_files']
if not fn.endswith('.a')]
if debug_mode and sys.platform != 'win32':
d['compile_extra'] = d['compile_extra'] + ('-g', '-O0')
d['compile_extra'] = d['compile_extra'] + (
'-DRPY_EXTERN=RPY_EXPORTED',)
for define in defines:
d['compile_extra'] += ('-D%s' % define,)
# On ELF platforms (Linux), prevent symbol interposition: when the host
# interpreter (e.g. pypy2.7) also exports symbols like pypysig_counter,
# the shared lib's own references would otherwise resolve to the host's
# copy via the GOT. -Bsymbolic makes the shared lib bind its own global
# symbol references to its own definitions. Only needed when running
# under a host interpreter (tests), not during translation.
if symbolic and sys.platform not in ('win32', 'darwin'):
d['link_extra'] = d['link_extra'] + ('-Wl,-Bsymbolic',)
self = ExternalCompilationInfo(**d)
lib = str(host.compile([], self, outputfilename=outputfilename,
> standalone=False))
..\rpython\translator\tool\cbuild.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cfiles = []
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def compile(self, cfiles, eci, outputfilename=None, standalone=True):
ofiles = self._compile_o_files(cfiles, eci, standalone)
> return self._finish_linking(ofiles, eci, outputfilename, standalone)
..\rpython\translator\platform\__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def _finish_linking(self, ofiles, eci, outputfilename, standalone):
if outputfilename is None:
outputfilename = ofiles[0].purebasename
if ofiles:
dirname = ofiles[0].dirpath()
else:
dirname = udir.join('module_cache')
exe_name = dirname.join(outputfilename, abs=True)
if standalone:
if self.exe_ext:
exe_name += '.' + self.exe_ext
else:
exe_name += '.' + self.so_ext
if eci.use_cpp_linker:
cc_link = 'g++' # XXX hard-coded so far
else:
cc_link = self.cc
largs = self._link_args_from_eci(eci, standalone)
> return self._link(cc_link, ofiles, largs, standalone, exe_name)
..\rpython\translator\platform\__init__.py:235:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'cl.exe'
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
link_args = ['/nologo', '/LARGEADDRESSAWARE', '/STACK:3145728', '/MANIFEST:EMBED', 'kernel32.lib']
standalone = False
exe_name = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _link(self, cc, ofiles, link_args, standalone, exe_name):
args = ['/nologo'] + [str(ofile) for ofile in ofiles] + link_args
args += ['/out:%s' % (exe_name,), '/incremental:no']
if not standalone:
args = self._args_for_shared(args)
# Tell the linker to embed a manifest with the default
# UAC level asInvoker (Visual Studio 2008 +)
args += ["/MANIFEST:EMBED"]
> self._execute_c_compiler(self.link, args, exe_name)
..\rpython\translator\platform\windows.py:303:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'link.exe'
args = ['/dll', '/nologo', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj', '/nologo', '/LARGEADDRESSAWARE', ...]
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
cwd = None
def _execute_c_compiler(self, cc, args, outname, cwd=None):
#log.execute(cc + ' ' + ' '.join(args))
# 'cc' can also contain some options for the C compiler;
# e.g. it can be "gcc -m32". We handle it by splitting on ' '.
cclist = cc.split()
cc = cclist[0]
args = cclist[1:] + args
returncode, stdout, stderr = _run_subprocess(cc, args, self.c_environ,
cwd)
> self._handle_error(returncode, stdout, stderr, outname)
..\rpython\translator\platform\__init__.py:143:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, returncode = 3221225477, stdout = ''
stderr = ''
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _handle_error(self, returncode, stdout, stderr, outname):
if returncode != 0:
# Microsoft compilers write compilation errors to stdout
stderr = stdout + stderr
errorfile = outname.new(ext='errors')
errorfile.write(stderr, mode='wb')
if self.log_errors:
stderrlines = stderr.splitlines()
for line in stderrlines:
log.Error(line)
# ^^^ don't use ERROR, because it might actually be fine.
# Also, ERROR confuses lib-python/conftest.py.
> raise CompilationError(stdout, stderr)
E CompilationError: CompilationError(out="""
E """)
..\rpython\translator\platform\windows.py:319: CompilationError
__________ ERROR at setup of AppTestStringObject.test_manipulations ___________
self = <CallInfo when='setup' exception: CompilationError(out="""
""")>
func = <function <lambda> at 0x00000234326c54c0>, when = 'setup'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
..\_pytest\runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
..\_pytest\runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_setup'>
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_manipulations'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_manipulations'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
..\_pytest\vendored_packages\pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x0000023426593440>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_manipulations'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_manipulations'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
..\_pytest\vendored_packages\pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_manipulations'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_manipulations'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
..\_pytest\vendored_packages\pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_manipulations'>, '__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 0x000002342ffb3c18>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ipulations'>, '__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 0x00000234374c3d60>
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 0x00000234374c3d60>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ipulations'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_manipulations'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
..\_pytest\vendored_packages\pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_manipulations'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
..\_pytest\runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_manipulations'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
> py.builtin._reraise(*col._prepare_exc)
..\_pytest\runner.py:404:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_basic'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
py.builtin._reraise(*col._prepare_exc)
for col in needed_collectors[len(self.stack):]:
self.stack.append(col)
try:
> col.setup()
..\_pytest\runner.py:408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
> super(AppClassCollector, self).setup()
tool\pytest\apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
setup_class = xunitsetup(self.obj, 'setup_class')
if setup_class is not None:
setup_class = getattr(setup_class, 'im_func', setup_class)
setup_class = getattr(setup_class, '__func__', setup_class)
> setup_class(self.obj)
..\_pytest\python.py:671:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'pypy.module.cpyext.test.test_bytearrayobject.AppTestStringObject'>
def setup_class(cls):
space = cls.space
cls.w_here = space.wrap(str(HERE))
cls.w_udir = space.wrap(str(udir))
cls.w_runappdirect = space.wrap(cls.runappdirect)
if not cls.runappdirect:
cls.sys_info = get_cpyext_info(space)
cls.w_debug_collect = space.wrap(interp2app(debug_collect))
cls.preload_builtins(space)
# Flush stdout once here to pre-create any file lock objects
# before we start counting allocations (moved from setup_method).
> space.call_method(space.sys.get("stdout"), "flush")
module\cpyext\test\test_cpyext.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
name = 'stdout'
def get(self, name):
space = self.space
> w_value = self.getdictvalue(space, name)
interpreter\mixedmodule.py:86:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
def getdictvalue(self, space, name):
w_value = space.finditem_str(self.w_dict, name)
if self.lazy and w_value is None:
> return self._load_lazily(space, name)
interpreter\mixedmodule.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
def _load_lazily(self, space, name):
w_name = space.new_interned_str(name)
try:
loader = self.loaders[name]
except KeyError:
return None
else:
> w_value = loader(space)
interpreter\mixedmodule.py:119:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
def afileloader(space):
> return app.wget(space, attrname)
interpreter\mixedmodule.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace, name = 'stdout'
def wget(self, space, name):
> w_globals = self.getwdict(space)
interpreter\gateway.py:1393:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
def getwdict(self, space):
> return space.fromcache(ApplevelCache).getorbuild(self)
interpreter\gateway.py:1386:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def getorbuild(self, key):
if lock: lock.acquire()
try:
try:
return self.content[key]
except KeyError:
if key in self._building:
raise RuntimeError("%s recursive building of %r" %
(self, key))
self._building[key] = True
try:
> result = self._build(key)
..\rpython\rlib\cache.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def _build(self, key):
> return self.build(key)
interpreter\baseobjspace.py:400:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
app = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
@not_rpython
def build(self, app):
"Called indirectly by Applevel.getwdict()."
> return build_applevel_dict(app, self.space)
interpreter\gateway.py:1437:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
@not_rpython
def build_applevel_dict(self, space):
w_glob = space.newdict(module=True)
space.setitem(w_glob, space.newtext('__name__'), space.newtext(self.modname))
space.exec_(self.source, w_glob, w_glob,
hidden_applevel=self.hidden_applevel,
> filename=self.filename)
interpreter\gateway.py:1448:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
statement = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
hidden_applevel = True
filename = 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'
@not_rpython
def exec_(self, statement, w_globals, w_locals, hidden_applevel=False,
filename=None):
"For internal debugging."
if filename is None:
filename = '?'
from pypy.interpreter.pycode import PyCode
if isinstance(statement, str):
statement = self._cached_compile(filename, statement, 'exec', 0, hidden_applevel)
if not isinstance(statement, PyCode):
raise TypeError('space.exec_(): expected a string, code or PyCode object')
w_key = self.newtext('__builtins__')
if not self.contains_w(w_globals, w_key):
self.setitem(w_globals, w_key, self.builtin)
> return statement.exec_code(self, w_globals, w_locals)
interpreter\baseobjspace.py:1408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
space = StdObjSpace
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_closure = None
def exec_code(self, space, w_globals, w_locals, w_closure=None):
"Implements the 'exec' statement."
# this should be on PyCode?
frame = space.createframe(self, w_globals, w_closure)
frame.setdictscope(w_locals, skip_free_vars=w_closure is not None)
> return frame.run()
interpreter\eval.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
name = None, qualname = None
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
pycode = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 24L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
self.CALL_METHOD(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD_KW.index:
> self.CALL_METHOD_KW(oparg, next_instr)
interpreter\pyopcode.py:315:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
n_arguments = 2, ignored = (24L,)
W_AbstractTupleObject = <class 'pypy.objspace.std.tupleobject.W_AbstractTupleObject'>
w_self = None, space = StdObjSpace
@jit.unroll_safe
def CALL_METHOD_KW(f, n_arguments, *ignored):
from pypy.objspace.std.tupleobject import W_AbstractTupleObject
# opargs contains the arg + kwarg count, excluding the implicit 'self'
w_self = f.peekvalue_maybe_none(n_arguments + 1)
space = f.space
# like in BUILD_CONST_KEY_MAP we can't use space.fixedview because then
# the immutability of the tuple is lost
w_tup_varnames = space.interp_w(W_AbstractTupleObject, f.popvalue())
n_keywords = space.len_w(w_tup_varnames)
keyword_names_w = [None] * n_keywords
keywords_w = [None] * n_keywords
for i in range(n_keywords):
keyword_names_w[i] = w_tup_varnames.getitem(space, i)
w_value = f.peekvalue(n_keywords - 1 - i)
keywords_w[i] = w_value
f.dropvalues(n_keywords)
n_arguments -= n_keywords
n = n_arguments + (w_self is not None)
arguments = f.popvalues(n) # includes w_self if it is not None
if w_self is None:
f.popvalue_maybe_none() # removes w_self, which is None
w_callable = f.popvalue()
args = f.argument_factory(
arguments, keyword_names_w, keywords_w, None, None,
methodcall=w_self is not None, w_function=w_callable)
if f.get_is_being_profiled() and function.is_builtin_code(w_callable):
w_result = f.space.call_args_and_c_profile(f, w_callable, args)
else:
> w_result = f.space.call_args(w_callable, args)
objspace\std\callmethod.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_text_int_text_or_none_text_or_none_text_or_none_int_W_Root object at 0x000002342f57f558>
space = StdObjSpace
scope_w = [W_IntObject(0), W_UnicodeObject('r'), W_IntObject(-1), W_UnicodeObject('utf-8'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, ...]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], space.text_w(scope_w[1]), space.gateway_int_w(scope_w[2]), space.text_or_none_w(scope_w[3]), space.text_or_none_w(scope_w[4]), space.text_or_none_w(scope_w[5]), space.gateway_int_w(scope_w[6]), scope_w[7])
<2604-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = 8192
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
space.newbool(bool(closefd)), w_opener)
else:
w_raw = W_FileIO(space)
w_raw.descr_init(space, w_file, rawmode, bool(closefd), w_opener)
w_result = w_raw
isatty = space.is_true(space.call_method(w_raw, "isatty"))
line_buffering = buffering == 1 or (buffering < 0 and isatty)
if line_buffering:
buffering = -1
if buffering < 0:
buffering = space.c_int_w(space.getattr(
w_raw, space.newtext("_blksize")))
if buffering < 0:
raise oefmt(space.w_ValueError, "invalid buffering size")
if buffering == 0:
if not binary:
raise oefmt(space.w_ValueError,
"can't have unbuffered text I/O")
return w_result
if updating:
w_buffer = W_BufferedRandom(space)
w_buffer.descr_init(space, w_raw, buffering)
elif writing or creating or appending:
w_buffer = W_BufferedWriter(space)
w_buffer.descr_init(space, w_raw, buffering)
elif reading:
w_buffer = W_BufferedReader(space)
w_buffer.descr_init(space, w_raw, buffering)
else:
raise oefmt(space.w_ValueError, "unknown mode: '%s'", mode)
w_result = w_buffer
if binary:
return w_result
w_wrapper = W_TextIOWrapper(space)
w_wrapper.descr_init(space, w_buffer, encoding,
space.newtext_or_none(errors),
space.newtext_or_none(newline),
> line_buffering)
module\_io\interp_io.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
space = StdObjSpace
w_buffer = <pypy.module._io.interp_bufferedio.W_BufferedReader object at 0x000002342f446758>
encoding = 'utf-8', w_errors = W_UnicodeObject('strict')
w_newline = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
line_buffering = True, write_through = 0
@unwrap_spec(encoding="text0_or_none", line_buffering=int, write_through=int)
def descr_init(self, space, w_buffer, encoding=None,
w_errors=None, w_newline=None, line_buffering=0,
write_through=0):
self.state = STATE_ZERO
self.w_buffer = w_buffer
self.w_encoding = w_encoding = _determine_encoding(space, encoding, w_buffer)
if space.is_none(w_errors) or w_errors is None:
w_errors = space.newtext("strict")
if not space.isinstance_w(w_errors, space.w_text):
raise oefmt(space.w_TypeError, "TextIOWrapper() argument 'errors' "
"must be str or None, not %N", w_errors)
io_check_errors(space, w_errors)
self.w_errors = w_errors
newline = unwrap_newline(space, w_newline)
self.line_buffering = bool(line_buffering)
self.write_through = bool(write_through)
self._set_newline(newline)
> self._set_encoder_decoder(w_encoding, w_errors)
module\_io\interp_textio.py:605:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
w_encoding = W_UnicodeObject('utf-8'), w_errors = W_UnicodeObject('strict')
def _set_encoder_decoder(self, w_encoding, w_errors):
space = self.space
w_codec = interp_codecs.lookup_codec(space,
> space.text_w(w_encoding))
module\_io\interp_textio.py:634:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8'
@unwrap_spec(encoding='text0')
def lookup_codec(space, encoding):
"""lookup(encoding) -> (encoder, decoder, stream_reader, stream_writer)
Looks up a codec tuple in the Python codec registry and returns
a tuple of functions.
"""
assert not (space.config.translating and not we_are_translated()), \
"lookup_codec() should not be called during translation"
state = space.fromcache(CodecState)
normalized_encoding = normalize(encoding)
w_result = state.get_codec_from_cache(normalized_encoding)
if w_result is not None:
return w_result
> return _lookup_codec_loop(space, encoding, normalized_encoding)
module\_codecs\interp_codecs.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8', normalized_encoding = 'utf_8'
def _lookup_codec_loop(space, encoding, normalized_encoding):
state = space.fromcache(CodecState)
if state.codec_need_encodings:
# registers new codecs.
# This import uses the "builtin" import method, and is needed
# to bootstrap the full importlib module.
w_import = space.getattr(space.builtin, space.newtext("__import__"))
> space.call_function(w_import, space.newtext("encodings"))
module\_codecs\interp_codecs.py:221:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),), nargs = 1
Function = <class 'pypy.interpreter.function.Function'>
_Method = <class 'pypy.interpreter.function._Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
> return w_func.funccall(*args_w)
interpreter\baseobjspace.py:1237:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),)
gateway = <module 'pypy.interpreter.gateway' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\interpreter\\gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
def funccall(self, *args_w): # speed hack
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
nargs = len(args_w)
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, args_w[0])
elif nargs == 2:
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, args_w[0], args_w[1])
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
return code.fastcall_3(self.space, self, args_w[0],
args_w[1], args_w[2])
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
return code.fastcall_4(self.space, self, args_w[0],
args_w[1], args_w[2], args_w[3])
elif (nargs | PyCode.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
if nargs < 5:
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in funccallunrolling:
if i < nargs:
new_frame.locals_cells_stack_w[i] = args_w[i]
return new_frame.run(self.name, self.qualname)
elif nargs >= 1 and fast_natural_arity == Code.PASSTHROUGHARGS1:
assert isinstance(code, gateway.BuiltinCodePassThroughArguments1)
return code.funcrun_obj(self, args_w[0],
Arguments(self.space,
list(args_w[1:])))
> return self.call_args(Arguments(self.space, list(args_w)))
interpreter\function.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_W_Root_W_Root_W_Root_W_Root object at 0x000002342c151be8>
space = StdObjSpace
scope_w = [W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], scope_w[1], scope_w[2], scope_w[3], scope_w[4])
<2115-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('encodings')
w_globals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_fromlist = W_TupleObject(), w_level = W_IntObject(0)
@unwrap_spec(w_globals=WrappedDefault(None), w_locals=WrappedDefault(None), w_fromlist=WrappedDefault(()),
w_level=WrappedDefault(0))
def interp___import__(space, w_name, w_globals, w_locals, w_fromlist,
w_level):
"""
Import a module. Because this function is meant for use by the Python
interpreter and not for general use, it is better to use
importlib.import_module() to programmatically import a module.
The globals argument is only used to determine the context;
they are not modified. The locals argument is unused. The fromlist
should be a list of names to emulate ``from name import ...'', or an
empty list to emulate ``import name''.
When importing a module from a package, note that __import__('A.B', ...)
returns package A when fromlist is empty, but its submodule B when
fromlist is not empty. The level argument is used to determine whether to
perform absolute or relative imports: 0 is absolute, while a positive number
is the number of parent directories to search relative to the current module."""
level = space.int_w(w_level)
if level == 0:
# fast path only for absolute imports without a "from" list, for now
# fromlist can be supported if we are importing from a module, not a
# package. to check that, look for the existence of __path__ attribute
# in w_mod
try:
name = space.text_w(w_name)
w_mod = _gcd_import(space, name)
have_fromlist = space.is_true(w_fromlist)
if not have_fromlist:
dotindex = name.find(".")
if dotindex < 0:
return w_mod
return _gcd_import(space, name[:dotindex])
except FastPathGiveUp:
pass
else:
assert have_fromlist
w_path = space.findattr(w_mod, space.newtext("__path__"))
if w_path is not None:
# hard case, a package! Call back into importlib
w_importlib = space.getbuiltinmodule('_frozen_importlib')
return space.call_method(w_importlib, "_handle_fromlist",
w_mod, w_fromlist,
space.w_default_importlib_import)
else:
return w_mod
try:
return space.call_function(
space.fromcache(FrozenCache).w_frozen_import, w_name, w_globals, w_locals, w_fromlist,
> w_level)
module\_frozen_importlib\interp_import.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function __import__>
args_w = (W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0))
nargs = 5
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
func = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def funcrun(self, func, args):
frame = self.space.createframe(self, func.w_func_globals,
func)
sig = self._signature
# speed hack
fresh_frame = jit.hint(frame, access_directly=True,
fresh_virtualizable=True)
args.parse_into_scope(None, fresh_frame.locals_cells_stack_w, func.qualname,
sig, func.defs_w, func.w_kw_defs)
fresh_frame.init_cells()
> return frame.run(func.name, func.qualname)
interpreter\pycode.py:280:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
name = '__import__', qualname = '__import__'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
oparg = 1, next_instr = 14L
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
return self._flat_pycall(code, nargs, frame, dropvalues)
elif fast_natural_arity & Code.FLATPYCALL:
natural_arity = fast_natural_arity & 0xff
if natural_arity > nargs >= natural_arity - len(self.defs_w):
assert isinstance(code, PyCode)
return self._flat_pycall_defaults(code, nargs, frame,
> natural_arity - nargs, dropvalues)
interpreter\function.py:193:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
defs_to_load = 2, dropvalues = 2
@jit.unroll_safe
def _flat_pycall_defaults(self, code, nargs, frame, defs_to_load, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
ndefs = len(self.defs_w)
start = ndefs - defs_to_load
i = nargs
for j in xrange(start, ndefs):
new_frame.locals_cells_stack_w[i] = self.defs_w[j]
i += 1
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:231:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
name = '_gcd_import', qualname = '_gcd_import'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 40
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
oparg = 2, next_instr = 40
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
name = '_find_and_load', qualname = '_find_and_load'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 82
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
oparg = 2, next_instr = 82
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>
code = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
name = '_find_and_load_unlocked', qualname = '_find_and_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
pycode = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 216
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
oparg = 1, next_instr = 216
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>
code = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
name = '_load_unlocked', qualname = '_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
pycode = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 132
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
oparg = 1, ignored = (132,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>
code = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
name = 'exec_module', qualname = '_LoaderBasics.exec_module'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
pycode = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 10L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
oparg = 1, ignored = (10L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>
code = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
name = 'get_code', qualname = 'SourceLoader.get_code'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
pycode = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 74L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
oparg = 1, ignored = (74L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>
code = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
name = 'get_data', qualname = 'FileLoader.get_data'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
pycode = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 26L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
oparg = 1, ignored = (26L,), n_args = 1, w_self = None, n = 1
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
> return code.fastcall_1(self.space, self, f_0)
interpreter\function.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
w_result = self.fastfunc_1(space, w1)
except DescrMismatch:
return self._type_unwrap_mismatch(space,
Arguments(space, [w1]))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:982:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
> w_result = self.fastfunc_1(space, w1)
interpreter\gateway.py:977:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
def open_code(space, w_file):
> return open(space, w_file, "rb")
module\_io\interp_io.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
> space.newbool(bool(closefd)), w_opener)
module\_io\interp_io.py:120:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args_w = (W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None)
nargs = 4, Function = <class 'pypy.interpreter.function.Function'>
_Method = <class 'pypy.interpreter.function._Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
return w_obj.call_args(args)
if isinstance(w_obj, Method):
return w_obj.call_args(args)
w_descr = space.lookup(w_obj, '__call__')
if w_descr is None:
raise oefmt(space.w_TypeError,
"'%T' object is not callable", w_obj)
> return space.get_and_call_args(w_descr, w_obj, args)
objspace\descroperation.py:199:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
w_result = self.func__args__(space, w_obj, args)
except DescrMismatch:
return self._type_unwrap_mismatch(space, args.prepend(w_obj))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:941:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
> w_result = self.func__args__(space, w_obj, args)
interpreter\gateway.py:937:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def _call(space, w_obj, args):
self = space.descr_self_interp_w(self_type, w_obj)
> return func(self, space, args)
<282-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:4:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <W_TypeObject '_io.FileIO' at 0x2342f626d78>, space = StdObjSpace
__args__ = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def descr_call(self, space, __args__):
promote(self)
# invoke the __new__ of the type
if not we_are_jitted():
# note that the annotator will figure out that self.w_new_function
# can only be None if the newshortcut config option is not set
w_newfunc = self.w_new_function
else:
# for the JIT it is better to take the slow path because normal lookup
# is nicely optimized, but the self.w_new_function attribute is not
# known to the JIT
w_newfunc = None
if w_newfunc is None:
w_newtype, w_newdescr = self.lookup_where('__new__')
if w_newdescr is None: # see test_crash_mro_without_object_1
raise oefmt(space.w_TypeError, "cannot create '%N' instances",
self)
#
# issue #2666
if space.config.objspace.usemodules.cpyext:
w_newtype, w_newdescr = self.hack_which_new_to_call(
w_newtype, w_newdescr)
#
w_newfunc = space.get(w_newdescr, space.w_None, w_type=self)
if (space.config.objspace.std.newshortcut and
not we_are_jitted() and space._side_effects_ok() and
isinstance(w_newtype, W_TypeObject)):
self.w_new_function = w_newfunc
w_newobject = space.call_obj_args(w_newfunc, self, __args__)
call_init = space.isinstance_w(w_newobject, self)
# maybe invoke the __init__ of the type
if (call_init and not (space.is_w(self, space.w_type) and
not __args__.keyword_names_w and len(__args__.arguments_w) == 1)):
w_descr = space.lookup(w_newobject, '__init__')
if w_descr is not None: # see test_crash_mro_without_object_2
w_result = space.get_and_call_args(w_descr, w_newobject,
> __args__)
objspace\std\typeobject.py:743:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_W_FileIO_ObjSpace_W_Root_text_int_W_Root object at 0x000002342e1b8db0>
space = StdObjSpace
scope_w = [<pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>, W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\s...\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None]
def _run(self, space, scope_w):
> return self.behavior(space.interp_w(W_FileIO, scope_w[0]), space, scope_w[1], space.text_w(scope_w[2]), space.gateway_int_w(scope_w[3]), scope_w[4])
<2459-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'r', closefd = 1, w_opener = None
@unwrap_spec(mode='text', closefd=int)
def descr_init(self, space, w_name, mode='r', closefd=True, w_opener=None):
if self.fd >= 0:
if self.closefd:
self._close(space)
else:
self.fd = -1
if space.isinstance_w(w_name, space.w_float):
raise oefmt(space.w_TypeError,
"integer argument expected, got float")
fd = -1
try:
fd = space.c_int_w(w_name)
except OperationError as e:
pass
else:
if fd < 0:
raise oefmt(space.w_ValueError, "negative file descriptor")
self.readable, self.writable, self.created, self.appending, flags = decode_mode(space, mode)
if rposix.O_CLOEXEC is not None:
flags |= rposix.O_CLOEXEC
fd_is_own = False
try:
if fd >= 0:
self.fd = fd
self.closefd = bool(closefd)
space.audit("open", [space.newint(fd), space.newtext(mode), space.newint(closefd)])
else:
space.audit("open", [w_name, space.newtext(mode), space.newint(1)])
self.closefd = True
if not closefd:
raise oefmt(space.w_ValueError,
"Cannot use closefd=False with file name")
if space.is_none(w_opener):
> self.fd = _open_fd(space, w_name, flags)
module\_io\interp_fileio.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
flags = 32768
def _open_fd(space, w_name, flags):
from pypy.module.posix.interp_posix import dispatch_filename, fspath
w_path = fspath(space, w_name)
while True:
try:
fd = dispatch_filename(rposix.open)(
> space, w_path, flags, 0666)
module\_io\interp_fileio.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_fname = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
args = (32768, 438)
fname = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
@specialize.argtype(1)
def dispatch(space, w_fname, *args):
if allow_fd_fn is not None:
try:
fd = space.c_int_w(w_fname)
except OperationError:
pass
else:
return allow_fd_fn(fd, *args)
if space.isinstance_w(w_fname, space.w_unicode):
fname = FileEncoder(space, w_fname)
> return func(fname, *args)
module\posix\interp_posix.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
flags = 32768, mode = 438
@replace_os_function('open')
@specialize.argtype(0)
@enforceargs(NOT_CONSTANT, int, int, typecheck=False)
def open(path, flags, mode):
if _WIN32:
utf8 = _as_utf80(path)
with rffi.scoped_utf82wcharp(utf8) as buf:
> fd = c_wopen(buf, flags, mode)
..\rpython\rlib\rposix.py:468:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<* DEAD Array of UniChar {'nolength': True} >, 32768, 438)
real_args = (<* DEAD Array of UniChar {'nolength': True} >, 32768L, 438L)
to_free = (), i = 2
def wrapper(*args):
assert len(args) == nb_args
real_args = ()
# XXX 'to_free' leaks if an allocation fails with MemoryError
# and was not the first in this function
to_free = ()
for i, TARGET in unrolling_arg_tps:
arg = args[i]
if TARGET == CCHARP or TARGET is VOIDP:
if arg is None:
from rpython.rtyper.annlowlevel import llstr
arg = lltype.nullptr(CCHARP.TO) # None => (char*)NULL
to_free = to_free + (arg, llstr(None), '\x04')
elif isinstance(arg, str):
tup = get_nonmovingbuffer_ll_final_null(arg)
to_free = to_free + tup
arg = tup[0]
elif isinstance(arg, unicode):
_oops()
elif TARGET == CWCHARP:
if arg is None:
arg = lltype.nullptr(CWCHARP.TO) # None => (wchar_t*)NULL
to_free = to_free + (arg,)
elif isinstance(arg, unicode):
arg = unicode2wcharp(arg)
to_free = to_free + (arg,)
elif _isfunctype(TARGET) and not _isllptr(arg):
# XXX pass additional arguments
use_gil = invoke_around_handlers
arg = llhelper(TARGET, _make_wrapper_for(TARGET, arg,
callbackholder,
use_gil))
else:
SOURCE = lltype.typeOf(arg)
if SOURCE != TARGET:
if TARGET is lltype.Float:
arg = float(arg)
elif ((isinstance(SOURCE, lltype.Number)
or SOURCE is lltype.Bool)
and (isinstance(TARGET, lltype.Number)
or TARGET is lltype.Bool)):
arg = cast(TARGET, arg)
real_args = real_args + (arg,)
> res = call_external_function(*real_args)
..\rpython\rtyper\lltypesystem\rffi.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a0 = <* DEAD Array of UniChar {'nolength': True} >, a1 = 32768L, a2 = 438L
def call_external_function(a0, a1, a2):
rgil.release()
# NB. it is essential that no exception checking occurs here!
if 1:
from rpython.rlib import rposix
rposix._errno_before(1)
if we_are_translated():
res = funcptr(a0, a1, a2)
else:
try: # only when non-translated
res = funcptr(a0, a1, a2)
except:
rgil.acquire()
raise
if 1:
from rpython.rlib import rposix
> rposix._errno_after(1)
<91-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py:217>:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
save_err = 1
@specialize.call_location()
def _errno_after(save_err):
if _WIN32:
if save_err & rffi.RFFI_SAVE_LASTERROR:
err = rwin32._GetLastError()
# careful, setraw() overwrites GetLastError.
# We must read it first, before the errno handling.
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
elif save_err & rffi.RFFI_SAVE_WSALASTERROR:
from rpython.rlib import _rsocket_rffi
err = _rsocket_rffi._WSAGetLastError()
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
if save_err & rffi.RFFI_SAVE_ERRNO:
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_errno.setraw(_get_errno())
else:
> rthread.tlfield_rpy_errno.setraw(_get_errno())
..\rpython\rlib\rposix.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <* fn get_errno>, args = ()
rffi = <module 'rpython.rtyper.lltypesystem.rffi' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\rtyper\\lltypesystem\\rffi.pyc'>
def __call__(self, *args):
from rpython.rtyper.lltypesystem import rffi
if isinstance(self._T, FuncType):
if len(args) != len(self._T.ARGS):
raise TypeError("calling %r with wrong argument number: %r" %
(self._T, args))
for i, a, ARG in zip(range(len(self._T.ARGS)), args, self._T.ARGS):
if typeOf(a) != ARG:
# ARG could be Void
if ARG == Void:
try:
value = getattr(self._obj, '_void' + str(i))
except AttributeError:
pass
else:
assert a == value
# None is acceptable for any pointer
elif isinstance(ARG, Ptr) and a is None:
pass
# Any pointer is convertible to void*
elif ARG is rffi.VOIDP and isinstance(typeOf(a), Ptr):
pass
# special case: ARG can be a container type, in which
# case a should be a pointer to it. This must also be
# special-cased in the backends.
elif (isinstance(ARG, ContainerType) and
typeOf(a) == Ptr(ARG)):
pass
else:
args_repr = [typeOf(arg) for arg in args]
raise TypeError("calling %r with wrong argument "
"types: %r" % (self._T, args_repr))
callb = self._obj._callable
if callb is None:
raise RuntimeError("calling undefined function")
> return callb(*args)
..\rpython\rtyper\lltypesystem\lltype.py:1384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.rtyper.lltypesystem.ll2ctypes.LL2CtypesCallable object at 0x0000023428d928a8>
argvalues = ()
def __call__(self, *argvalues):
with rlock:
if self.trampoline is None:
# lazily build the corresponding ctypes function object
cfunc = get_ctypes_callable(self.funcptr, self.calling_conv,
> self.natural_arity)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1339:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
funcptr = <* fn get_errno>, calling_conv = 'c', natural_arity = -1
def get_ctypes_callable(funcptr, calling_conv, natural_arity):
if not ctypes:
raise ImportError("ctypes is needed to use ll2ctypes")
def get_on_lib(lib, elem):
""" Wrapper to always use lib[func] instead of lib.func
"""
try:
return lib[elem]
except AttributeError:
pass
old_eci = funcptr._obj.compilation_info
funcname = funcptr._obj._name
if hasattr(old_eci, '_with_ctypes'):
old_eci = old_eci._with_ctypes
try:
eci = _eci_cache[old_eci]
except KeyError:
eci = old_eci.compile_shared_lib(ignore_a_files=True,
defines=['RPYTHON_LL2CTYPES'],
> symbolic=True)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1236:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
ignore_a_files = False, debug_mode = True, defines = ['RPYTHON_LL2CTYPES']
symbolic = True
def compile_shared_lib(self, outputfilename=None, ignore_a_files=False,
debug_mode=True, defines=[], symbolic=False):
self = self.convert_sources_to_files()
if ignore_a_files:
if not [fn for fn in self.link_files if fn.endswith('.a')]:
ignore_a_files = False # there are none
if not self.separate_module_files and not ignore_a_files:
return self # xxx there was some condition about win32 here
else:
#basepath = py.path.local(self.separate_module_files[0]).dirpath()
basepath = udir.join('shared_cache')
if outputfilename is None:
# find more or less unique name there
pth = basepath.join('externmod').new(ext=host.so_ext)
num = 0
while pth.check():
pth = basepath.join(
'externmod_%d' % (num,)).new(ext=host.so_ext)
num += 1
basepath.ensure(dir=1)
outputfilename = str(pth.dirpath().join(pth.purebasename))
d = self._copy_attributes()
if ignore_a_files:
d['link_files'] = [fn for fn in d['link_files']
if not fn.endswith('.a')]
if debug_mode and sys.platform != 'win32':
d['compile_extra'] = d['compile_extra'] + ('-g', '-O0')
d['compile_extra'] = d['compile_extra'] + (
'-DRPY_EXTERN=RPY_EXPORTED',)
for define in defines:
d['compile_extra'] += ('-D%s' % define,)
# On ELF platforms (Linux), prevent symbol interposition: when the host
# interpreter (e.g. pypy2.7) also exports symbols like pypysig_counter,
# the shared lib's own references would otherwise resolve to the host's
# copy via the GOT. -Bsymbolic makes the shared lib bind its own global
# symbol references to its own definitions. Only needed when running
# under a host interpreter (tests), not during translation.
if symbolic and sys.platform not in ('win32', 'darwin'):
d['link_extra'] = d['link_extra'] + ('-Wl,-Bsymbolic',)
self = ExternalCompilationInfo(**d)
lib = str(host.compile([], self, outputfilename=outputfilename,
> standalone=False))
..\rpython\translator\tool\cbuild.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cfiles = []
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def compile(self, cfiles, eci, outputfilename=None, standalone=True):
ofiles = self._compile_o_files(cfiles, eci, standalone)
> return self._finish_linking(ofiles, eci, outputfilename, standalone)
..\rpython\translator\platform\__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def _finish_linking(self, ofiles, eci, outputfilename, standalone):
if outputfilename is None:
outputfilename = ofiles[0].purebasename
if ofiles:
dirname = ofiles[0].dirpath()
else:
dirname = udir.join('module_cache')
exe_name = dirname.join(outputfilename, abs=True)
if standalone:
if self.exe_ext:
exe_name += '.' + self.exe_ext
else:
exe_name += '.' + self.so_ext
if eci.use_cpp_linker:
cc_link = 'g++' # XXX hard-coded so far
else:
cc_link = self.cc
largs = self._link_args_from_eci(eci, standalone)
> return self._link(cc_link, ofiles, largs, standalone, exe_name)
..\rpython\translator\platform\__init__.py:235:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'cl.exe'
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
link_args = ['/nologo', '/LARGEADDRESSAWARE', '/STACK:3145728', '/MANIFEST:EMBED', 'kernel32.lib']
standalone = False
exe_name = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _link(self, cc, ofiles, link_args, standalone, exe_name):
args = ['/nologo'] + [str(ofile) for ofile in ofiles] + link_args
args += ['/out:%s' % (exe_name,), '/incremental:no']
if not standalone:
args = self._args_for_shared(args)
# Tell the linker to embed a manifest with the default
# UAC level asInvoker (Visual Studio 2008 +)
args += ["/MANIFEST:EMBED"]
> self._execute_c_compiler(self.link, args, exe_name)
..\rpython\translator\platform\windows.py:303:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'link.exe'
args = ['/dll', '/nologo', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj', '/nologo', '/LARGEADDRESSAWARE', ...]
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
cwd = None
def _execute_c_compiler(self, cc, args, outname, cwd=None):
#log.execute(cc + ' ' + ' '.join(args))
# 'cc' can also contain some options for the C compiler;
# e.g. it can be "gcc -m32". We handle it by splitting on ' '.
cclist = cc.split()
cc = cclist[0]
args = cclist[1:] + args
returncode, stdout, stderr = _run_subprocess(cc, args, self.c_environ,
cwd)
> self._handle_error(returncode, stdout, stderr, outname)
..\rpython\translator\platform\__init__.py:143:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, returncode = 3221225477, stdout = ''
stderr = ''
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _handle_error(self, returncode, stdout, stderr, outname):
if returncode != 0:
# Microsoft compilers write compilation errors to stdout
stderr = stdout + stderr
errorfile = outname.new(ext='errors')
errorfile.write(stderr, mode='wb')
if self.log_errors:
stderrlines = stderr.splitlines()
for line in stderrlines:
log.Error(line)
# ^^^ don't use ERROR, because it might actually be fine.
# Also, ERROR confuses lib-python/conftest.py.
> raise CompilationError(stdout, stderr)
E CompilationError: CompilationError(out="""
E """)
..\rpython\translator\platform\windows.py:319: CompilationError
_________ ERROR at setup of AppTestStringObject.test_bytearray_resize _________
self = <CallInfo when='setup' exception: CompilationError(out="""
""")>
func = <function <lambda> at 0x000002342d2c2980>, when = 'setup'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
..\_pytest\runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
..\_pytest\runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_setup'>
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_resize'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_bytearray_resize'>}
def __call__(self, **kwargs):
assert not self.is_historic()
> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
..\_pytest\vendored_packages\pluggy.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.config.PytestPluginManager object at 0x0000023426593440>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_resize'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_bytearray_resize'>}
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
> return self._inner_hookexec(hook, methods, kwargs)
..\_pytest\vendored_packages\pluggy.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000234277f8520>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023426a58620>]
kwargs = {'__multicall__': <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_resize'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_bytearray_resize'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
..\_pytest\vendored_packages\pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_resize'>, '__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 0x0000023430182250>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ray_resize'>, '__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 0x0000023437cd88e0>
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 0x0000023437cd88e0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 2 meths, kwargs={'i...ray_resize'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 2 meths, kwargs={'item': <AppTestMethod 'test_bytearray_resize'>, '__multicall__': <_MultiCall 0 results, 2 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
..\_pytest\vendored_packages\pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_bytearray_resize'>
def pytest_runtest_setup(item):
> item.session._setupstate.prepare(item)
..\_pytest\runner.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_bytearray_resize'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
> py.builtin._reraise(*col._prepare_exc)
..\_pytest\runner.py:404:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x000002342cf5f638>
colitem = <AppTestMethod 'test_basic'>
def prepare(self, colitem):
""" setup objects along the collector chain to the test-method
and teardown previously setup objects."""
needed_collectors = colitem.listchain()
self._teardown_towards(needed_collectors)
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
py.builtin._reraise(*col._prepare_exc)
for col in needed_collectors[len(self.stack):]:
self.stack.append(col)
try:
> col.setup()
..\_pytest\runner.py:408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
> super(AppClassCollector, self).setup()
tool\pytest\apptest.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppClassCollector 'AppTestStringObject'>
def setup(self):
setup_class = xunitsetup(self.obj, 'setup_class')
if setup_class is not None:
setup_class = getattr(setup_class, 'im_func', setup_class)
setup_class = getattr(setup_class, '__func__', setup_class)
> setup_class(self.obj)
..\_pytest\python.py:671:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'pypy.module.cpyext.test.test_bytearrayobject.AppTestStringObject'>
def setup_class(cls):
space = cls.space
cls.w_here = space.wrap(str(HERE))
cls.w_udir = space.wrap(str(udir))
cls.w_runappdirect = space.wrap(cls.runappdirect)
if not cls.runappdirect:
cls.sys_info = get_cpyext_info(space)
cls.w_debug_collect = space.wrap(interp2app(debug_collect))
cls.preload_builtins(space)
# Flush stdout once here to pre-create any file lock objects
# before we start counting allocations (moved from setup_method).
> space.call_method(space.sys.get("stdout"), "flush")
module\cpyext\test\test_cpyext.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
name = 'stdout'
def get(self, name):
space = self.space
> w_value = self.getdictvalue(space, name)
interpreter\mixedmodule.py:86:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
def getdictvalue(self, space, name):
w_value = space.finditem_str(self.w_dict, name)
if self.lazy and w_value is None:
> return self._load_lazily(space, name)
interpreter\mixedmodule.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.sys.moduledef.Module object at 0x000002342af038d8>
space = StdObjSpace, name = 'stdout'
def _load_lazily(self, space, name):
w_name = space.new_interned_str(name)
try:
loader = self.loaders[name]
except KeyError:
return None
else:
> w_value = loader(space)
interpreter\mixedmodule.py:119:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
def afileloader(space):
> return app.wget(space, attrname)
interpreter\mixedmodule.py:279:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace, name = 'stdout'
def wget(self, space, name):
> w_globals = self.getwdict(space)
interpreter\gateway.py:1393:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
def getwdict(self, space):
> return space.fromcache(ApplevelCache).getorbuild(self)
interpreter\gateway.py:1386:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def getorbuild(self, key):
if lock: lock.acquire()
try:
try:
return self.content[key]
except KeyError:
if key in self._building:
raise RuntimeError("%s recursive building of %r" %
(self, key))
self._building[key] = True
try:
> result = self._build(key)
..\rpython\rlib\cache.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
key = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
def _build(self, key):
> return self.build(key)
interpreter\baseobjspace.py:400:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Cache 'ApplevelCache' (7 items)>
app = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
@not_rpython
def build(self, app):
"Called indirectly by Applevel.getwdict()."
> return build_applevel_dict(app, self.space)
interpreter\gateway.py:1437:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'>
space = StdObjSpace
@not_rpython
def build_applevel_dict(self, space):
w_glob = space.newdict(module=True)
space.setitem(w_glob, space.newtext('__name__'), space.newtext(self.modname))
space.exec_(self.source, w_glob, w_glob,
hidden_applevel=self.hidden_applevel,
> filename=self.filename)
interpreter\gateway.py:1448:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
statement = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
hidden_applevel = True
filename = 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\sys\\std_test.py'
@not_rpython
def exec_(self, statement, w_globals, w_locals, hidden_applevel=False,
filename=None):
"For internal debugging."
if filename is None:
filename = '?'
from pypy.interpreter.pycode import PyCode
if isinstance(statement, str):
statement = self._cached_compile(filename, statement, 'exec', 0, hidden_applevel)
if not isinstance(statement, PyCode):
raise TypeError('space.exec_(): expected a string, code or PyCode object')
w_key = self.newtext('__builtins__')
if not self.contains_w(w_globals, w_key):
self.setitem(w_globals, w_key, self.builtin)
> return statement.exec_code(self, w_globals, w_locals)
interpreter\baseobjspace.py:1408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
space = StdObjSpace
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x000002342f57ec28>)
w_closure = None
def exec_code(self, space, w_globals, w_locals, w_closure=None):
"Implements the 'exec' statement."
# this should be on PyCode?
frame = space.createframe(self, w_globals, w_closure)
frame.setdictscope(w_locals, skip_free_vars=w_closure is not None)
> return frame.run()
interpreter\eval.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
name = None, qualname = None
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
pycode = <code object <module>, file "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
co_code = 'd\x00d\x01l\x00Z\x00e\x00\xa0\x01d\x00d\x02d\x03d\x04d\x05\xcc\x04Z\x02d\x06e\x02j\x03j\x04_\x05e\x00\xa0\x01d\x07d\x...x08d\x03d\x0cd\x07d\x04d\r\xcc\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00\x06Z\x07d\x0ee\x07j\x03j\x04_\x05d\x01S\x00'
next_instr = 24L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
self.CALL_METHOD(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD_KW.index:
> self.CALL_METHOD_KW(oparg, next_instr)
interpreter\pyopcode.py:315:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object <module>, fil...ot64\slave\own-win-x86-64\build\pypy\module\sys\std_test.py", line 1> at line 6
n_arguments = 2, ignored = (24L,)
W_AbstractTupleObject = <class 'pypy.objspace.std.tupleobject.W_AbstractTupleObject'>
w_self = None, space = StdObjSpace
@jit.unroll_safe
def CALL_METHOD_KW(f, n_arguments, *ignored):
from pypy.objspace.std.tupleobject import W_AbstractTupleObject
# opargs contains the arg + kwarg count, excluding the implicit 'self'
w_self = f.peekvalue_maybe_none(n_arguments + 1)
space = f.space
# like in BUILD_CONST_KEY_MAP we can't use space.fixedview because then
# the immutability of the tuple is lost
w_tup_varnames = space.interp_w(W_AbstractTupleObject, f.popvalue())
n_keywords = space.len_w(w_tup_varnames)
keyword_names_w = [None] * n_keywords
keywords_w = [None] * n_keywords
for i in range(n_keywords):
keyword_names_w[i] = w_tup_varnames.getitem(space, i)
w_value = f.peekvalue(n_keywords - 1 - i)
keywords_w[i] = w_value
f.dropvalues(n_keywords)
n_arguments -= n_keywords
n = n_arguments + (w_self is not None)
arguments = f.popvalues(n) # includes w_self if it is not None
if w_self is None:
f.popvalue_maybe_none() # removes w_self, which is None
w_callable = f.popvalue()
args = f.argument_factory(
arguments, keyword_names_w, keywords_w, None, None,
methodcall=w_self is not None, w_function=w_callable)
if f.get_is_being_profiled() and function.is_builtin_code(w_callable):
w_result = f.space.call_args_and_c_profile(f, w_callable, args)
else:
> w_result = f.space.call_args(w_callable, args)
objspace\std\callmethod.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342f57f4b0>
func = <BuiltinFunction open>, w_obj = None
args = Arguments([W_IntObject(0), W_UnicodeObject('r')], ['encoding', 'closefd'], [W_UnicodeObject('utf-8'), W_BoolObject(False)])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_text_int_text_or_none_text_or_none_text_or_none_int_W_Root object at 0x000002342f57f558>
space = StdObjSpace
scope_w = [W_IntObject(0), W_UnicodeObject('r'), W_IntObject(-1), W_UnicodeObject('utf-8'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, ...]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], space.text_w(scope_w[1]), space.gateway_int_w(scope_w[2]), space.text_or_none_w(scope_w[3]), space.text_or_none_w(scope_w[4]), space.text_or_none_w(scope_w[5]), space.gateway_int_w(scope_w[6]), scope_w[7])
<2604-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = -1
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_file = W_IntObject(0), mode = 'r', buffering = 8192
encoding = 'utf-8', errors = None, newline = None, closefd = 0, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
space.newbool(bool(closefd)), w_opener)
else:
w_raw = W_FileIO(space)
w_raw.descr_init(space, w_file, rawmode, bool(closefd), w_opener)
w_result = w_raw
isatty = space.is_true(space.call_method(w_raw, "isatty"))
line_buffering = buffering == 1 or (buffering < 0 and isatty)
if line_buffering:
buffering = -1
if buffering < 0:
buffering = space.c_int_w(space.getattr(
w_raw, space.newtext("_blksize")))
if buffering < 0:
raise oefmt(space.w_ValueError, "invalid buffering size")
if buffering == 0:
if not binary:
raise oefmt(space.w_ValueError,
"can't have unbuffered text I/O")
return w_result
if updating:
w_buffer = W_BufferedRandom(space)
w_buffer.descr_init(space, w_raw, buffering)
elif writing or creating or appending:
w_buffer = W_BufferedWriter(space)
w_buffer.descr_init(space, w_raw, buffering)
elif reading:
w_buffer = W_BufferedReader(space)
w_buffer.descr_init(space, w_raw, buffering)
else:
raise oefmt(space.w_ValueError, "unknown mode: '%s'", mode)
w_result = w_buffer
if binary:
return w_result
w_wrapper = W_TextIOWrapper(space)
w_wrapper.descr_init(space, w_buffer, encoding,
space.newtext_or_none(errors),
space.newtext_or_none(newline),
> line_buffering)
module\_io\interp_io.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
space = StdObjSpace
w_buffer = <pypy.module._io.interp_bufferedio.W_BufferedReader object at 0x000002342f446758>
encoding = 'utf-8', w_errors = W_UnicodeObject('strict')
w_newline = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
line_buffering = True, write_through = 0
@unwrap_spec(encoding="text0_or_none", line_buffering=int, write_through=int)
def descr_init(self, space, w_buffer, encoding=None,
w_errors=None, w_newline=None, line_buffering=0,
write_through=0):
self.state = STATE_ZERO
self.w_buffer = w_buffer
self.w_encoding = w_encoding = _determine_encoding(space, encoding, w_buffer)
if space.is_none(w_errors) or w_errors is None:
w_errors = space.newtext("strict")
if not space.isinstance_w(w_errors, space.w_text):
raise oefmt(space.w_TypeError, "TextIOWrapper() argument 'errors' "
"must be str or None, not %N", w_errors)
io_check_errors(space, w_errors)
self.w_errors = w_errors
newline = unwrap_newline(space, w_newline)
self.line_buffering = bool(line_buffering)
self.write_through = bool(write_through)
self._set_newline(newline)
> self._set_encoder_decoder(w_encoding, w_errors)
module\_io\interp_textio.py:605:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_textio.W_TextIOWrapper object at 0x000002342f446b48>
w_encoding = W_UnicodeObject('utf-8'), w_errors = W_UnicodeObject('strict')
def _set_encoder_decoder(self, w_encoding, w_errors):
space = self.space
w_codec = interp_codecs.lookup_codec(space,
> space.text_w(w_encoding))
module\_io\interp_textio.py:634:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8'
@unwrap_spec(encoding='text0')
def lookup_codec(space, encoding):
"""lookup(encoding) -> (encoder, decoder, stream_reader, stream_writer)
Looks up a codec tuple in the Python codec registry and returns
a tuple of functions.
"""
assert not (space.config.translating and not we_are_translated()), \
"lookup_codec() should not be called during translation"
state = space.fromcache(CodecState)
normalized_encoding = normalize(encoding)
w_result = state.get_codec_from_cache(normalized_encoding)
if w_result is not None:
return w_result
> return _lookup_codec_loop(space, encoding, normalized_encoding)
module\_codecs\interp_codecs.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, encoding = 'utf-8', normalized_encoding = 'utf_8'
def _lookup_codec_loop(space, encoding, normalized_encoding):
state = space.fromcache(CodecState)
if state.codec_need_encodings:
# registers new codecs.
# This import uses the "builtin" import method, and is needed
# to bootstrap the full importlib module.
w_import = space.getattr(space.builtin, space.newtext("__import__"))
> space.call_function(w_import, space.newtext("encodings"))
module\_codecs\interp_codecs.py:221:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),), nargs = 1
Function = <class 'pypy.interpreter.function.Function'>
_Method = <class 'pypy.interpreter.function._Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
> return w_func.funccall(*args_w)
interpreter\baseobjspace.py:1237:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args_w = (W_UnicodeObject('encodings'),)
gateway = <module 'pypy.interpreter.gateway' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\interpreter\\gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
def funccall(self, *args_w): # speed hack
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
nargs = len(args_w)
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, args_w[0])
elif nargs == 2:
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, args_w[0], args_w[1])
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
return code.fastcall_3(self.space, self, args_w[0],
args_w[1], args_w[2])
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
return code.fastcall_4(self.space, self, args_w[0],
args_w[1], args_w[2], args_w[3])
elif (nargs | PyCode.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
if nargs < 5:
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in funccallunrolling:
if i < nargs:
new_frame.locals_cells_stack_w[i] = args_w[i]
return new_frame.run(self.name, self.qualname)
elif nargs >= 1 and fast_natural_arity == Code.PASSTHROUGHARGS1:
assert isinstance(code, gateway.BuiltinCodePassThroughArguments1)
return code.funcrun_obj(self, args_w[0],
Arguments(self.space,
list(args_w[1:])))
> return self.call_args(Arguments(self.space, list(args_w)))
interpreter\function.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>
args = Arguments([W_UnicodeObject('encodings')])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342c151b40>
func = <FunctionWithFixedCode __import__>, w_obj = None
args = Arguments([W_UnicodeObject('encodings')])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_ObjSpace_W_Root_W_Root_W_Root_W_Root_W_Root object at 0x000002342c151be8>
space = StdObjSpace
scope_w = [W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)]
def _run(self, space, scope_w):
> return self.behavior(space, scope_w[0], scope_w[1], scope_w[2], scope_w[3], scope_w[4])
<2115-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_name = W_UnicodeObject('encodings')
w_globals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_locals = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>
w_fromlist = W_TupleObject(), w_level = W_IntObject(0)
@unwrap_spec(w_globals=WrappedDefault(None), w_locals=WrappedDefault(None), w_fromlist=WrappedDefault(()),
w_level=WrappedDefault(0))
def interp___import__(space, w_name, w_globals, w_locals, w_fromlist,
w_level):
"""
Import a module. Because this function is meant for use by the Python
interpreter and not for general use, it is better to use
importlib.import_module() to programmatically import a module.
The globals argument is only used to determine the context;
they are not modified. The locals argument is unused. The fromlist
should be a list of names to emulate ``from name import ...'', or an
empty list to emulate ``import name''.
When importing a module from a package, note that __import__('A.B', ...)
returns package A when fromlist is empty, but its submodule B when
fromlist is not empty. The level argument is used to determine whether to
perform absolute or relative imports: 0 is absolute, while a positive number
is the number of parent directories to search relative to the current module."""
level = space.int_w(w_level)
if level == 0:
# fast path only for absolute imports without a "from" list, for now
# fromlist can be supported if we are importing from a module, not a
# package. to check that, look for the existence of __path__ attribute
# in w_mod
try:
name = space.text_w(w_name)
w_mod = _gcd_import(space, name)
have_fromlist = space.is_true(w_fromlist)
if not have_fromlist:
dotindex = name.find(".")
if dotindex < 0:
return w_mod
return _gcd_import(space, name[:dotindex])
except FastPathGiveUp:
pass
else:
assert have_fromlist
w_path = space.findattr(w_mod, space.newtext("__path__"))
if w_path is not None:
# hard case, a package! Call back into importlib
w_importlib = space.getbuiltinmodule('_frozen_importlib')
return space.call_method(w_importlib, "_handle_fromlist",
w_mod, w_fromlist,
space.w_default_importlib_import)
else:
return w_mod
try:
return space.call_function(
space.fromcache(FrozenCache).w_frozen_import, w_name, w_globals, w_locals, w_fromlist,
> w_level)
module\_frozen_importlib\interp_import.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function __import__>
args_w = (W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, <pypy.objspace.std.noneobject.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0))
nargs = 5
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
> return w_obj.call_args(args)
objspace\descroperation.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
func = <Function __import__>
args = Arguments([W_UnicodeObject('encodings'), <pypy.objspace.std.noneobject.W_NoneO...t.W_NoneObject object at 0x000002342b752ad8>, W_TupleObject(), W_IntObject(0)])
def funcrun(self, func, args):
frame = self.space.createframe(self, func.w_func_globals,
func)
sig = self._signature
# speed hack
fresh_frame = jit.hint(frame, access_directly=True,
fresh_virtualizable=True)
args.parse_into_scope(None, fresh_frame.locals_cells_stack_w, func.qualname,
sig, func.defs_w, func.w_kw_defs)
fresh_frame.init_cells()
> return frame.run(func.name, func.qualname)
interpreter\pycode.py:280:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
name = '__import__', qualname = '__import__'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
pycode = <code object __import__, file "<frozen importlib._bootstrap>", line 1271>
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 8L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
co_code = '|\x04d\x01k\x02r\tt\x00|\x00\x83\x01}\x05n\x12|\x01d\x02u\x01r\x0f|\x01n\x01i\x00}\x06t\x01|\x06\x83\x01}\x07t\x00|\x...\x83\x01|\x08\x18\x00\x85\x02\x19\x00\x19\x00S\x00t\x07|\x05d\x04\x83\x02rUt\x08|\x05|\x03t\x00\x83\x03S\x00|\x05S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
oparg = 1, next_instr = 14L
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
return self._flat_pycall(code, nargs, frame, dropvalues)
elif fast_natural_arity & Code.FLATPYCALL:
natural_arity = fast_natural_arity & 0xff
if natural_arity > nargs >= natural_arity - len(self.defs_w):
assert isinstance(code, PyCode)
return self._flat_pycall_defaults(code, nargs, frame,
> natural_arity - nargs, dropvalues)
interpreter\function.py:193:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _gcd_import>
code = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object __import__, file "<frozen importlib._bootstrap>", line 1271> at line 1283
defs_to_load = 2, dropvalues = 2
@jit.unroll_safe
def _flat_pycall_defaults(self, code, nargs, frame, defs_to_load, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
ndefs = len(self.defs_w)
start = ndefs - defs_to_load
i = nargs
for j in xrange(start, ndefs):
new_frame.locals_cells_stack_w[i] = self.defs_w[j]
i += 1
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:231:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
name = '_gcd_import', qualname = '_gcd_import'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
pycode = <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192>
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 32
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
co_code = 't\x00|\x00|\x01|\x02\x83\x03\x01\x00|\x02d\x01k\x04r\x10t\x01|\x00|\x01|\x02\x83\x03}\x00t\x02|\x00t\x03\x83\x02S\x00'
next_instr = 40
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
oparg = 2, next_instr = 40
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load>
code = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _gcd_import, file "<frozen importlib._bootstrap>", line 1192> at line 1204
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
name = '_find_and_load', qualname = '_find_and_load'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
pycode = <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165>
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 74
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
co_code = 't\x00j\x01\xa0\x02|\x00t\x03\xa1\x02}\x02|\x02t\x03u\x00s\x15t\x04t\x04|\x02d\x01d\x02\x83\x03d\x03d\x04\x83\x03rEt\x...t\x07|\x00\x83\x01\x01\x00|\x02d\x02u\x00rTd\x05\xa0\x08|\x00\xa1\x01}\x03t\t|\x03|\x00d\x06\x8d\x02\x82\x01|\x02S\x00'
next_instr = 82
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
oparg = 2, next_instr = 82
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _find_and_load_unlocked>
code = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load, file "<frozen importlib._bootstrap>", line 1165> at line 1176
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
name = '_find_and_load_unlocked', qualname = '_find_and_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
pycode = <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120>
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 208
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
co_code = 'd\x00}\x02|\x00\xa0\x00d\x01\xa1\x01d\x02\x19\x00}\x03d\x00}\x04|\x03rN|\x03t\x01j\x02v\x01r\x17t\x03|\x01|\x03\x83\x...b\x02d\x07|\x07\x9b\x02\x9d\x04}\x06t\x10\xa0\x11|\x06t\x12\xa1\x02\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\tS\x00'
next_instr = 216
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
> self.CALL_FUNCTION(oparg, next_instr)
interpreter\pyopcode.py:307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
oparg = 1, next_instr = 216
def CALL_FUNCTION(self, oparg, next_instr):
# Only positional arguments
nargs = oparg & 0xff
w_function = self.peekvalue(nargs)
> w_result = self.space.call_valuestack(w_function, nargs, self, dropvalues=nargs+1)
interpreter\pyopcode.py:1399:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function _load_unlocked>
code = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _find_and_load_unlocked, file "<frozen importlib._bootstrap>", line 1120> at line 1147
dropvalues = 2
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
name = '_load_unlocked', qualname = '_load_unlocked'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
pycode = <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666>
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 122
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
co_code = '|\x00j\x00d\x00u\x01r\x1dt\x01|\x00j\x00d\x01\x83\x02s\x1dt\x02|\x00j\x00\x83\x01\x9b\x00d\x02\x9d\x02}\x01t\x03\xa0\...00t\x11d\x06|\x00j\x0b|\x00j\x00\x83\x03\x01\x00d\x07|\x00_\x08n\x08#\x00d\x07|\x00_\x08w\x00&\x03Y\x00w\x01|\x02S\x00'
next_instr = 132
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
oparg = 1, ignored = (132,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function exec_module>
code = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object _load_unlocked, file "<frozen importlib._bootstrap>", line 666> at line 690
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
name = 'exec_module', qualname = '_LoaderBasics.exec_module'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
pycode = <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
co_code = '|\x00\xa0\x00|\x01j\x01\xa1\x01}\x02|\x02d\x01u\x00r\x12t\x02d\x02\xa0\x03|\x01j\x01\xa1\x01\x83\x01\x82\x01t\x04\xa0\x05t\x06|\x02|\x01j\x07\xa1\x03\x01\x00d\x01S\x00'
next_instr = 10L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
oparg = 1, ignored = (10L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_code>
code = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object exec_module, file "<frozen importlib._bootstrap_external>", line 949> at line 951
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
name = 'get_code', qualname = 'SourceLoader.get_code'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
pycode = <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
co_code = '|\x00\xa0\x00|\x01\xa1\x01}\x02d\x01}\x03d\x01}\x04d\x01}\x05d\x02}\x06d\x03}\x07\t\x00t\x01|\x02\x83\x01}\x08\t\x00|...0\x1a|\x02|\x08|\n\xa1\x03\x01\x00n\r#\x00t\x13$\x00\x90\x01r\x03\x01\x00Y\x00n\x05w\x01w\x00&\x03Y\x00w\x01|\x0eS\x00'
next_instr = 74L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
oparg = 1, ignored = (74L,), n_args = 1
w_self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002343033dec0>
n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3, methodcall = True
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
return code.fastcall_1(self.space, self, f_0)
elif nargs == 2:
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode2)
return code.fastcall_2(self.space, self, f_1, f_0)
elif nargs == 3:
assert isinstance(code, gateway.BuiltinCode3)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
frame.dropvalues(dropvalues)
return code.fastcall_3(self.space, self, f_2,
f_1, f_0)
elif nargs == 4:
assert isinstance(code, gateway.BuiltinCode4)
f_0 = frame.peekvalue(0)
f_1 = frame.peekvalue(1)
f_2 = frame.peekvalue(2)
f_3 = frame.peekvalue(3)
frame.dropvalues(dropvalues)
return code.fastcall_4(self.space, self, f_3, f_2, f_1, f_0)
elif (nargs | Code.FLATPYCALL) == fast_natural_arity:
assert isinstance(code, PyCode)
> return self._flat_pycall(code, nargs, frame, dropvalues)
interpreter\function.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function get_data>
code = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_code, file "<frozen importlib._bootstrap_external>", line 1022> at line 1047
dropvalues = 3
@jit.unroll_safe
def _flat_pycall(self, code, nargs, frame, dropvalues):
# code is a PyCode
new_frame = self.space.createframe(code, self.w_func_globals,
self)
for i in xrange(nargs):
new_frame.locals_cells_stack_w[i] = frame.peekvalue(nargs-1-i)
frame.dropvalues(dropvalues)
> return new_frame.run(self.name, self.qualname)
interpreter\function.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
name = 'get_data', qualname = 'FileLoader.get_data'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
e = CompilationError(out="""
""")
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
pycode = <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142>
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def dispatch(self, pycode, next_instr, ec):
# For the sequel, force 'next_instr' to be unsigned for performance
next_instr = r_uint(next_instr)
co_code = pycode.co_code
try:
while True:
assert next_instr & 1 == 0
> next_instr = self.handle_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 14L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
def handle_bytecode(self, co_code, next_instr, ec):
try:
> next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
interpreter\pyopcode.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
co_code = 't\x00|\x00t\x01t\x02f\x02\x83\x02r&t\x03\xa0\x04t\x05|\x01\x83\x01\xa1\x015\x00}\x02|\x02\xa0\x06\xa1\x00\x02\x00d\x0...2\x00d\x01\x04\x00\x04\x00\x83\x03\x01\x00S\x00#\x001\x00s>w\x02&\x03Y\x00w\x01\x01\x00Y\x00\x01\x00\x01\x00d\x01S\x00'
next_instr = 26L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000002342e3d4608>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
oparg = 1, ignored = (26L,), n_args = 1, w_self = None, n = 1
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction open_code>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object get_data, file "<frozen importlib._bootstrap_external>", line 1142> at line 1145
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
> return code.fastcall_1(self.space, self, f_0)
interpreter\function.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
w_result = self.fastfunc_1(space, w1)
except DescrMismatch:
return self._type_unwrap_mismatch(space,
Arguments(space, [w1]))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:982:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000023430352950>
space = StdObjSpace, w_func = <BuiltinFunction open_code>
w1 = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
> w_result = self.fastfunc_1(space, w1)
interpreter\gateway.py:977:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
def open_code(space, w_file):
> return open(space, w_file, "rb")
module\_io\interp_io.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@unwrap_spec(mode='text', buffering=int,
encoding="text_or_none", errors="text_or_none",
newline="text_or_none", closefd=int)
def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
newline=None, closefd=True, w_opener=None):
return _open(space, w_file, mode, buffering, encoding, errors, newline,
> closefd, w_opener)
module\_io\interp_io.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
def f(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
if not we_are_jitted() or predicate(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener):
> return func(space, w_file, mode, buffering, encoding, errors, newline, closefd, w_opener)
<2539-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rlib\jit.py:246>:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_file = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'rb', buffering = -1, encoding = None, errors = None, newline = None
closefd = True, w_opener = None
@jit.look_inside_iff(lambda space, w_file, mode, buffering, encoding, errors,
newlines, closefd, w_opener: jit.isconstant(mode))
def _open(space, w_file, mode, buffering, encoding, errors, newline, closefd,
w_opener):
from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
W_BufferedWriter, W_BufferedReader)
if not (space.isinstance_w(w_file, space.w_unicode) or
space.isinstance_w(w_file, space.w_bytes) or
space.isinstance_w(w_file, space.w_int)):
w_file = interp_posix.fspath(space, w_file)
reading = writing = creating = appending = updating = text = binary = False
for i in range(1, len(mode)):
flag = mode[i]
if mode.find(flag, 0, i) != -1:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
for flag in mode:
if flag == "r":
reading = True
elif flag == "w":
writing = True
elif flag == "x":
creating = True
elif flag == "a":
appending = True
elif flag == "+":
updating = True
elif flag == "t":
text = True
elif flag == "b":
binary = True
else:
raise oefmt(space.w_ValueError, "invalid mode: %s", mode)
if text and binary:
raise oefmt(space.w_ValueError,
"can't have text and binary mode at once")
if creating + reading + writing + appending > 1:
raise oefmt(space.w_ValueError,
"must have exactly one of create/read/write/append mode")
if binary and encoding is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take an encoding argument")
if binary and newline is not None:
raise oefmt(space.w_ValueError,
"binary mode doesn't take a newline argument")
if binary and buffering == 1:
space.warn(
space.newtext(
"line buffering (buffering=1) isn't supported in "
"binary mode, the default buffer size will be used"
), space.w_RuntimeWarning
)
rawmode = ""
if reading:
rawmode = "r"
if updating:
rawmode = "r+"
elif writing:
rawmode = "w"
if updating:
rawmode = "w+"
elif creating:
rawmode = "x"
if updating:
rawmode = "x+"
elif appending:
rawmode = "a"
if updating:
rawmode = "a+"
else:
# error, will be raised from interp_fileio
if updating:
rawmode = "+"
w_result = None
try:
rawclass = W_FileIO
if _WIN32:
from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type
typ = _pyio_get_console_type(space, w_file)
if typ != '\0':
rawclass = W_WinConsoleIO
encoding = "utf-8"
w_raw = space.call_function(
space.gettypefor(rawclass), w_file, space.newtext(rawmode),
> space.newbool(bool(closefd)), w_opener)
module\_io\interp_io.py:120:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args_w = (W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None)
nargs = 4, Function = <class 'pypy.interpreter.function.Function'>
_Method = <class 'pypy.interpreter.function._Method'>
def call_function(self, w_func, *args_w):
nargs = len(args_w) # used for pruning funccall versions
if not self.config.objspace.disable_call_speedhacks and nargs < 5:
# start of hack for performance
from pypy.interpreter.function import Function, _Method
if isinstance(w_func, _Method):
if nargs < 4:
func = w_func.w_function
if isinstance(func, Function):
return func.funccall(w_func.w_instance, *args_w)
if isinstance(w_func, Function):
return w_func.funccall(*args_w)
# end of hack for performance
args = Arguments(self, list(args_w))
> return self.call_args(w_func, args)
interpreter\baseobjspace.py:1241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_args(space, w_obj, args):
# two special cases for performance
if isinstance(w_obj, Function):
return w_obj.call_args(args)
if isinstance(w_obj, Method):
return w_obj.call_args(args)
w_descr = space.lookup(w_obj, '__call__')
if w_descr is None:
raise oefmt(space.w_TypeError,
"'%T' object is not callable", w_obj)
> return space.get_and_call_args(w_descr, w_obj, args)
objspace\descroperation.py:199:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
w_result = self.func__args__(space, w_obj, args)
except DescrMismatch:
return self._type_unwrap_mismatch(space, args.prepend(w_obj))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:941:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCodePassThroughArguments1 object at 0x000002342b47efa8>
func = <FunctionWithFixedCode __call__>
w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
try:
> w_result = self.func__args__(space, w_obj, args)
interpreter\gateway.py:937:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = <W_TypeObject '_io.FileIO' at 0x2342f626d78>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def _call(space, w_obj, args):
self = space.descr_self_interp_w(self_type, w_obj)
> return func(self, space, args)
<282-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:4:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <W_TypeObject '_io.FileIO' at 0x2342f626d78>, space = StdObjSpace
__args__ = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def descr_call(self, space, __args__):
promote(self)
# invoke the __new__ of the type
if not we_are_jitted():
# note that the annotator will figure out that self.w_new_function
# can only be None if the newshortcut config option is not set
w_newfunc = self.w_new_function
else:
# for the JIT it is better to take the slow path because normal lookup
# is nicely optimized, but the self.w_new_function attribute is not
# known to the JIT
w_newfunc = None
if w_newfunc is None:
w_newtype, w_newdescr = self.lookup_where('__new__')
if w_newdescr is None: # see test_crash_mro_without_object_1
raise oefmt(space.w_TypeError, "cannot create '%N' instances",
self)
#
# issue #2666
if space.config.objspace.usemodules.cpyext:
w_newtype, w_newdescr = self.hack_which_new_to_call(
w_newtype, w_newdescr)
#
w_newfunc = space.get(w_newdescr, space.w_None, w_type=self)
if (space.config.objspace.std.newshortcut and
not we_are_jitted() and space._side_effects_ok() and
isinstance(w_newtype, W_TypeObject)):
self.w_new_function = w_newfunc
w_newobject = space.call_obj_args(w_newfunc, self, __args__)
call_init = space.isinstance_w(w_newobject, self)
# maybe invoke the __init__ of the type
if (call_init and not (space.is_w(self, space.w_type) and
not __args__.keyword_names_w and len(__args__.arguments_w) == 1)):
w_descr = space.lookup(w_newobject, '__init__')
if w_descr is not None: # see test_crash_mro_without_object_2
w_result = space.get_and_call_args(w_descr, w_newobject,
> __args__)
objspace\std\typeobject.py:743:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_descr = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def get_and_call_args(space, w_descr, w_obj, args):
# a special case for performance and to avoid infinite recursion
if isinstance(w_descr, Function):
> return w_descr.call_obj_args(w_obj, args)
objspace\descroperation.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def call_obj_args(self, w_obj, args):
# delegate activation to code
> w_res = self.getcode().funcrun_obj(self, w_obj, args)
interpreter\function.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
w_result = activation._run(space, scope_w)
except DescrMismatch:
if w_obj is not None:
args = args.prepend(w_obj)
return self._type_unwrap_mismatch(space, args)
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
space = StdObjSpace, e = CompilationError(out="""
""")
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000002342e1b8cd0>
func = <FunctionWithFixedCode __init__>
w_obj = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
args = Arguments([W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\...che__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None])
def funcrun_obj(self, func, w_obj, args):
space = func.space
activation = self.activation
scope_w = args.parse_obj(w_obj, func.qualname, self.sig,
func.defs_w, func.w_kw_defs, self.minargs)
try:
> w_result = activation._run(space, scope_w)
interpreter\gateway.py:878:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinActivation_UwS_W_FileIO_ObjSpace_W_Root_text_int_W_Root object at 0x000002342e1b8db0>
space = StdObjSpace
scope_w = [<pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>, W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\s...\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc'), W_UnicodeObject('r'), W_BoolObject(True), None]
def _run(self, space, scope_w):
> return self.behavior(space.interp_w(W_FileIO, scope_w[0]), space, scope_w[1], space.text_w(scope_w[2]), space.gateway_int_w(scope_w[3]), scope_w[4])
<2459-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module._io.interp_fileio.W_FileIO object at 0x0000023430bd3ec0>
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
mode = 'r', closefd = 1, w_opener = None
@unwrap_spec(mode='text', closefd=int)
def descr_init(self, space, w_name, mode='r', closefd=True, w_opener=None):
if self.fd >= 0:
if self.closefd:
self._close(space)
else:
self.fd = -1
if space.isinstance_w(w_name, space.w_float):
raise oefmt(space.w_TypeError,
"integer argument expected, got float")
fd = -1
try:
fd = space.c_int_w(w_name)
except OperationError as e:
pass
else:
if fd < 0:
raise oefmt(space.w_ValueError, "negative file descriptor")
self.readable, self.writable, self.created, self.appending, flags = decode_mode(space, mode)
if rposix.O_CLOEXEC is not None:
flags |= rposix.O_CLOEXEC
fd_is_own = False
try:
if fd >= 0:
self.fd = fd
self.closefd = bool(closefd)
space.audit("open", [space.newint(fd), space.newtext(mode), space.newint(closefd)])
else:
space.audit("open", [w_name, space.newtext(mode), space.newint(1)])
self.closefd = True
if not closefd:
raise oefmt(space.w_ValueError,
"Cannot use closefd=False with file name")
if space.is_none(w_opener):
> self.fd = _open_fd(space, w_name, flags)
module\_io\interp_fileio.py:211:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_name = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
flags = 32768
def _open_fd(space, w_name, flags):
from pypy.module.posix.interp_posix import dispatch_filename, fspath
w_path = fspath(space, w_name)
while True:
try:
fd = dispatch_filename(rposix.open)(
> space, w_path, flags, 0666)
module\_io\interp_fileio.py:141:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_fname = W_UnicodeObject('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\lib-python\\3\\encodings\\__pycache__\\__init__.pypy311.pyc')
args = (32768, 438)
fname = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
@specialize.argtype(1)
def dispatch(space, w_fname, *args):
if allow_fd_fn is not None:
try:
fd = space.c_int_w(w_fname)
except OperationError:
pass
else:
return allow_fd_fn(fd, *args)
if space.isinstance_w(w_fname, space.w_unicode):
fname = FileEncoder(space, w_fname)
> return func(fname, *args)
module\posix\interp_posix.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = <pypy.module.posix.interp_posix.FileEncoder object at 0x0000023430bd4170>
flags = 32768, mode = 438
@replace_os_function('open')
@specialize.argtype(0)
@enforceargs(NOT_CONSTANT, int, int, typecheck=False)
def open(path, flags, mode):
if _WIN32:
utf8 = _as_utf80(path)
with rffi.scoped_utf82wcharp(utf8) as buf:
> fd = c_wopen(buf, flags, mode)
..\rpython\rlib\rposix.py:468:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<* DEAD Array of UniChar {'nolength': True} >, 32768, 438)
real_args = (<* DEAD Array of UniChar {'nolength': True} >, 32768L, 438L)
to_free = (), i = 2
def wrapper(*args):
assert len(args) == nb_args
real_args = ()
# XXX 'to_free' leaks if an allocation fails with MemoryError
# and was not the first in this function
to_free = ()
for i, TARGET in unrolling_arg_tps:
arg = args[i]
if TARGET == CCHARP or TARGET is VOIDP:
if arg is None:
from rpython.rtyper.annlowlevel import llstr
arg = lltype.nullptr(CCHARP.TO) # None => (char*)NULL
to_free = to_free + (arg, llstr(None), '\x04')
elif isinstance(arg, str):
tup = get_nonmovingbuffer_ll_final_null(arg)
to_free = to_free + tup
arg = tup[0]
elif isinstance(arg, unicode):
_oops()
elif TARGET == CWCHARP:
if arg is None:
arg = lltype.nullptr(CWCHARP.TO) # None => (wchar_t*)NULL
to_free = to_free + (arg,)
elif isinstance(arg, unicode):
arg = unicode2wcharp(arg)
to_free = to_free + (arg,)
elif _isfunctype(TARGET) and not _isllptr(arg):
# XXX pass additional arguments
use_gil = invoke_around_handlers
arg = llhelper(TARGET, _make_wrapper_for(TARGET, arg,
callbackholder,
use_gil))
else:
SOURCE = lltype.typeOf(arg)
if SOURCE != TARGET:
if TARGET is lltype.Float:
arg = float(arg)
elif ((isinstance(SOURCE, lltype.Number)
or SOURCE is lltype.Bool)
and (isinstance(TARGET, lltype.Number)
or TARGET is lltype.Bool)):
arg = cast(TARGET, arg)
real_args = real_args + (arg,)
> res = call_external_function(*real_args)
..\rpython\rtyper\lltypesystem\rffi.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a0 = <* DEAD Array of UniChar {'nolength': True} >, a1 = 32768L, a2 = 438L
def call_external_function(a0, a1, a2):
rgil.release()
# NB. it is essential that no exception checking occurs here!
if 1:
from rpython.rlib import rposix
rposix._errno_before(1)
if we_are_translated():
res = funcptr(a0, a1, a2)
else:
try: # only when non-translated
res = funcptr(a0, a1, a2)
except:
rgil.acquire()
raise
if 1:
from rpython.rlib import rposix
> rposix._errno_after(1)
<91-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py:217>:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
save_err = 1
@specialize.call_location()
def _errno_after(save_err):
if _WIN32:
if save_err & rffi.RFFI_SAVE_LASTERROR:
err = rwin32._GetLastError()
# careful, setraw() overwrites GetLastError.
# We must read it first, before the errno handling.
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
elif save_err & rffi.RFFI_SAVE_WSALASTERROR:
from rpython.rlib import _rsocket_rffi
err = _rsocket_rffi._WSAGetLastError()
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_lasterror.setraw(err)
else:
rthread.tlfield_rpy_lasterror.setraw(err)
if save_err & rffi.RFFI_SAVE_ERRNO:
if save_err & rffi.RFFI_ALT_ERRNO:
rthread.tlfield_alt_errno.setraw(_get_errno())
else:
> rthread.tlfield_rpy_errno.setraw(_get_errno())
..\rpython\rlib\rposix.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <* fn get_errno>, args = ()
rffi = <module 'rpython.rtyper.lltypesystem.rffi' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\rtyper\\lltypesystem\\rffi.pyc'>
def __call__(self, *args):
from rpython.rtyper.lltypesystem import rffi
if isinstance(self._T, FuncType):
if len(args) != len(self._T.ARGS):
raise TypeError("calling %r with wrong argument number: %r" %
(self._T, args))
for i, a, ARG in zip(range(len(self._T.ARGS)), args, self._T.ARGS):
if typeOf(a) != ARG:
# ARG could be Void
if ARG == Void:
try:
value = getattr(self._obj, '_void' + str(i))
except AttributeError:
pass
else:
assert a == value
# None is acceptable for any pointer
elif isinstance(ARG, Ptr) and a is None:
pass
# Any pointer is convertible to void*
elif ARG is rffi.VOIDP and isinstance(typeOf(a), Ptr):
pass
# special case: ARG can be a container type, in which
# case a should be a pointer to it. This must also be
# special-cased in the backends.
elif (isinstance(ARG, ContainerType) and
typeOf(a) == Ptr(ARG)):
pass
else:
args_repr = [typeOf(arg) for arg in args]
raise TypeError("calling %r with wrong argument "
"types: %r" % (self._T, args_repr))
callb = self._obj._callable
if callb is None:
raise RuntimeError("calling undefined function")
> return callb(*args)
..\rpython\rtyper\lltypesystem\lltype.py:1384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.rtyper.lltypesystem.ll2ctypes.LL2CtypesCallable object at 0x0000023428d928a8>
argvalues = ()
def __call__(self, *argvalues):
with rlock:
if self.trampoline is None:
# lazily build the corresponding ctypes function object
cfunc = get_ctypes_callable(self.funcptr, self.calling_conv,
> self.natural_arity)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1339:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
funcptr = <* fn get_errno>, calling_conv = 'c', natural_arity = -1
def get_ctypes_callable(funcptr, calling_conv, natural_arity):
if not ctypes:
raise ImportError("ctypes is needed to use ll2ctypes")
def get_on_lib(lib, elem):
""" Wrapper to always use lib[func] instead of lib.func
"""
try:
return lib[elem]
except AttributeError:
pass
old_eci = funcptr._obj.compilation_info
funcname = funcptr._obj._name
if hasattr(old_eci, '_with_ctypes'):
old_eci = old_eci._with_ctypes
try:
eci = _eci_cache[old_eci]
except KeyError:
eci = old_eci.compile_shared_lib(ignore_a_files=True,
defines=['RPYTHON_LL2CTYPES'],
> symbolic=True)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1236:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
ignore_a_files = False, debug_mode = True, defines = ['RPYTHON_LL2CTYPES']
symbolic = True
def compile_shared_lib(self, outputfilename=None, ignore_a_files=False,
debug_mode=True, defines=[], symbolic=False):
self = self.convert_sources_to_files()
if ignore_a_files:
if not [fn for fn in self.link_files if fn.endswith('.a')]:
ignore_a_files = False # there are none
if not self.separate_module_files and not ignore_a_files:
return self # xxx there was some condition about win32 here
else:
#basepath = py.path.local(self.separate_module_files[0]).dirpath()
basepath = udir.join('shared_cache')
if outputfilename is None:
# find more or less unique name there
pth = basepath.join('externmod').new(ext=host.so_ext)
num = 0
while pth.check():
pth = basepath.join(
'externmod_%d' % (num,)).new(ext=host.so_ext)
num += 1
basepath.ensure(dir=1)
outputfilename = str(pth.dirpath().join(pth.purebasename))
d = self._copy_attributes()
if ignore_a_files:
d['link_files'] = [fn for fn in d['link_files']
if not fn.endswith('.a')]
if debug_mode and sys.platform != 'win32':
d['compile_extra'] = d['compile_extra'] + ('-g', '-O0')
d['compile_extra'] = d['compile_extra'] + (
'-DRPY_EXTERN=RPY_EXPORTED',)
for define in defines:
d['compile_extra'] += ('-D%s' % define,)
# On ELF platforms (Linux), prevent symbol interposition: when the host
# interpreter (e.g. pypy2.7) also exports symbols like pypysig_counter,
# the shared lib's own references would otherwise resolve to the host's
# copy via the GOT. -Bsymbolic makes the shared lib bind its own global
# symbol references to its own definitions. Only needed when running
# under a host interpreter (tests), not during translation.
if symbolic and sys.platform not in ('win32', 'darwin'):
d['link_extra'] = d['link_extra'] + ('-Wl,-Bsymbolic',)
self = ExternalCompilationInfo(**d)
lib = str(host.compile([], self, outputfilename=outputfilename,
> standalone=False))
..\rpython\translator\tool\cbuild.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cfiles = []
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def compile(self, cfiles, eci, outputfilename=None, standalone=True):
ofiles = self._compile_o_files(cfiles, eci, standalone)
> return self._finish_linking(ofiles, eci, outputfilename, standalone)
..\rpython\translator\platform\__init__.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=('errno.h', 'stdio.h',...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9'
standalone = False
def _finish_linking(self, ofiles, eci, outputfilename, standalone):
if outputfilename is None:
outputfilename = ofiles[0].purebasename
if ofiles:
dirname = ofiles[0].dirpath()
else:
dirname = udir.join('module_cache')
exe_name = dirname.join(outputfilename, abs=True)
if standalone:
if self.exe_ext:
exe_name += '.' + self.exe_ext
else:
exe_name += '.' + self.so_ext
if eci.use_cpp_linker:
cc_link = 'g++' # XXX hard-coded so far
else:
cc_link = self.cc
largs = self._link_args_from_eci(eci, standalone)
> return self._link(cc_link, ofiles, largs, standalone, exe_name)
..\rpython\translator\platform\__init__.py:235:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'cl.exe'
ofiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj'), local('d:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj')]
link_args = ['/nologo', '/LARGEADDRESSAWARE', '/STACK:3145728', '/MANIFEST:EMBED', 'kernel32.lib']
standalone = False
exe_name = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _link(self, cc, ofiles, link_args, standalone, exe_name):
args = ['/nologo'] + [str(ofile) for ofile in ofiles] + link_args
args += ['/out:%s' % (exe_name,), '/incremental:no']
if not standalone:
args = self._args_for_shared(args)
# Tell the linker to embed a manifest with the default
# UAC level asInvoker (Visual Studio 2008 +)
args += ["/MANIFEST:EMBED"]
> self._execute_c_compiler(self.link, args, exe_name)
..\rpython\translator\platform\windows.py:303:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'link.exe'
args = ['/dll', '/nologo', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_13.obj', 'd:\\systemtemp\\pytest\\usession-py3.11-340\\module_cache\\module_14.obj', '/nologo', '/LARGEADDRESSAWARE', ...]
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
cwd = None
def _execute_c_compiler(self, cc, args, outname, cwd=None):
#log.execute(cc + ' ' + ' '.join(args))
# 'cc' can also contain some options for the C compiler;
# e.g. it can be "gcc -m32". We handle it by splitting on ' '.
cclist = cc.split()
cc = cclist[0]
args = cclist[1:] + args
returncode, stdout, stderr = _run_subprocess(cc, args, self.c_environ,
cwd)
> self._handle_error(returncode, stdout, stderr, outname)
..\rpython\translator\platform\__init__.py:143:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, returncode = 3221225477, stdout = ''
stderr = ''
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-340\\shared_cache\\externmod_9.dll')
def _handle_error(self, returncode, stdout, stderr, outname):
if returncode != 0:
# Microsoft compilers write compilation errors to stdout
stderr = stdout + stderr
errorfile = outname.new(ext='errors')
errorfile.write(stderr, mode='wb')
if self.log_errors:
stderrlines = stderr.splitlines()
for line in stderrlines:
log.Error(line)
# ^^^ don't use ERROR, because it might actually be fine.
# Also, ERROR confuses lib-python/conftest.py.
> raise CompilationError(stdout, stderr)
E CompilationError: CompilationError(out="""
E """)
..\rpython\translator\platform\windows.py:319: CompilationError
========================== 6 error in 87.29 seconds ===========================
++ 04:03:38 starting module/cpyext/test/test_classobject.py [55 started in total]
__ module/cpyext/test/test_bytesobject.py [52 done in total, somefailed=False]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 20 items
module\cpyext\test\test_bytesobject.py ....................
========================= 20 passed in 184.67 seconds =========================
++ 04:05:37 starting module/cpyext/test/test_codecs.py [56 started in total]
__ module/cpyext/test/test_cell.py [53 done in total, somefailed=False] _______
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module\cpyext\test\test_cell.py .
========================= 1 passed in 128.00 seconds ==========================
++ 04:06:04 starting module/cpyext/test/test_complexobject.py [57 started in total]
__ module/cpyext/test/test_capsule.py [54 done in total, somefailed=False] ____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module\cpyext\test\test_capsule.py ...
========================= 3 passed in 179.65 seconds ==========================
++ 04:06:15 starting module/cpyext/test/test_contextvars.py [58 started in total]
__ module/cpyext/test/test_classobject.py [55 done in total, somefailed=False]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 2 items
module\cpyext\test\test_classobject.py ..
========================= 2 passed in 131.60 seconds ==========================
++ 04:06:26 starting module/cpyext/test/test_cpyext.py [59 started in total]
__ module/cpyext/test/test_codecs.py [56 done in total, somefailed=False] _____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module\cpyext\test\test_codecs.py ...
========================= 3 passed in 125.61 seconds ==========================
++ 04:08:18 starting module/cpyext/test/test_datetime.py [60 started in total]
__ module/cpyext/test/test_complexobject.py [57 done in total, somefailed=False]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module\cpyext\test\test_complexobject.py ......
========================= 6 passed in 130.34 seconds ==========================
++ 04:08:53 starting module/cpyext/test/test_dictobject.py [61 started in total]
__ module/cpyext/test/test_contextvars.py [58 done in total, somefailed=False]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module\cpyext\test\test_contextvars.py .
========================= 1 passed in 128.91 seconds ==========================
++ 04:09:03 starting module/cpyext/test/test_eval.py [62 started in total]
__ module/cpyext/test/test_cpyext.py [59 done in total, somefailed=False] _____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 26 items
module\cpyext\test\test_cpyext.py ...........s..............
=================== 25 passed, 1 skipped in 292.44 seconds ====================
++ 04:12:01 starting module/cpyext/test/test_exception.py [63 started in total]
__ module/cpyext/test/test_datetime.py [60 done in total, somefailed=False] ___
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 16 items
module\cpyext\test\test_datetime.py ................
========================= 16 passed in 215.51 seconds =========================
++ 04:12:42 starting module/cpyext/test/test_fileobject.py [64 started in total]
__ module/cpyext/test/test_dictobject.py [61 done in total, somefailed=False] _
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 19 items
module\cpyext\test\test_dictobject.py ...................
========================= 19 passed in 206.25 seconds =========================
++ 04:13:01 starting module/cpyext/test/test_floatobject.py [65 started in total]
__ module/cpyext/test/test_eval.py [62 done in total, somefailed=False] _______
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 19 items
module\cpyext\test\test_eval.py ...............x...
=================== 18 passed, 1 xfailed in 231.06 seconds ====================
++ 04:13:34 starting module/cpyext/test/test_frameobject.py [66 started in total]
__ module/cpyext/test/test_exception.py [63 done in total, somefailed=False] __
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module\cpyext\test\test_exception.py ......
========================= 6 passed in 139.95 seconds ==========================
++ 04:15:11 starting module/cpyext/test/test_funcobject.py [67 started in total]
__ module/cpyext/test/test_fileobject.py [64 done in total, somefailed=False] _
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module\cpyext\test\test_fileobject.py .
========================= 1 passed in 116.45 seconds ==========================
++ 04:15:30 starting module/cpyext/test/test_genobject.py [68 started in total]
__ module/cpyext/test/test_frameobject.py [65 done in total, somefailed=False]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 4 items
module\cpyext\test\test_frameobject.py ....
========================= 4 passed in 135.11 seconds ==========================
++ 04:16:29 starting module/cpyext/test/test_getargs.py [69 started in total]
__ module/cpyext/test/test_floatobject.py [66 done in total, somefailed=False]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 14 items
module\cpyext\test\test_floatobject.py ..............
========================= 14 passed in 175.77 seconds =========================
++ 04:16:40 starting module/cpyext/test/test_import.py [70 started in total]
__ module/cpyext/test/test_funcobject.py [67 done in total, somefailed=False] _
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 14 items
module\cpyext\test\test_funcobject.py ..............
========================= 14 passed in 191.85 seconds =========================
++ 04:19:05 starting module/cpyext/test/test_iterator.py [71 started in total]
__ module/cpyext/test/test_genobject.py [68 done in total, somefailed=False] __
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module\cpyext\test\test_genobject.py ...
========================= 3 passed in 194.73 seconds ==========================
++ 04:19:24 starting module/cpyext/test/test_listobject.py [72 started in total]
__ module/cpyext/test/test_getargs.py [69 done in total, somefailed=False] ____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 16 items
module\cpyext\test\test_getargs.py ................
========================= 16 passed in 196.77 seconds =========================
++ 04:20:46 starting module/cpyext/test/test_longobject.py [73 started in total]
__ module/cpyext/test/test_import.py [70 done in total, somefailed=False] _____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 8 items
module\cpyext\test\test_import.py ........
========================= 8 passed in 218.19 seconds ==========================
++ 04:21:17 starting module/cpyext/test/test_mapping.py [74 started in total]
__ module/cpyext/test/test_iterator.py [71 done in total, somefailed=False] ___
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module\cpyext\test\test_iterator.py ......
========================= 6 passed in 139.91 seconds ==========================
++ 04:22:30 starting module/cpyext/test/test_marshal.py [75 started in total]
__ module/cpyext/test/test_mapping.py [72 done in total, somefailed=False] ____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 5 items
module\cpyext\test\test_mapping.py .....
========================== 5 passed in 69.68 seconds ==========================
++ 04:23:16 starting module/cpyext/test/test_memoryobject.py [76 started in total]
__ module/cpyext/test/test_listobject.py [73 done in total, somefailed=False] _
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 14 items
module\cpyext\test\test_listobject.py ..............
========================= 14 passed in 171.00 seconds =========================
++ 04:23:26 starting module/cpyext/test/test_methodobject.py [77 started in total]
__ module/cpyext/test/test_longobject.py [74 done in total, somefailed=False] _
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 25 items
module\cpyext\test\test_longobject.py .........................
========================= 25 passed in 197.28 seconds =========================
++ 04:25:01 starting module/cpyext/test/test_misc.py [78 started in total]
__ module/cpyext/test/test_marshal.py [75 done in total, somefailed=False] ____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 2 items
module\cpyext\test\test_marshal.py ..
========================= 2 passed in 130.48 seconds ==========================
++ 04:25:48 starting module/cpyext/test/test_module.py [79 started in total]
__ module/cpyext/test/test_memoryobject.py [76 done in total, somefailed=True]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 13 items
module\cpyext\test\test_memoryobject.py ...s..s.F....
================================== FAILURES ===================================
_____________________ AppTestPyBuffer.test_releasebuffer ______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000022ae4b6ba98>
def test_releasebuffer(self):
module = self.import_extension('foo', [
("create_test", "METH_NOARGS",
"""
PyObject *obj;
obj = PyObject_New(PyObject, (PyTypeObject*)type);
return obj;
"""),
("get_cnt", "METH_NOARGS",
'return PyLong_FromLong(cnt);'),
("get_dealloc_cnt", "METH_NOARGS",
'return PyLong_FromLong(dealloc_cnt);'),
],
prologue="""
static float test_data = 42.f;
static int cnt=0;
static int dealloc_cnt=0;
static PyHeapTypeObject * type=NULL;
void dealloc(PyObject *self) {
dealloc_cnt++;
}
int getbuffer(PyObject *obj, Py_buffer *view, int flags) {
cnt ++;
memset(view, 0, sizeof(Py_buffer));
view->obj = obj;
/* see the CPython docs for why we need this incref:
https://docs.python.org/3.5/c-api/typeobj.html#c.PyBufferProcs.bf_getbuffer */
Py_INCREF(obj);
view->ndim = 0;
view->buf = (void *) &test_data;
view->itemsize = sizeof(float);
view->len = 1;
view->strides = NULL;
view->shape = NULL;
view->format = "f";
return 0;
}
void releasebuffer(PyObject *obj, Py_buffer *view) {
cnt --;
}
""", more_init="""
type = (PyHeapTypeObject *) PyType_Type.tp_alloc(&PyType_Type, 0);
type->ht_type.tp_name = "Test";
type->ht_type.tp_basicsize = sizeof(PyObject);
type->ht_name = PyUnicode_FromString("Test");
type->ht_type.tp_flags |= Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
Py_TPFLAGS_HEAPTYPE;
type->ht_type.tp_flags &= ~Py_TPFLAGS_HAVE_GC;
type->ht_type.tp_dealloc = dealloc;
type->ht_type.tp_as_buffer = &type->as_buffer;
type->as_buffer.bf_getbuffer = getbuffer;
type->as_buffer.bf_releasebuffer = releasebuffer;
if (PyType_Ready(&type->ht_type) < 0) INITERROR;
""", )
import gc
assert module.get_cnt() == 0
a = memoryview(module.create_test())
assert module.get_cnt() == 1
assert module.get_dealloc_cnt() == 0
del a
self.debug_collect()
assert module.get_cnt() == 0
> assert module.get_dealloc_cnt() == 1
E (application-level) AssertionError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\cpyext\test\test_memoryobject.py:296]:69: AssertionError
---------------------------- Captured stdout call -----------------------------
source_0.c
Creating library d:\systemtemp\pytest\usession-py3.11-365\foo-4\foo.lib and object d:\systemtemp\pytest\usession-py3.11-365\foo-4\foo.exp
Generating code
Finished generating code
dealloc_trigger...
deallocating PyObject * <C object Struct _object { c_ob_refcnt, c_ob_pypy_link, c_ob_type } at 0x22ae1de75e0>
deallocating PyObject * <C object Struct _object { c_ob_refcnt, c_ob_pypy_link, c_ob_type } at 0x22ae1de7d80>
deallocating PyObject * <C object Struct _object { c_ob_refcnt, c_ob_pypy_link, c_ob_type } at 0x22ae1de8180>
dealloc_trigger DONE
---------------------------- Captured stderr call -----------------------------
<function PyModule_Create2 at 0x0000022adff2fb50> DONE
<function PyUnicode_FromString at 0x0000022adf3a6c50> DONE
<function PyType_Ready at 0x0000022adf47c098> DONE
<function PyLong_FromLong at 0x0000022adff59010> DONE
<function PyLong_FromLong at 0x0000022adff59010> DONE
<function PyLong_FromLong at 0x0000022adff59010> DONE
<function PyLong_FromLong at 0x0000022adff59010> DONE
<function PyLong_FromLong at 0x0000022adff59010> DONE
=========================== short test summary info ===========================
FAIL module\cpyext\test\test_memoryobject.py::AppTestPyBuffer::()::test_releasebuffer
============== 1 failed, 10 passed, 2 skipped in 161.01 seconds ===============
++ 04:26:33 starting module/cpyext/test/test_namespaceobject.py [80 started in total]
__ module/cpyext/test/test_methodobject.py [77 done in total, somefailed=False]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 14 items
module\cpyext\test\test_methodobject.py ..............
========================= 14 passed in 185.14 seconds =========================
++ 04:27:05 starting module/cpyext/test/test_ndarrayobject.py [81 started in total]
__ module/cpyext/test/test_ndarrayobject.py [78 done in total, somefailed=False]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items / 1 skipped
========================== 1 skipped in 6.31 seconds ==========================
++ 04:27:51 starting module/cpyext/test/test_number.py [82 started in total]
__ module/cpyext/test/test_misc.py [79 done in total, somefailed=False] _______
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module\cpyext\test\test_misc.py .
========================= 1 passed in 128.44 seconds ==========================
++ 04:27:57 starting module/cpyext/test/test_object.py [83 started in total]
__ module/cpyext/test/test_namespaceobject.py [80 done in total, somefailed=False]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module\cpyext\test\test_namespaceobject.py .
========================= 1 passed in 106.81 seconds ==========================
++ 04:29:07 starting module/cpyext/test/test_pyerrors.py [84 started in total]
__ module/cpyext/test/test_module.py [81 done in total, somefailed=False] _____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 25 items
module\cpyext\test\test_module.py .........................
========================= 25 passed in 243.34 seconds =========================
++ 04:30:47 starting module/cpyext/test/test_pyfile.py [85 started in total]
__ module/cpyext/test/test_number.py [82 done in total, somefailed=False] _____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 7 items
module\cpyext\test\test_number.py .......
========================= 7 passed in 181.96 seconds ==========================
++ 04:31:37 starting module/cpyext/test/test_pymem.py [86 started in total]
__ module/cpyext/test/test_object.py [83 done in total, somefailed=False] _____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 40 items
module\cpyext\test\test_object.py .......................s................
=================== 39 passed, 1 skipped in 299.23 seconds ====================
++ 04:33:41 starting module/cpyext/test/test_pysignals.py [87 started in total]
__ module/cpyext/test/test_pyfile.py [84 done in total, somefailed=False] _____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 141.80 seconds ====================
++ 04:33:58 starting module/cpyext/test/test_pystate.py [88 started in total]
__ module/cpyext/test/test_pymem.py [85 done in total, somefailed=False] ______
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module\cpyext\test\test_pymem.py .
========================= 1 passed in 166.10 seconds ==========================
++ 04:35:32 starting module/cpyext/test/test_pystrhex.py [89 started in total]
__ module/cpyext/test/test_pyerrors.py [86 done in total, somefailed=True] ____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 33 items
module\cpyext\test\test_pyerrors.py ........s.....sF.......s...s.....
================================== FAILURES ===================================
______________ AppTestFetch.test_SetFromErrnoWithFilename_basic _______________
self = <CallInfo when='call' exception: 'ascii' codec can't encode character u'\xe4' in position 106: ordinal not in range(128)>
func = <function <lambda> at 0x0000023e28dcc4d0>, 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_SetFromErrnoWithFilename_basic'...all__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_SetFromErrnoWithFilename_basic'>}
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 0x0000023e19363408>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000023e20fded60>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_SetFromErrnoWithFilename_basic'...all__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_SetFromErrnoWithFilename_basic'>}
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 0x0000023e20fded60>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_SetFromErrnoWithFilename_basic'...all__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_SetFromErrnoWithFilename_basic'>}
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_SetFromErrnoWithFilename_basic'>, '__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 0x0000023e1cd1e980>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...name_basic'>, '__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 0x0000023e21453060>
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 0x0000023e21453060>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...name_basic'>, '__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_SetFromErrnoWithFilename_basic'>, '__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 0x0000023e1cd1e930>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...name_basic'>, '__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 0x0000023e21453020>
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 0x0000023e21453020>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...name_basic'>, '__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_SetFromErrnoWithFilename_basic'>, '__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_SetFromErrnoWithFilename_basic'>
def pytest_runtest_call(item):
try:
> item.runtest()
..\_pytest\runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_SetFromErrnoWithFilename_basic'>
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_SetFromErrnoWithFilename_basic'>
space = StdObjSpace
target = <function test_SetFromErrnoWithFilename_basic at 0x0000023e25567bc8>
args = (StdObjSpace, <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000023e2a8801a8>)
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 0x0000023e2a8801a8>,)
w_func = <Function test_SetFromErrnoWithFilename_basic>
args = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000023e2a8801a8>
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_SetFromErrnoWithFilename_basic>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000023e2a8801a8>,)
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_SetFromErrnoWithFilename_basic>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000023e2a8801a8>,)
gateway = <module 'pypy.interpreter.gateway' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\interpreter\\gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <code object test_SetFromErrnoWithFilename_basic, file "[d:\pypy_stuff\buildbo...ve\own-win-x86-64\build\pypy\module\cpyext\test\test_pyerrors.py:250]", 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:131:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_SetFromE...x86-64\build\pypy\module\cpyext\test\test_pyerrors.py:250]", line 1> at line 56
name = 'test_SetFromErrnoWithFilename_basic'
qualname = 'test_SetFromErrnoWithFilename_basic'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_SetFromE...x86-64\build\pypy\module\cpyext\test\test_pyerrors.py:250]", line 1> at line 56
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_SetFromE...x86-64\build\pypy\module\cpyext\test\test_pyerrors.py:250]", line 1> at line 56
e = UnicodeEncodeError('ascii', u'\n errno = EBADF;\n ... return NULL;\n ', 106, 107, 'ordinal not in range(128)')
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_SetFromE...x86-64\build\pypy\module\cpyext\test\test_pyerrors.py:250]", line 1> at line 56
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_SetFromE...x86-64\build\pypy\module\cpyext\test\test_pyerrors.py:250]", line 1> at line 56
pycode = <code object test_SetFromErrnoWithFilename_basic, file "[d:\pypy_stuff\buildbo...ve\own-win-x86-64\build\pypy\module\cpyext\test\test_pyerrors.py:250]", line 1>
next_instr = 72
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x0000023e202eae58>
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_SetFromE...x86-64\build\pypy\module\cpyext\test\test_pyerrors.py:250]", line 1> at line 56
co_code = '|\x00j\x00}\x01|\x01d\x00u\x00r\td\x01}\x01d\x02d\x00l\x01}\x02d\x02d\x00l\x02}\x03d\x02d\x00l\x03}\x04d\x03d\x04d\x0...01|\x07j\tj\nd\x13k\x02\x90\x01s\x0cJ\x00\x82\x01|\x07j\tj\x14d\x14k\x02\x90\x01s\x15J\x00\x82\x01d\x00S\x00d\x00S\x00'
next_instr = 72
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x0000023e202eae58>
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_SetFromE...x86-64\build\pypy\module\cpyext\test\test_pyerrors.py:250]", line 1> at line 56
co_code = '|\x00j\x00}\x01|\x01d\x00u\x00r\td\x01}\x01d\x02d\x00l\x01}\x02d\x02d\x00l\x02}\x03d\x02d\x00l\x03}\x04d\x03d\x04d\x0...01|\x07j\tj\nd\x13k\x02\x90\x01s\x0cJ\x00\x82\x01|\x07j\tj\x14d\x14k\x02\x90\x01s\x15J\x00\x82\x01d\x00S\x00d\x00S\x00'
next_instr = 102
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x0000023e202eae58>
@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_SetFromE...x86-64\build\pypy\module\cpyext\test\test_pyerrors.py:250]", line 1> at line 56
n_arguments = 2, ignored = (102,)
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_extension>
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject....n '))])], ['prologue'], [W_UnicodeObject('#include <errno.h>')])
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_extension>
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject....n '))])], ['prologue'], [W_UnicodeObject('#include <errno.h>')])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x0000023e2a29d408>
func = <FunctionWithFixedCode import_extension>
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject....n '))])], ['prologue'], [W_UnicodeObject('#include <errno.h>')])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x0000023e2a29d408>
func = <FunctionWithFixedCode import_extension>, w_obj = None
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject....n '))])], ['prologue'], [W_UnicodeObject('#include <errno.h>')])
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 0x0000023e2a29d408>
space = StdObjSpace
e = UnicodeEncodeError('ascii', u'\n errno = EBADF;\n ... return NULL;\n ', 106, 107, 'ordinal not in range(128)')
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 0x0000023e2a29d408>
func = <FunctionWithFixedCode import_extension>, w_obj = None
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject....n '))])], ['prologue'], [W_UnicodeObject('#include <errno.h>')])
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_W_Root_text_W_Root_text_bool object at 0x0000023e2a29d590>
space = StdObjSpace
scope_w = [W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x0000...or, code, ar...rn NULL;\n '))]), W_UnicodeObject('#include <errno.h>'), None, W_UnicodeObject(''), W_BoolObject(False)]
def _run(self, space, scope_w):
> return self.behavior(space, space.text_w(scope_w[0]), scope_w[1], space.text_w(scope_w[2]), scope_w[3], space.text_w(scope_w[4]), space.is_true(scope_w[5]))
<6980-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, modname = 'foo'
w_functions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x0000...or, code, arg1, arg2);\n return NULL;\n '))])
prologue = '#include <errno.h>', w_include_dirs = None, more_init = ''
PY_SSIZE_T_CLEAN = False
@unwrap_spec(modname='text', prologue='text',
more_init='text', PY_SSIZE_T_CLEAN=bool)
def import_extension(space, modname, w_functions, prologue="",
w_include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
functions = space.unwrap(w_functions)
include_dirs = _unwrap_include_dirs(space, w_include_dirs)
# If there's already a module under this name (file-based or a
# previous inline extension), save it in _module_keepalive before
# it's displaced. This prevents its raw allocations (method-name
# strings, type dicts, etc.) from being freed during a later
# test's leakfinder tracking window.
self._file_module_cache.pop(modname, None)
w_modules = space.sys.get('modules')
try:
w_old = space.getitem(w_modules, space.newtext(modname))
self._module_keepalive.append(w_old)
except OperationError:
pass
w_result = self.sys_info.import_extension(
modname, functions, prologue, include_dirs, more_init,
> PY_SSIZE_T_CLEAN)
module\cpyext\test\test_cpyext.py:415:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.cpyext.test.test_cpyext.SpaceCompiler object at 0x0000023e2a751ad0>
modname = 'foo'
functions = [(u'set_from_errno', u'METH_NOARGS', u'\n errno = EBADF;\n PyErr_SetFromErrnoWithFilen...mWindowsErrWithFilenameObjects(PyExc_OSError, code, arg1, arg2);\n return NULL;\n ')]
prologue = '#include <errno.h>', include_dirs = None, more_init = ''
PY_SSIZE_T_CLEAN = False
def import_extension(self, modname, functions, prologue="",
include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
> body = prologue + make_methods(functions, modname)
tool\cpyext\extbuild.py:88:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
functions = [(u'set_from_errno', u'METH_NOARGS', u'\n errno = EBADF;\n PyErr_SetFromErrnoWithFilen...mWindowsErrWithFilenameObjects(PyExc_OSError, code, arg1, arg2);\n return NULL;\n ')]
modname = 'foo'
def make_methods(functions, modname):
methods_table = []
codes = []
for funcname, flags, code in functions:
cfuncname = "%s_%s" % (modname, funcname)
if 'METH_FASTCALL' in flags and 'METH_KEYWORDS' in flags:
signature = ('(PyObject *self, PyObject *const *args, '
'Py_ssize_t len_args, PyObject *kwnames)')
elif 'METH_KEYWORDS' in flags:
signature = '(PyObject *self, PyObject *args, PyObject *kwargs)'
elif 'METH_FASTCALL' in flags:
signature = ('(PyObject *self, PyObject *const *args, '
'Py_ssize_t len_args)')
else:
signature = '(PyObject *self, PyObject *args)'
methods_table.append(
"{\"%s\", (PyCFunction)%s, %s}," % (funcname, cfuncname, flags))
func_code = """
static PyObject* {cfuncname}{signature}
{{
{code}
}}
> """.format(cfuncname=cfuncname, signature=signature, code=code)
E UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 106: ordinal not in range(128)
tool\cpyext\extbuild.py:139: UnicodeEncodeError
=========================== short test summary info ===========================
FAIL module\cpyext\test\test_pyerrors.py::AppTestFetch::()::test_SetFromErrnoWithFilename_basic
============== 1 failed, 28 passed, 4 skipped in 295.03 seconds ===============
++ 04:35:49 starting module/cpyext/test/test_pystrtod.py [90 started in total]
__ module/cpyext/test/test_pysignals.py [87 done in total, somefailed=False] __
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module\cpyext\test\test_pysignals.py .
========================= 1 passed in 131.20 seconds ==========================
++ 04:36:44 starting module/cpyext/test/test_sequence.py [91 started in total]
__ module/cpyext/test/test_pystate.py [88 done in total, somefailed=False] ____
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 168.58 seconds ==============
++ 04:37:44 starting module/cpyext/test/test_setobject.py [92 started in total]
__ module/cpyext/test/test_pystrhex.py [89 done in total, somefailed=False] ___
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module\cpyext\test\test_pystrhex.py .
========================= 1 passed in 126.05 seconds ==========================
++ 04:38:35 starting module/cpyext/test/test_sliceobject.py [93 started in total]
__ module/cpyext/test/test_pystrtod.py [90 done in total, somefailed=False] ___
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 20 items
module\cpyext\test\test_pystrtod.py ....................
========================= 20 passed in 243.88 seconds =========================
++ 04:40:40 starting module/cpyext/test/test_structseq.py [94 started in total]
__ module/cpyext/test/test_sequence.py [91 done in total, somefailed=False] ___
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 23 items
module\cpyext\test\test_sequence.py .......................
========================= 23 passed in 235.66 seconds =========================
++ 04:41:43 starting module/cpyext/test/test_sysmodule.py [95 started in total]
__ module/cpyext/test/test_setobject.py [92 done in total, somefailed=False] __
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 9 items
module\cpyext\test\test_setobject.py .........
========================= 9 passed in 221.54 seconds ==========================
++ 04:42:07 starting module/cpyext/test/test_thread.py [96 started in total]
__ module/cpyext/test/test_sliceobject.py [93 done in total, somefailed=False]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 8 items
module\cpyext\test\test_sliceobject.py ........
========================= 8 passed in 218.32 seconds ==========================
++ 04:43:49 starting module/cpyext/test/test_traceback.py [97 started in total]
__ module/cpyext/test/test_structseq.py [94 done in total, somefailed=False] __
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module\cpyext\test\test_structseq.py .
========================= 1 passed in 179.55 seconds ==========================
++ 04:44:42 starting module/cpyext/test/test_translate.py [98 started in total]
__ module/cpyext/test/test_translate.py [95 done in total, somefailed=False] __
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module\cpyext\test\test_translate.py .
========================== 1 passed in 27.24 seconds ==========================
++ 04:46:19 starting module/cpyext/test/test_tupleobject.py [99 started in total]
__ module/cpyext/test/test_sysmodule.py [96 done in total, somefailed=False] __
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module\cpyext\test\test_sysmodule.py ...
========================= 3 passed in 215.42 seconds ==========================
++ 04:46:22 starting module/cpyext/test/test_typeobject.py [100 started in total]
__ module/cpyext/test/test_traceback.py [97 done in total, somefailed=False] __
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items
module\cpyext\test\test_traceback.py .
========================= 1 passed in 122.58 seconds ==========================
++ 04:47:22 starting module/cpyext/test/test_unicodeobject.py [101 started in total]
__ module/cpyext/test/test_thread.py [98 done in total, somefailed=True] ______
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 6 items
module\cpyext\test\test_thread.py x..Fx.
================================== FAILURES ===================================
________________________ AppTestThread.test_timed_lock ________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x00000250677bee90>
def test_timed_lock(self):
module = self.import_extension('foo', [
("timed_acquire_lock", "METH_O",
"""
#ifndef PyThread_acquire_lock_timed
#error "seems we are not accessing PyPy's functions"
#endif
PyLockStatus acquire_result;
int microseconds = PyLong_AsLong(args);
Py_BEGIN_ALLOW_THREADS
acquire_result = PyThread_acquire_lock_timed(global_lock, microseconds, 0);
Py_END_ALLOW_THREADS
if (acquire_result == PY_LOCK_ACQUIRED) {
Py_RETURN_TRUE;
} else {
Py_RETURN_FALSE;
}
"""),
("release_lock", "METH_NOARGS",
"""
PyThread_release_lock(global_lock);
Py_RETURN_NONE;
"""),
("cleanup_lock", "METH_NOARGS",
"""
// cleanup isn't part of the test, but I'd feel guilty otherwise
PyThread_free_lock(global_lock); global_lock=NULL;
Py_RETURN_NONE;
"""
)
],
prologue="static PyThread_type_lock global_lock;",
more_init="global_lock = PyThread_allocate_lock();"
)
try:
import threading
import time
failure = []
assert module.timed_acquire_lock(-1)
main_thread_should_release_the_lock_barrier = threading.Barrier(2)
def thread_func():
try:
if module.timed_acquire_lock(0):
failure.append("Lock should be held elsewhere")
return
if module.timed_acquire_lock(1):
failure.append("Lock should be held elsewhere")
return
finally:
main_thread_should_release_the_lock_barrier.wait()
if not module.timed_acquire_lock(1000000):
failure.append("Lock should have become available")
return
module.release_lock()
thread = threading.Thread(target=thread_func)
thread.start()
main_thread_should_release_the_lock_barrier.wait()
# At this point, thread_func should be waiting 1s for the lock,
# so sleep a short amount of time then let it have the lock.
time.sleep(0.01)
module.release_lock()
thread.join()
> assert not failure, failure
E (application-level) AssertionError: ['Lock should have become available']
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\cpyext\test\test_thread.py:84]:65: AssertionError
---------------------------- Captured stdout call -----------------------------
source_0.c
Creating library d:\systemtemp\pytest\usession-py3.11-385\foo-2\foo.lib and object d:\systemtemp\pytest\usession-py3.11-385\foo-2\foo.exp
Generating code
Finished generating code
---------------------------- Captured stderr call -----------------------------
<function PyModule_Create2 at 0x0000025064a79bc8> DONE
<function PyLong_AsLong at 0x0000025064a9fc40> DONE
<function PyEval_SaveThread at 0x0000025063772728> DONE
<function PyEval_RestoreThread at 0x0000025063772638> DONE
<function PyLong_AsLong at 0x0000025064a9fc40> DONE
<function PyEval_SaveThread at 0x0000025063772728> DONE
<function PyEval_RestoreThread at 0x0000025063772638> DONE
<function PyLong_AsLong at 0x0000025064a9fc40> DONE
<function PyEval_SaveThread at 0x0000025063772728> DONE
<function PyEval_RestoreThread at 0x0000025063772638> DONE
<function PyLong_AsLong at 0x0000025064a9fc40> DONE
<function PyEval_SaveThread at 0x0000025063772728> DONE
<function PyEval_RestoreThread at 0x0000025063772638> DONE
=========================== short test summary info ===========================
FAIL module\cpyext\test\test_thread.py::AppTestThread::()::test_timed_lock
=============== 1 failed, 3 passed, 2 xfailed in 274.27 seconds ===============
++ 04:47:51 starting module/cpyext/test/test_userslots.py [102 started in total]
__ module/cpyext/test/test_tupleobject.py [99 done in total, somefailed=False]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 10 items
module\cpyext\test\test_tupleobject.py ..........
========================= 10 passed in 255.23 seconds =========================
++ 04:52:32 starting module/cpyext/test/test_version.py [103 started in total]
__ module/cpyext/test/test_userslots.py [100 done in total, somefailed=False] _
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 7 items
module\cpyext\test\test_userslots.py .......
========================= 7 passed in 374.28 seconds ==========================
called power
++ 04:55:02 starting module/cpyext/test/test_weakref.py [104 started in total]
__ module/cpyext/test/test_unicodeobject.py [101 done in total, somefailed=True]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 78 items
module\cpyext\test\test_unicodeobject.py .......................................................FF.....................
================================== FAILURES ===================================
____________________________ TestUnicode.test_mbcs ____________________________
self = <pypy.module.cpyext.test.test_unicodeobject.TestUnicode object at 0x000002c412cd63d8>
space = StdObjSpace
def test_mbcs(self, space):
if sys.platform != 'win32':
py.test.skip("mcbs encoding only exists on Windows")
unichars = u"abc"
wbuf = rffi.unicode2wcharp(unichars)
try:
w_bytes = PyUnicode_EncodeMBCS(space, wbuf, 3, None)
finally:
rffi.free_wcharp(wbuf)
assert space.type(w_bytes) is space.w_bytes
> assert space.utf8_w(w_bytes) == "abc"
module\cpyext\test\test_unicodeobject.py:1271:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
interpreter\baseobjspace.py:1940: in utf8_w
return w_obj.utf8_w(self)
interpreter\baseobjspace.py:274: in utf8_w
self._typed_unwrap_error(space, "str")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = W_BytesObject('abc'), space = StdObjSpace, expected = 'str'
def _typed_unwrap_error(self, space, expected):
raise oefmt(space.w_TypeError,
> "expected %s, got %T object", expected, self)
E OpErrFmt: [<W_TypeObject 'TypeError' at 0x2c40f76e528>: expected str, got bytes object]
interpreter\baseobjspace.py:318: OpErrFmt
__________________________ TestUnicode.test_codepage __________________________
self = <pypy.module.cpyext.test.test_unicodeobject.TestUnicode object at 0x000002c40e6a4f70>
space = StdObjSpace
def test_codepage(self, space):
if sys.platform != 'win32':
py.test.skip("codepage encoding only exists on Windows")
chars = "abc"
w_obj = space.newtext(chars)
w_bytes = PyUnicode_EncodeCodePage(space, 932, w_obj, None)
assert space.type(w_bytes) is space.w_bytes
> assert space.utf8_w(w_bytes) == "abc"
module\cpyext\test\test_unicodeobject.py:1280:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
interpreter\baseobjspace.py:1940: in utf8_w
return w_obj.utf8_w(self)
interpreter\baseobjspace.py:274: in utf8_w
self._typed_unwrap_error(space, "str")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = W_BytesObject('abc'), space = StdObjSpace, expected = 'str'
def _typed_unwrap_error(self, space, expected):
raise oefmt(space.w_TypeError,
> "expected %s, got %T object", expected, self)
E OpErrFmt: [<W_TypeObject 'TypeError' at 0x2c40f76e528>: expected str, got bytes object]
interpreter\baseobjspace.py:318: OpErrFmt
=========================== short test summary info ===========================
FAIL module\cpyext\test\test_unicodeobject.py::TestUnicode::()::test_mbcs
FAIL module\cpyext\test\test_unicodeobject.py::TestUnicode::()::test_codepage
==================== 2 failed, 76 passed in 688.68 seconds ====================
++ 05:00:03 starting module/crypt/test [105 started in total]
__ module/crypt/test [102 done in total, somefailed=False] ____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items / 1 skipped
========================== 1 skipped in 0.03 seconds ==========================
++ 05:00:06 starting module/errno/test [106 started in total]
__ module/errno/test [103 done in total, somefailed=False] ____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module\errno\test\test_errno.py ...
========================= 3 passed in 109.62 seconds ==========================
++ 05:02:04 starting module/exceptions/test [107 started in total]
__ module/cpyext/test/test_version.py [104 done in total, somefailed=False] ___
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items
module\cpyext\test\test_version.py ...
========================= 3 passed in 537.03 seconds ==========================
++ 05:04:51 starting module/faulthandler/test [108 started in total]
__ module/cpyext/test/test_typeobject.py [105 done in total, somefailed=True] _
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 96 items
module\cpyext\test\test_typeobject.py ...................s..........................................FF...........s.....s..............
================================== FAILURES ===================================
___________ AppTestSlots.test_multiple_inheritance_small_basicsize ____________
self = <CallInfo when='call' exception: command 'd:\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\cl.exe' failed with exit status 2>
func = <function <lambda> at 0x000001fe031a0d40>, 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_multiple_inheritance_small_basi...: <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_multiple_inheritance_small_basicsize'>}
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 0x000001fe70ad1440>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x000001fe71d07ca0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_multiple_inheritance_small_basi...: <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_multiple_inheritance_small_basicsize'>}
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 0x000001fe71d07ca0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_multiple_inheritance_small_basi...: <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_multiple_inheritance_small_basicsize'>}
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_multiple_inheritance_small_basicsize'>, '__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 0x000001fe773c1128>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._basicsize'>, '__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 0x000001fe01e9a420>
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 0x000001fe01e9a420>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._basicsize'>, '__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_multiple_inheritance_small_basicsize'>, '__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 0x000001fe773c0c50>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._basicsize'>, '__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 0x000001fe01e9a3e0>
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 0x000001fe01e9a3e0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._basicsize'>, '__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_multiple_inheritance_small_basicsize'>, '__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_multiple_inheritance_small_basicsize'>
def pytest_runtest_call(item):
try:
> item.runtest()
..\_pytest\runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_multiple_inheritance_small_basicsize'>
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_multiple_inheritance_small_basicsize'>
space = StdObjSpace
target = <function test_multiple_inheritance_small_basicsize at 0x000001fe031a0e30>
args = (StdObjSpace, <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001fe774e8e58>)
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 0x000001fe774e8e58>,)
w_func = <Function test_multiple_inheritance_small_basicsize>
args = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001fe774e8e58>
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_multiple_inheritance_small_basicsize>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001fe774e8e58>,)
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_multiple_inheritance_small_basicsize>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001fe774e8e58>,)
gateway = <module 'pypy.interpreter.gateway' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\interpreter\\gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <code object test_multiple_inheritance_small_basicsize, file "[d:\pypy_stuff\b...own-win-x86-64\build\pypy\module\cpyext\test\test_typeobject.py:1714]", 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:131:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1714]", line 1> at line 6
name = 'test_multiple_inheritance_small_basicsize'
qualname = 'test_multiple_inheritance_small_basicsize'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1714]", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1714]", line 1> at line 6
e = CompileError(DistutilsExecError("command 'd:\\\\Microsoft Visual Studio\\\\202...\14.41.34120\\\\bin\\\\HostX64\\\\x64\\\\cl.exe' failed with exit status 2",),)
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1714]", line 1> at line 6
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1714]", line 1> at line 6
pycode = <code object test_multiple_inheritance_small_basicsize, file "[d:\pypy_stuff\b...own-win-x86-64\build\pypy\module\cpyext\test\test_typeobject.py:1714]", line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000001fe78145c20>
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_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1714]", line 1> at line 6
co_code = '|\x00\xa0\x00d\x01d\x02g\x01\xa1\x02}\x01|\x01\xa0\x01\xa1\x00}\x02d\x03t\x02|\x02\x83\x01v\x00s\x13J\x00\x82\x01d\x00S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000001fe78145c20>
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_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1714]", line 1> at line 6
co_code = '|\x00\xa0\x00d\x01d\x02g\x01\xa1\x02}\x01|\x01\xa0\x01\xa1\x00}\x02d\x03t\x02|\x02\x83\x01v\x00s\x13J\x00\x82\x01d\x00S\x00'
next_instr = 12L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000001fe78145c20>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1714]", line 1> at line 6
oparg = 2, ignored = (12L,), n_args = 2, w_self = None, n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode import_extension>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1714]", line 1> at line 6
dropvalues = 4, 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 = <FunctionWithFixedCode import_extension>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1714]", line 1> at line 6
dropvalues = 4, 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)
elif fast_natural_arity == Code.PASSTHROUGHARGS1 and nargs >= 1:
assert isinstance(code, gateway.BuiltinCodePassThroughArguments1)
w_obj = frame.peekvalue(nargs-1)
args = frame.make_arguments(nargs-1, w_function=self)
frame.dropvalues(dropvalues)
return code.funcrun_obj(self, w_obj, args)
args = frame.make_arguments(nargs, methodcall=methodcall, w_function=self)
frame.dropvalues(dropvalues)
> return self.call_args(args)
interpreter\function.py:203:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode import_extension>
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject.... PyObject_New(PyObject, B12);\n return obj;\n '))])])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000001fe03778640>
func = <FunctionWithFixedCode import_extension>
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject.... PyObject_New(PyObject, B12);\n return obj;\n '))])])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000001fe03778640>
func = <FunctionWithFixedCode import_extension>, w_obj = None
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject.... PyObject_New(PyObject, B12);\n return obj;\n '))])])
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 0x000001fe03778640>
space = StdObjSpace
e = CompileError(DistutilsExecError("command 'd:\\\\Microsoft Visual Studio\\\\202...\14.41.34120\\\\bin\\\\HostX64\\\\x64\\\\cl.exe' failed with exit status 2",),)
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 0x000001fe03778640>
func = <FunctionWithFixedCode import_extension>, w_obj = None
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject.... PyObject_New(PyObject, B12);\n return obj;\n '))])])
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_W_Root_text_W_Root_text_bool object at 0x000001fe037787c8>
space = StdObjSpace
scope_w = [W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x0000... = PyObject_...;\n return obj;\n '))]), W_UnicodeObject(''), None, W_UnicodeObject(''), W_BoolObject(False)]
def _run(self, space, scope_w):
> return self.behavior(space, space.text_w(scope_w[0]), scope_w[1], space.text_w(scope_w[2]), scope_w[3], space.text_w(scope_w[4]), space.is_true(scope_w[5]))
<3291-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, modname = 'foo'
w_functions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x0000... = PyObject_New(PyObject, B12);\n return obj;\n '))])
prologue = '', w_include_dirs = None, more_init = '', PY_SSIZE_T_CLEAN = False
@unwrap_spec(modname='text', prologue='text',
more_init='text', PY_SSIZE_T_CLEAN=bool)
def import_extension(space, modname, w_functions, prologue="",
w_include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
functions = space.unwrap(w_functions)
include_dirs = _unwrap_include_dirs(space, w_include_dirs)
# If there's already a module under this name (file-based or a
# previous inline extension), save it in _module_keepalive before
# it's displaced. This prevents its raw allocations (method-name
# strings, type dicts, etc.) from being freed during a later
# test's leakfinder tracking window.
self._file_module_cache.pop(modname, None)
w_modules = space.sys.get('modules')
try:
w_old = space.getitem(w_modules, space.newtext(modname))
self._module_keepalive.append(w_old)
except OperationError:
pass
w_result = self.sys_info.import_extension(
modname, functions, prologue, include_dirs, more_init,
> PY_SSIZE_T_CLEAN)
module\cpyext\test\test_cpyext.py:415:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.cpyext.test.test_cpyext.SpaceCompiler object at 0x000001fe7748cd78>
modname = 'foo'
functions = [(u'new_obj', u'METH_NOARGS', u'\n /* Simulate pybind11: instance struct is PyObject_HEAD + one ptr,\n ...urn NULL;\n\n PyObject *obj = PyObject_New(PyObject, B12);\n return obj;\n ')]
prologue = '', include_dirs = None, more_init = '', PY_SSIZE_T_CLEAN = False
def import_extension(self, modname, functions, prologue="",
include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
body = prologue + make_methods(functions, modname)
init = """PyObject *mod = PyModule_Create(&moduledef);
"""
if more_init:
init += """#define INITERROR return NULL
"""
init += more_init
init += "\nreturn mod;"
return self.import_module(
name=modname, init=init, body=body, include_dirs=include_dirs,
> PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
tool\cpyext\extbuild.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.cpyext.test.test_cpyext.SpaceCompiler object at 0x000001fe7748cd78>
name = 'foo'
init = 'PyObject *mod = PyModule_Create(&moduledef);\n \nreturn mod;'
body = u'\n static PyObject* foo_new_obj(PyObject *self, PyObject *args)\n {\n \n /* Simu...LL, /* m_doc */\n -1, /* m_size */\n methods, /* m_methods */\n };\n '
filename = None, 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 0x000001fe7748cd78>
name = 'foo', include_dirs = []
source_files = [local('d:\\systemtemp\\pytest\\usession-py3.11-389\\foo-27\\source_0.c')]
source_strings = [u'\n \n #include <Python.h>\n\n \n static PyObject* foo_new_obj(PyObject *self, PyObject *args)\n ...\n PyInit_foo(void) {\n PyObject *mod = PyModule_Create(&moduledef);\n \nreturn mod;\n }\n ']
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('d:\\systemtemp\\pytest\\usession-py3.11-389\\foo-27\\source_0.c')]
outputfilename = local('d:\\systemtemp\\pytest\\usession-py3.11-389\\foo-27\\foo.dll')
compile_extra = ['/we4013', '/c', '/nologo', '/Ox', '/W3', '/GL', ...]
link_extra = ['/NODEFAULTLIB:Python311.lib', '/DEBUG']
include_dirs = [local('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\cpyext\\PC'), local('d:\\systemtemp\\p...py\\module\\cpyext\\parse'), local('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\translator\\c')]
libraries = ['d:\\systemtemp\\pytest\\usession-py3.11-389\\module_cache\\pypyapi']
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('d:\\systemtemp\\pytest\\usession-py3.11-389\\foo-27\\source_0.c')]
outputfilename = local('d:\\systemtemp\\pytest\\usession-py3.11-389\\foo-27\\foo.dll')
compile_extra = ['/we4013', '/c', '/nologo', '/Ox', '/W3', '/GL', ...]
link_extra = ['/NODEFAULTLIB:Python311.lib', '/DEBUG']
include_dirs = [local('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\cpyext\\PC'), local('d:\\systemtemp\\p...py\\module\\cpyext\\parse'), local('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\translator\\c')]
libraries = ['d:\\systemtemp\\pytest\\usession-py3.11-389\\module_cache\\pypyapi']
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._msvccompiler.MSVCCompiler instance at 0x000001fe02177660>
sources = ['source_0.c'], output_dir = None, macros = []
include_dirs = [local('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\cpyext\\PC'), local('d:\\systemtemp\\p...py\\module\\cpyext\\parse'), local('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\translator\\c')]
debug = 0
extra_preargs = ['/we4013', '/c', '/nologo', '/Ox', '/W3', '/GL', ...]
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):
if not self.initialized:
self.initialize()
compile_info = self._setup_compile(output_dir, macros, include_dirs,
sources, depends, extra_postargs)
macros, objects, extra_postargs, pp_opts, build = compile_info
compile_opts = extra_preargs or []
compile_opts.append('/c')
if debug:
compile_opts.extend(self.compile_options_debug)
else:
compile_opts.extend(self.compile_options)
add_cpp_opts = False
for obj in objects:
try:
src, ext = build[obj]
except KeyError:
continue
if debug:
# pass the full pathname to MSVC in debug mode,
# this allows the debugger to find the source file
# without asking the user to browse for it
src = os.path.abspath(src)
if ext in self._c_extensions:
input_opt = "/Tc" + src
elif ext in self._cpp_extensions:
input_opt = "/Tp" + src
add_cpp_opts = True
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts + [output_opt, input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc, '-h', h_dir, '-r', rc_dir, src])
base, _ = os.path.splitext(os.path.basename (src))
rc_file = os.path.join(rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc, "/fo" + obj, rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile {} to {}"
.format(src, obj))
args = [self.cc] + compile_opts + pp_opts
if add_cpp_opts:
args.append('/EHsc')
args.append(input_opt)
args.append("/Fo" + obj)
args.extend(extra_postargs)
try:
self.spawn(args)
except DistutilsExecError as msg:
> raise CompileError(msg)
E CompileError: command 'd:\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\cl.exe' failed with exit status 2
d:\pypy_stuff\pypy2.7-v7.3.18\lib-python\2.7\distutils\_msvccompiler.py:403: CompileError
---------------------------- Captured stdout call -----------------------------
source_0.c
source_0.c(11): error C2059: syntax error: ';'
source_0.c(15): error C2040: 'B1': 'int' differs in levels of indirection from 'PyTypeObject *'
source_0.c(16): error C2040: 'B2': 'int' differs in levels of indirection from 'PyTypeObject *'
source_0.c(17): error C2040: 'B12': 'int' differs in levels of indirection from 'PyTypeObject *'
source_0.c(19): error C2099: initializer is not a constant
source_0.c(20): error C2099: initializer is not a constant
source_0.c(21): error C2099: initializer is not a constant
source_0.c(23): error C2143: syntax error: missing '{' before '->'
source_0.c(23): error C2059: syntax error: '->'
source_0.c(24): error C2143: syntax error: missing '{' before '->'
source_0.c(24): error C2059: syntax error: '->'
source_0.c(25): error C2143: syntax error: missing '{' before '->'
source_0.c(25): error C2059: syntax error: '->'
source_0.c(27): error C2143: syntax error: missing '{' before '->'
source_0.c(27): error C2059: syntax error: '->'
source_0.c(28): error C2143: syntax error: missing '{' before '->'
source_0.c(28): error C2059: syntax error: '->'
source_0.c(29): error C2143: syntax error: missing '{' before '->'
source_0.c(29): error C2059: syntax error: '->'
source_0.c(31): error C2059: syntax error: '<parameter-list>'
source_0.c(32): error C2059: syntax error: '<parameter-list>'
source_0.c(33): error C2059: syntax error: '<parameter-list>'
source_0.c(34): error C2059: syntax error: '<parameter-list>'
source_0.c(35): error C2059: syntax error: '<parameter-list>'
source_0.c(36): error C2059: syntax error: '<parameter-list>'
source_0.c(38): error C2143: syntax error: missing '{' before '->'
source_0.c(38): error C2059: syntax error: '->'
source_0.c(39): error C2143: syntax error: missing '{' before '->'
source_0.c(39): error C2059: syntax error: '->'
source_0.c(40): error C2143: syntax error: missing '{' before '->'
source_0.c(40): error C2059: syntax error: '->'
source_0.c(42): error C2143: syntax error: missing '{' before '->'
source_0.c(42): error C2059: syntax error: '->'
source_0.c(43): error C2143: syntax error: missing '{' before '->'
source_0.c(43): error C2059: syntax error: '->'
source_0.c(45): error C2059: syntax error: 'if'
source_0.c(46): error C2059: syntax error: 'if'
source_0.c(47): error C2059: syntax error: 'if'
source_0.c(49): error C2099: initializer is not a constant
source_0.c(50): error C2059: syntax error: 'return'
source_0.c(52): error C2059: syntax error: '}'
source_0.c(63): error C2065: 'methods': undeclared identifier
source_0.c(58): error C2099: initializer is not a constant
___ AppTestSlots.test_multiple_inheritance_python_subclass_of_two_cpytypes ____
self = <CallInfo when='call' exception: command 'd:\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\cl.exe' failed with exit status 2>
func = <function <lambda> at 0x000001fe7c0c6980>, 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_multiple_inheritance_python_sub...results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_multiple_inheritance_python_subclass_of_two_cpytypes'>}
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 0x000001fe70ad1440>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x000001fe71d07ca0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_multiple_inheritance_python_sub...results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_multiple_inheritance_python_subclass_of_two_cpytypes'>}
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 0x000001fe71d07ca0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_multiple_inheritance_python_sub...results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_multiple_inheritance_python_subclass_of_two_cpytypes'>}
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_multiple_inheritance_python_subclass_of_two_cpytypes'>, '__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 0x000001fe75a92890>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...o_cpytypes'>, '__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 0x000001fe009ad220>
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 0x000001fe009ad220>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...o_cpytypes'>, '__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_multiple_inheritance_python_subclass_of_two_cpytypes'>, '__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 0x000001fe75a92390>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...o_cpytypes'>, '__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 0x000001fe009acce0>
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 0x000001fe009acce0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...o_cpytypes'>, '__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_multiple_inheritance_python_subclass_of_two_cpytypes'>, '__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_multiple_inheritance_python_subclass_of_two_cpytypes'>
def pytest_runtest_call(item):
try:
> item.runtest()
..\_pytest\runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_multiple_inheritance_python_subclass_of_two_cpytypes'>
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_multiple_inheritance_python_subclass_of_two_cpytypes'>
space = StdObjSpace
target = <function test_multiple_inheritance_python_subclass_of_two_cpytypes at 0x000001fe024b87a0>
args = (StdObjSpace, <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001fe774e8e58>)
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 0x000001fe774e8e58>,)
w_func = <Function test_multiple_inheritance_python_subclass_of_two_cpytypes>
args = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001fe774e8e58>
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_multiple_inheritance_python_subclass_of_two_cpytypes>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001fe774e8e58>,)
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_multiple_inheritance_python_subclass_of_two_cpytypes>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001fe774e8e58>,)
gateway = <module 'pypy.interpreter.gateway' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\interpreter\\gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <code object test_multiple_inheritance_python_subclass_of_two_cpytypes, file "...own-win-x86-64\build\pypy\module\cpyext\test\test_typeobject.py:1770]", 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:131:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1770]", line 1> at line 8
name = 'test_multiple_inheritance_python_subclass_of_two_cpytypes'
qualname = 'test_multiple_inheritance_python_subclass_of_two_cpytypes'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1770]", line 1> at line 8
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
executioncontext)
except OperationError:
raise
except Exception as e: # general fall-back
> raise self._convert_unexpected_exception(e)
interpreter\pyframe.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1770]", line 1> at line 8
e = CompileError(DistutilsExecError("command 'd:\\\\Microsoft Visual Studio\\\\202...\14.41.34120\\\\bin\\\\HostX64\\\\x64\\\\cl.exe' failed with exit status 2",),)
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1770]", line 1> at line 8
w_arg_or_err = None
def execute_frame(self, w_arg_or_err=None):
"""Execute this frame. Main entry point to the interpreter.
'w_arg_or_err' is non-None iff we are starting or resuming
a generator or coroutine frame; in that case, w_arg_or_err
is the input argument -or- an SApplicationException instance.
"""
from pypy.interpreter import pyopcode as pyopcode
# the following 'assert' is an annotation hint: it hides from
# the annotator all methods that are defined in PyFrame but
# overridden in the {,Host}FrameClass subclasses of PyFrame.
assert (isinstance(self, self.space.FrameClass) or
not self.space.config.translating)
executioncontext = self.space.getexecutioncontext()
executioncontext.enter(self)
got_exception = True
w_exitvalue = self.space.w_None
try:
executioncontext.call_trace(self)
#
# Execution starts just after the last_instr. Initially,
# last_instr is -1. After a generator suspends it points to
# the YIELD_VALUE/YIELD_FROM instruction.
try:
try:
if w_arg_or_err is None:
assert self.last_instr == -1
next_instr = r_uint(0)
else:
next_instr = self.resume_execute_frame(w_arg_or_err)
except pyopcode.Yield:
w_exitvalue = self.popvalue()
else:
w_exitvalue = self.dispatch(self.pycode, next_instr,
> executioncontext)
interpreter\pyframe.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1770]", line 1> at line 8
pycode = <code object test_multiple_inheritance_python_subclass_of_two_cpytypes, file "...own-win-x86-64\build\pypy\module\cpyext\test\test_typeobject.py:1770]", line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000001fe78145c20>
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_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1770]", line 1> at line 8
co_code = '|\x00\xa0\x00d\x01d\x02g\x01\xa1\x02}\x01|\x01\xa0\x01\xa1\x00\\\x02}\x02}\x03G\x00d\x03\x84\x00d\x04|\x02|\x03\x83\x04}\x04|\x04\x83\x00}\x05t\x02|\x05|\x02\x83\x02s\x1fJ\x00\x82\x01t\x02|\x05|\x03\x83\x02s&J\x00\x82\x01d\x00S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000001fe78145c20>
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_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1770]", line 1> at line 8
co_code = '|\x00\xa0\x00d\x01d\x02g\x01\xa1\x02}\x01|\x01\xa0\x01\xa1\x00\\\x02}\x02}\x03G\x00d\x03\x84\x00d\x04|\x02|\x03\x83\x04}\x04|\x04\x83\x00}\x05t\x02|\x05|\x02\x83\x02s\x1fJ\x00\x82\x01t\x02|\x05|\x03\x83\x02s&J\x00\x82\x01d\x00S\x00'
next_instr = 12L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x000001fe78145c20>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1770]", line 1> at line 8
oparg = 2, ignored = (12L,), n_args = 2, w_self = None, n = 2
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <FunctionWithFixedCode import_extension>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1770]", line 1> at line 8
dropvalues = 4, 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 = <FunctionWithFixedCode import_extension>, nargs = 2
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_multiple...6-64\build\pypy\module\cpyext\test\test_typeobject.py:1770]", line 1> at line 8
dropvalues = 4, 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)
elif fast_natural_arity == Code.PASSTHROUGHARGS1 and nargs >= 1:
assert isinstance(code, gateway.BuiltinCodePassThroughArguments1)
w_obj = frame.peekvalue(nargs-1)
args = frame.make_arguments(nargs-1, w_function=self)
frame.dropvalues(dropvalues)
return code.funcrun_obj(self, w_obj, args)
args = frame.make_arguments(nargs, methodcall=methodcall, w_function=self)
frame.dropvalues(dropvalues)
> return self.call_args(args)
interpreter\function.py:203:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <FunctionWithFixedCode import_extension>
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject....n NULL;\n\n return PyTuple_Pack(2, B1, B2);\n '))])])
def call_args(self, args):
# delegate activation to code
> w_res = self.getcode().funcrun(self, args)
interpreter\function.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000001fe03691130>
func = <FunctionWithFixedCode import_extension>
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject....n NULL;\n\n return PyTuple_Pack(2, B1, B2);\n '))])])
def funcrun(self, func, args):
> return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter\gateway.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode object at 0x000001fe03691130>
func = <FunctionWithFixedCode import_extension>, w_obj = None
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject....n NULL;\n\n return PyTuple_Pack(2, B1, B2);\n '))])])
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 0x000001fe03691130>
space = StdObjSpace
e = CompileError(DistutilsExecError("command 'd:\\\\Microsoft Visual Studio\\\\202...\14.41.34120\\\\bin\\\\HostX64\\\\x64\\\\cl.exe' failed with exit status 2",),)
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 0x000001fe03691130>
func = <FunctionWithFixedCode import_extension>, w_obj = None
args = Arguments([W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject....n NULL;\n\n return PyTuple_Pack(2, B1, B2);\n '))])])
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_W_Root_text_W_Root_text_bool object at 0x000001fe03691210>
space = StdObjSpace
scope_w = [W_UnicodeObject('foo'), W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x0000...urn NULL;\n\...eturn PyTuple_Pack(2, B1, B2);\n '))]), W_UnicodeObject(''), None, W_UnicodeObject(''), W_BoolObject(False)]
def _run(self, space, scope_w):
> return self.behavior(space, space.text_w(scope_w[0]), scope_w[1], space.text_w(scope_w[2]), scope_w[3], space.text_w(scope_w[4]), space.is_true(scope_w[5]))
<3291-codegen d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\tool\sourcetools.py:200>:3:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, modname = 'foo'
w_functions = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x0000...urn NULL;\n\n return PyTuple_Pack(2, B1, B2);\n '))])
prologue = '', w_include_dirs = None, more_init = '', PY_SSIZE_T_CLEAN = False
@unwrap_spec(modname='text', prologue='text',
more_init='text', PY_SSIZE_T_CLEAN=bool)
def import_extension(space, modname, w_functions, prologue="",
w_include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
functions = space.unwrap(w_functions)
include_dirs = _unwrap_include_dirs(space, w_include_dirs)
# If there's already a module under this name (file-based or a
# previous inline extension), save it in _module_keepalive before
# it's displaced. This prevents its raw allocations (method-name
# strings, type dicts, etc.) from being freed during a later
# test's leakfinder tracking window.
self._file_module_cache.pop(modname, None)
w_modules = space.sys.get('modules')
try:
w_old = space.getitem(w_modules, space.newtext(modname))
self._module_keepalive.append(w_old)
except OperationError:
pass
w_result = self.sys_info.import_extension(
modname, functions, prologue, include_dirs, more_init,
> PY_SSIZE_T_CLEAN)
module\cpyext\test\test_cpyext.py:415:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.cpyext.test.test_cpyext.SpaceCompiler object at 0x000001fe7748cd78>
modname = 'foo'
functions = [(u'get_bases', u'METH_NOARGS', u'\n /* Simulate two independent pybind11-style types: both have the\n ... if (PyType_Ready(B2) < 0) return NULL;\n\n return PyTuple_Pack(2, B1, B2);\n ')]
prologue = '', include_dirs = None, more_init = '', PY_SSIZE_T_CLEAN = False
def import_extension(self, modname, functions, prologue="",
include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
body = prologue + make_methods(functions, modname)
init = """PyObject *mod = PyModule_Create(&moduledef);
"""
if more_init:
init += """#define INITERROR return NULL
"""
init += more_init
init += "\nreturn mod;"
return self.import_module(
name=modname, init=init, body=body, include_dirs=include_dirs,
> PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
tool\cpyext\extbuild.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.cpyext.test.test_cpyext.SpaceCompiler object at 0x000001fe7748cd78>
name = 'foo'
init = 'PyObject *mod = PyModule_Create(&moduledef);\n \nreturn mod;'
body = u'\n static PyObject* foo_get_bases(PyObject *self, PyObject *args)\n {\n \n /* Si...LL, /* m_doc */\n -1, /* m_size */\n methods, /* m_methods */\n };\n '
filename = None, 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 0x000001fe7748cd78>
name = 'foo', include_dirs = []
source_files = [local('d:\\systemtemp\\pytest\\usession-py3.11-389\\foo-28\\source_0.c')]
source_strings = [u'\n \n #include <Python.h>\n\n \n static PyObject* foo_get_bases(PyObject *self, PyObject *args)\n ...\n PyInit_foo(void) {\n PyObject *mod = PyModule_Create(&moduledef);\n \nreturn mod;\n }\n ']
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('d:\\systemtemp\\pytest\\usession-py3.11-389\\foo-28\\source_0.c')]
outputfilename = local('d:\\systemtemp\\pytest\\usession-py3.11-389\\foo-28\\foo.dll')
compile_extra = ['/we4013', '/c', '/nologo', '/Ox', '/W3', '/GL', ...]
link_extra = ['/NODEFAULTLIB:Python311.lib', '/DEBUG']
include_dirs = [local('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\cpyext\\PC'), local('d:\\systemtemp\\p...py\\module\\cpyext\\parse'), local('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\translator\\c')]
libraries = ['d:\\systemtemp\\pytest\\usession-py3.11-389\\module_cache\\pypyapi']
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('d:\\systemtemp\\pytest\\usession-py3.11-389\\foo-28\\source_0.c')]
outputfilename = local('d:\\systemtemp\\pytest\\usession-py3.11-389\\foo-28\\foo.dll')
compile_extra = ['/we4013', '/c', '/nologo', '/Ox', '/W3', '/GL', ...]
link_extra = ['/NODEFAULTLIB:Python311.lib', '/DEBUG']
include_dirs = [local('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\cpyext\\PC'), local('d:\\systemtemp\\p...py\\module\\cpyext\\parse'), local('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\translator\\c')]
libraries = ['d:\\systemtemp\\pytest\\usession-py3.11-389\\module_cache\\pypyapi']
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._msvccompiler.MSVCCompiler instance at 0x000001fe7e1efce0>
sources = ['source_0.c'], output_dir = None, macros = []
include_dirs = [local('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\module\\cpyext\\PC'), local('d:\\systemtemp\\p...py\\module\\cpyext\\parse'), local('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\translator\\c')]
debug = 0
extra_preargs = ['/we4013', '/c', '/nologo', '/Ox', '/W3', '/GL', ...]
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):
if not self.initialized:
self.initialize()
compile_info = self._setup_compile(output_dir, macros, include_dirs,
sources, depends, extra_postargs)
macros, objects, extra_postargs, pp_opts, build = compile_info
compile_opts = extra_preargs or []
compile_opts.append('/c')
if debug:
compile_opts.extend(self.compile_options_debug)
else:
compile_opts.extend(self.compile_options)
add_cpp_opts = False
for obj in objects:
try:
src, ext = build[obj]
except KeyError:
continue
if debug:
# pass the full pathname to MSVC in debug mode,
# this allows the debugger to find the source file
# without asking the user to browse for it
src = os.path.abspath(src)
if ext in self._c_extensions:
input_opt = "/Tc" + src
elif ext in self._cpp_extensions:
input_opt = "/Tp" + src
add_cpp_opts = True
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts + [output_opt, input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc, '-h', h_dir, '-r', rc_dir, src])
base, _ = os.path.splitext(os.path.basename (src))
rc_file = os.path.join(rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc, "/fo" + obj, rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile {} to {}"
.format(src, obj))
args = [self.cc] + compile_opts + pp_opts
if add_cpp_opts:
args.append('/EHsc')
args.append(input_opt)
args.append("/Fo" + obj)
args.extend(extra_postargs)
try:
self.spawn(args)
except DistutilsExecError as msg:
> raise CompileError(msg)
E CompileError: command 'd:\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\cl.exe' failed with exit status 2
d:\pypy_stuff\pypy2.7-v7.3.18\lib-python\2.7\distutils\_msvccompiler.py:403: CompileError
---------------------------- Captured stdout call -----------------------------
source_0.c
source_0.c(12): error C2059: syntax error: ';'
source_0.c(17): error C2040: 'ObjBase': 'int' differs in levels of indirection from 'PyTypeObject *'
source_0.c(18): error C2099: initializer is not a constant
source_0.c(19): error C2143: syntax error: missing '{' before '->'
source_0.c(19): error C2059: syntax error: '->'
source_0.c(20): error C2143: syntax error: missing '{' before '->'
source_0.c(20): error C2059: syntax error: '->'
source_0.c(21): error C2059: syntax error: '<parameter-list>'
source_0.c(22): error C2059: syntax error: '<parameter-list>'
source_0.c(23): error C2143: syntax error: missing '{' before '->'
source_0.c(23): error C2059: syntax error: '->'
source_0.c(24): error C2059: syntax error: 'if'
source_0.c(27): error C2040: 'B1': 'int' differs in levels of indirection from 'PyTypeObject *'
source_0.c(28): error C2040: 'B2': 'int' differs in levels of indirection from 'PyTypeObject *'
source_0.c(30): error C2099: initializer is not a constant
source_0.c(31): error C2099: initializer is not a constant
source_0.c(32): error C2143: syntax error: missing '{' before '->'
source_0.c(32): error C2059: syntax error: '->'
source_0.c(33): error C2143: syntax error: missing '{' before '->'
source_0.c(33): error C2059: syntax error: '->'
source_0.c(34): error C2143: syntax error: missing '{' before '->'
source_0.c(34): error C2059: syntax error: '->'
source_0.c(35): error C2143: syntax error: missing '{' before '->'
source_0.c(35): error C2059: syntax error: '->'
source_0.c(36): error C2059: syntax error: '<parameter-list>'
source_0.c(37): error C2059: syntax error: '<parameter-list>'
source_0.c(38): error C2059: syntax error: '<parameter-list>'
source_0.c(39): error C2059: syntax error: '<parameter-list>'
source_0.c(40): error C2143: syntax error: missing '{' before '->'
source_0.c(40): error C2059: syntax error: '->'
source_0.c(40): error C2143: syntax error: missing ')' before '('
source_0.c(40): error C2091: function returns function
source_0.c(40): error C2059: syntax error: ')'
source_0.c(40): error C2143: syntax error: missing ')' before ';'
source_0.c(40): error C2373: 'Py_INCREF': redefinition; different type modifiers
d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\cpyext\include\object.h(499): note: see declaration of 'Py_INCREF'
source_0.c(41): error C2143: syntax error: missing '{' before '->'
source_0.c(41): error C2059: syntax error: '->'
source_0.c(41): error C2143: syntax error: missing ')' before '('
source_0.c(41): error C2091: function returns function
source_0.c(41): error C2059: syntax error: ')'
source_0.c(41): error C2143: syntax error: missing ')' before ';'
source_0.c(41): error C2373: 'Py_INCREF': redefinition; different type modifiers
d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\cpyext\include\object.h(499): note: see declaration of 'Py_INCREF'
source_0.c(42): error C2143: syntax error: missing '{' before '->'
source_0.c(42): error C2059: syntax error: '->'
source_0.c(43): error C2143: syntax error: missing '{' before '->'
source_0.c(43): error C2059: syntax error: '->'
source_0.c(44): error C2059: syntax error: 'if'
source_0.c(45): error C2059: syntax error: 'if'
source_0.c(47): error C2059: syntax error: 'return'
source_0.c(49): error C2059: syntax error: '}'
source_0.c(60): error C2065: 'methods': undeclared identifier
source_0.c(55): error C2099: initializer is not a constant
=========================== short test summary info ===========================
FAIL module\cpyext\test\test_typeobject.py::AppTestSlots::()::test_multiple_inheritance_small_basicsize
FAIL module\cpyext\test\test_typeobject.py::AppTestSlots::()::test_multiple_inheritance_python_subclass_of_two_cpytypes
============== 2 failed, 91 passed, 3 skipped in 998.46 seconds ===============
++ 05:05:00 starting module/fcntl/test [109 started in total]
__ module/fcntl/test [106 done in total, somefailed=False] ____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items / 1 skipped
========================== 1 skipped in 2.94 seconds ==========================
++ 05:05:05 starting module/gc/test [110 started in total]
__ module/exceptions/test [107 done in total, somefailed=False] _______________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 101 items
module\exceptions\test\apptest_exceptions.py .....................................................
module\exceptions\test\test_exc.py ................................................
======================== 101 passed in 186.21 seconds =========================
++ 05:05:16 starting module/imp/test [111 started in total]
__ module/faulthandler/test [108 done in total, somefailed=False] _____________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 1 items / 1 skipped
module\faulthandler\test\test_ztranslation.py .
==================== 1 passed, 1 skipped in 28.74 seconds =====================
++ 05:05:25 starting module/itertools/test [112 started in total]
__ module/cpyext/test/test_weakref.py [109 done in total, somefailed=False] ___
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 5 items
module\cpyext\test\test_weakref.py .....
========================= 5 passed in 404.64 seconds ==========================
++ 05:06:08 starting module/marshal/test [113 started in total]
__ module/gc/test [110 done in total, somefailed=True] ________________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 ...F....
module\gc\test\test_ztranslation.py .
================================== FAILURES ===================================
_________________ AppTestReferents.test_get_rpy_memory_usage __________________
self = <CallInfo when='call' exception: type object 'W_IntObject' has no attribute '__basicsize__'>
func = <function <lambda> at 0x0000019f2e0f4bd8>, 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_get_rpy_memory_usage'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_get_rpy_memory_usage'>}
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 0x0000019f25511440>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000019f26dd6c20>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_get_rpy_memory_usage'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_get_rpy_memory_usage'>}
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 0x0000019f26dd6c20>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_get_rpy_memory_usage'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_get_rpy_memory_usage'>}
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_get_rpy_memory_usage'>, '__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 0x0000019f2e2686d8>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...mory_usage'>, '__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 0x0000019f2d2d2e20>
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 0x0000019f2d2d2e20>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...mory_usage'>, '__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_get_rpy_memory_usage'>, '__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 0x0000019f2e268160>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...mory_usage'>, '__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 0x0000019f2d2d2de0>
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 0x0000019f2d2d2de0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...mory_usage'>, '__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_get_rpy_memory_usage'>, '__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_get_rpy_memory_usage'>
def pytest_runtest_call(item):
try:
> item.runtest()
..\_pytest\runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_get_rpy_memory_usage'>
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_get_rpy_memory_usage'>, space = StdObjSpace
target = <function test_get_rpy_memory_usage at 0x0000019f2e0f4cc8>
args = (StdObjSpace, <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000019f31745248>)
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 0x0000019f31745248>,)
w_func = <Function test_get_rpy_memory_usage>
args = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000019f31745248>
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_get_rpy_memory_usage>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000019f31745248>,)
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_get_rpy_memory_usage>
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000019f31745248>,)
gateway = <module 'pypy.interpreter.gateway' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\interpreter\\gateway.pyc'>
PyCode = <class 'pypy.interpreter.pycode.PyCode'>
code = <code object test_get_rpy_memory_usage, file "[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\gc\test\test_referents.py:79]", 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:131:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_get_rpy_...-win-x86-64\build\pypy\module\gc\test\test_referents.py:79]", line 1> at line 3
name = 'test_get_rpy_memory_usage', qualname = 'test_get_rpy_memory_usage'
def run(self, name=None, qualname=None):
"""Start this frame's execution."""
if self._is_generator_or_coroutine():
return self.initialize_as_generator(name, qualname)
else:
> return self.execute_frame()
interpreter\pyframe.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_get_rpy_...-win-x86-64\build\pypy\module\gc\test\test_referents.py:79]", 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:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_get_rpy_...-win-x86-64\build\pypy\module\gc\test\test_referents.py:79]", line 1> at line 3
e = AttributeError("type object 'W_IntObject' has no attribute '__basicsize__'",)
def _convert_unexpected_exception(self, e):
from pypy.interpreter import error
> operr = error.get_converted_unexpected_exception(self.space, e)
interpreter\pyframe.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_get_rpy_...-win-x86-64\build\pypy\module\gc\test\test_referents.py:79]", 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:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_get_rpy_...-win-x86-64\build\pypy\module\gc\test\test_referents.py:79]", line 1> at line 3
pycode = <code object test_get_rpy_memory_usage, file "[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\gc\test\test_referents.py:79]", line 1>
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x0000019f2db7cd40>
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_get_rpy_...-win-x86-64\build\pypy\module\gc\test\test_referents.py:79]", line 1> at line 3
co_code = 'd\x01d\x00l\x00}\x01|\x01\xa0\x01d\x02\xa1\x01}\x02t\x02|\x02\x83\x01\x01\x00d\x03|\x02\x04\x00\x03\x00k\x01o\x16d\x04k\x01n\x02\x02\x00\x01\x00s\x1bJ\x00\x82\x01d\x00S\x00'
next_instr = 0L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x0000019f2db7cd40>
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_get_rpy_...-win-x86-64\build\pypy\module\gc\test\test_referents.py:79]", line 1> at line 3
co_code = 'd\x01d\x00l\x00}\x01|\x01\xa0\x01d\x02\xa1\x01}\x02t\x02|\x02\x83\x01\x01\x00d\x03|\x02\x04\x00\x03\x00k\x01o\x16d\x04k\x01n\x02\x02\x00\x01\x00s\x1bJ\x00\x82\x01d\x00S\x00'
next_instr = 16L
ec = <pypy.interpreter.executioncontext.ExecutionContext object at 0x0000019f2db7cd40>
@jit.unroll_safe
def dispatch_bytecode(self, co_code, next_instr, ec):
while True:
assert next_instr & 1 == 0
self.last_instr = intmask(next_instr)
if jit.we_are_jitted():
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
else:
# Only reload next_instr from last_instr when something that
# can modify it actually ran (trace function or action
# dispatcher). In the common case (no trace, positive ticker)
# next_instr is unchanged and the round-trip is skipped.
_d = self.debugdata
if ec.space.reverse_debugging or (
_d is not None and _d.w_f_trace is not None) or (
not we_are_translated() and
'bytecode_only_trace' in ec.__dict__):
ec.bytecode_only_trace(self)
next_instr = r_uint(self.last_instr)
actionflag = ec.space.actionflag
if actionflag.decrement_ticker(TICK_COUNTER_STEP) < 0:
actionflag.action_dispatcher(ec, self)
next_instr = r_uint(self.last_instr)
opcode = ord(co_code[next_instr])
oparg = ord(co_code[next_instr + 1])
next_instr += 2
# note: the structure of the code here is such that it makes
# (after translation) a big "if/elif" chain, which is then
# turned into computed gotos.
while opcode == opcodedesc.EXTENDED_ARG.index:
opcode = ord(co_code[next_instr])
arg = ord(co_code[next_instr + 1])
if opcode < HAVE_ARGUMENT:
raise BytecodeCorruption
next_instr += 2
oparg = (oparg * 256) | arg
if opcode == opcodedesc.RETURN_VALUE.index:
self.frame_finished_execution = True # for generators
raise Return
elif opcode == opcodedesc.JUMP_ABSOLUTE.index:
return self.jump_absolute(oparg, next_instr, ec)
elif opcode == opcodedesc.RERAISE.index:
return self.RERAISE(oparg, next_instr)
elif opcode == opcodedesc.FOR_ITER.index:
next_instr = self.FOR_ITER(oparg, next_instr)
elif opcode == opcodedesc.JUMP_FORWARD.index:
next_instr = self.JUMP_FORWARD(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index:
return self.JUMP_IF_FALSE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index:
return self.JUMP_IF_TRUE_OR_POP(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index:
return self.POP_JUMP_IF_FALSE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index:
return self.POP_JUMP_IF_TRUE(oparg, next_instr, ec)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NONE(oparg, next_instr)
elif opcode == opcodedesc.POP_JUMP_FORWARD_IF_NOT_NONE.index:
next_instr = self.POP_JUMP_FORWARD_IF_NOT_NONE(oparg, next_instr)
elif opcode == opcodedesc.JUMP_IF_NOT_EXC_MATCH.index:
next_instr = self.JUMP_IF_NOT_EXC_MATCH(oparg, next_instr)
elif opcode == opcodedesc.BINARY_ADD.index:
self.BINARY_ADD(oparg, next_instr)
elif opcode == opcodedesc.BINARY_AND.index:
self.BINARY_AND(oparg, next_instr)
elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index:
self.BINARY_FLOOR_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MATRIX_MULTIPLY.index:
self.BINARY_MATRIX_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_LSHIFT.index:
self.BINARY_LSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MODULO.index:
self.BINARY_MODULO(oparg, next_instr)
elif opcode == opcodedesc.BINARY_MULTIPLY.index:
self.BINARY_MULTIPLY(oparg, next_instr)
elif opcode == opcodedesc.BINARY_OR.index:
self.BINARY_OR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_POWER.index:
self.BINARY_POWER(oparg, next_instr)
elif opcode == opcodedesc.BINARY_RSHIFT.index:
self.BINARY_RSHIFT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBSCR.index:
self.BINARY_SUBSCR(oparg, next_instr)
elif opcode == opcodedesc.BINARY_SUBTRACT.index:
self.BINARY_SUBTRACT(oparg, next_instr)
elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index:
self.BINARY_TRUE_DIVIDE(oparg, next_instr)
elif opcode == opcodedesc.BINARY_XOR.index:
self.BINARY_XOR(oparg, next_instr)
elif opcode == opcodedesc.BUILD_CONST_KEY_MAP.index:
self.BUILD_CONST_KEY_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST.index:
self.BUILD_LIST(oparg, next_instr)
elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index:
self.BUILD_LIST_FROM_ARG(oparg, next_instr)
elif opcode == opcodedesc.BUILD_MAP.index:
self.BUILD_MAP(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SET.index:
self.BUILD_SET(oparg, next_instr)
elif opcode == opcodedesc.BUILD_SLICE.index:
self.BUILD_SLICE(oparg, next_instr)
elif opcode == opcodedesc.BUILD_TUPLE.index:
self.BUILD_TUPLE(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION.index:
self.CALL_FUNCTION(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_KW.index:
self.CALL_FUNCTION_KW(oparg, next_instr)
elif opcode == opcodedesc.CALL_FUNCTION_EX.index:
self.CALL_FUNCTION_EX(oparg, next_instr)
elif opcode == opcodedesc.CALL_METHOD.index:
> self.CALL_METHOD(oparg, next_instr)
interpreter\pyopcode.py:313:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
f = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_get_rpy_...-win-x86-64\build\pypy\module\gc\test\test_referents.py:79]", line 1> at line 3
oparg = 1, ignored = (16L,), n_args = 1, w_self = None, n = 1
@jit.unroll_safe
def CALL_METHOD(f, oparg, *ignored):
# opargs contains the arg, and kwarg count, excluding the implicit 'self'
n_args = oparg
w_self = f.peekvalue_maybe_none(n_args)
n = n_args + (w_self is not None)
w_callable = f.peekvalue(n_args + 1)
w_result = f.space.call_valuestack(
> w_callable, n, f, methodcall=w_self is not None, dropvalues=n_args+2)
objspace\std\callmethod.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace, w_func = <BuiltinFunction get_rpy_memory_usage>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_get_rpy_...-win-x86-64\build\pypy\module\gc\test\test_referents.py:79]", line 1> at line 3
dropvalues = 3, methodcall = False
def call_valuestack(self, w_func, nargs, frame, dropvalues, methodcall=False):
# methodcall is only used for better error messages in argument.py
from pypy.interpreter.function import Function, _Method, is_builtin_code
if frame.get_is_being_profiled() and is_builtin_code(w_func):
# XXX: this code is copied&pasted :-( from the slow path below
# call_valuestack().
args = frame.make_arguments(nargs, w_function=w_func)
frame.dropvalues(dropvalues)
return self.call_args_and_c_profile(frame, w_func, args)
if not self.config.objspace.disable_call_speedhacks:
# start of hack for performance
if isinstance(w_func, _Method):
# reuse callable stack place for w_inst
frame.settopvalue(w_func.w_instance, nargs)
nargs += 1
methodcall = True
w_func = w_func.w_function
if isinstance(w_func, Function):
return w_func.funccall_valuestack(
> nargs, frame, methodcall=methodcall, dropvalues=dropvalues)
interpreter\baseobjspace.py:1264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BuiltinFunction get_rpy_memory_usage>, nargs = 1
frame = <pypy.objspace.std.frame.StdObjSpaceFrame executing <code object test_get_rpy_...-win-x86-64\build\pypy\module\gc\test\test_referents.py:79]", line 1> at line 3
dropvalues = 3, methodcall = False
def funccall_valuestack(self, nargs, frame, dropvalues, methodcall=False): # speed hack
# methodcall is only for better error messages
from pypy.interpreter import gateway
from pypy.interpreter.pycode import PyCode
code = self.getcode() # hook for the jit
#
if (jit.we_are_jitted() and code is self.space._code_of_sys_exc_info
and nargs == 0):
frame.dropvalues(dropvalues)
from pypy.module.sys.vm import exc_info_direct
return exc_info_direct(self.space, frame)
#
fast_natural_arity = code.fast_natural_arity
if nargs == fast_natural_arity:
if nargs == 0:
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode0)
return code.fastcall_0(self.space, self)
elif nargs == 1:
f_0 = frame.peekvalue(0)
frame.dropvalues(dropvalues)
assert isinstance(code, gateway.BuiltinCode1)
> return code.fastcall_1(self.space, self, f_0)
interpreter\function.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000019f2b213e88>
space = StdObjSpace, w_func = <BuiltinFunction get_rpy_memory_usage>
w1 = W_IntObject(12345)
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
w_result = self.fastfunc_1(space, w1)
except DescrMismatch:
return self._type_unwrap_mismatch(space,
Arguments(space, [w1]))
except Exception as e:
> self.handle_exception(space, e)
interpreter\gateway.py:982:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000019f2b213e88>
space = StdObjSpace
e = AttributeError("type object 'W_IntObject' has no attribute '__basicsize__'",)
def handle_exception(self, space, e):
try:
if not we_are_translated():
raise
raise e
except OperationError:
raise
except Exception as e: # general fall-back
from pypy.interpreter import error
> raise error.get_converted_unexpected_exception(space, e)
interpreter\gateway.py:908:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.gateway.BuiltinCode1 object at 0x0000019f2b213e88>
space = StdObjSpace, w_func = <BuiltinFunction get_rpy_memory_usage>
w1 = W_IntObject(12345)
@signature(sigtypes.self(), sigtypes.any(),
w_root_or_none,
w_root_or_none,
returns=w_root_or_none)
def fastcall_1(self, space, w_func, w1):
try:
> w_result = self.fastfunc_1(space, w1)
interpreter\gateway.py:977:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace, w_obj = W_IntObject(12345)
def get_rpy_memory_usage(space, w_obj):
"""Return the memory usage of just the given object or GcRef.
This does not include the internal structures of the object."""
gcref = unwrap(space, w_obj)
> size = rgc.get_rpy_memory_usage(gcref)
module\gc\referents.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gcref = _GcRef(W_IntObject(12345))
@not_rpython
def get_rpy_memory_usage(gcref):
# approximate implementation using CPython's type info
Class = type(gcref._x)
> size = Class.__basicsize__
E AttributeError: type object 'W_IntObject' has no attribute '__basicsize__'
..\rpython\rlib\rgc.py:851: AttributeError
=========================== short test summary info ===========================
FAIL module\gc\test\test_referents.py::AppTestReferents::()::test_get_rpy_memory_usage
============== 1 failed, 28 passed, 1 xfailed in 135.15 seconds ===============
++ 05:07:26 starting module/math/test [114 started in total]
__ module/itertools/test [111 done in total, somefailed=False] ________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 92 items
module\itertools\test\apptest_itertools.py ....
module\itertools\test\test_itertools.py .......................................................................................
module\itertools\test\test_ztranslation.py .
========================= 92 passed in 251.55 seconds =========================
++ 05:09:43 starting module/micronumpy/test [115 started in total]
__ module/micronumpy/test [112 done in total, somefailed=False] _______________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items
======================== no tests ran in 0.01 seconds =========================
++ 05:10:52 starting module/mmap/test [116 started in total]
__ module/marshal/test [113 done in total, somefailed=False] __________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 51 items
module\marshal\test\apptest_marshal.py ...............................................
module\marshal\test\test_marshal.py s
module\marshal\test\test_marshalimpl.py ...
=================== 50 passed, 1 skipped in 279.43 seconds ====================
++ 05:10:56 starting module/operator/test [117 started in total]
__ module/imp/test [114 done in total, somefailed=True] _______________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 123 items
module\imp\test\test_app.py .E......................
module\imp\test\test_import.py ...............................................................s...........s......s..s..............
=================================== ERRORS ====================================
___________ ERROR at teardown of AppTestImpModule.test_find_module ____________
self = <CallInfo when='teardown' exception: {
array [ '%', 'L', 'E', '\x00' ]:
...
File "d:\pypy_stuff\buildbot64\slav...bot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\ctypefunc.py", line 523, in rawallocate
flavor='raw')
}>
func = <function <lambda> at 0x00000211920df1f0>, when = 'teardown'
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_teardown'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_find_module'>, 'nextitem': <App...rgs={...}>}>, 'item': <AppTestMethod 'test_find_module'>, 'nextitem': <AppTestMethod 'test_find_module_with_encoding'>}
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 0x0000021180051440>
hook = <_HookCaller 'pytest_runtest_teardown'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_find_module'>, 'nextitem': <App...rgs={...}>}>, 'item': <AppTestMethod 'test_find_module'>, 'nextitem': <AppTestMethod 'test_find_module_with_encoding'>}
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_teardown'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_find_module'>, 'nextitem': <App...rgs={...}>}>, 'item': <AppTestMethod 'test_find_module'>, 'nextitem': <AppTestMethod 'test_find_module_with_encoding'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
..\_pytest\vendored_packages\pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_find_module'>, 'nextitem': <AppTestMethod 'test_find_module_with_encoding'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
..\_pytest\vendored_packages\pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_teardown at 0x000002118e818bb0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...h_encoding'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
..\_pytest\vendored_packages\pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x00000211920ceba0>
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 0x00000211920ceba0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...h_encoding'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_find_module'>, 'nextitem': <AppTestMethod 'test_find_module_with_encoding'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
..\_pytest\vendored_packages\pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.conftest.LeakFinder instance at 0x00000211818ace20>
item = <AppTestMethod 'test_find_module'>
@pytest.hookimpl(trylast=True)
def pytest_runtest_teardown(self, item):
if not isinstance(item, py.test.collect.Function):
return
if (not getattr(item.obj, 'dont_track_allocations', False)
and leakfinder.TRACK_ALLOCATIONS):
kwds = {}
try:
kwds['do_collection'] = item.track_allocations_collect
except AttributeError:
pass
item._pypytest_leaks = leakfinder.stop_tracking_allocations(False,
**kwds)
else: # stop_tracking_allocations() already called
item._pypytest_leaks = None
# check for leaks, but only if the test passed so far
if getattr(item, '_success', False) and item._pypytest_leaks:
> raise leakfinder.MallocMismatch(item._pypytest_leaks)
E MallocMismatch: {
E
E array [ '%', 'L', 'E', '\x00' ]:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdataobj.py", line 13, in <module>
E from pypy.module._cffi_backend import misc
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\misc.py", line 125, in <module>
E FORMAT_LONGDOUBLE = rffi.str2charp("%LE")
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py", line 821, in str2charp
E array = lltype.malloc(TYPEP.TO, len(s) + 1, flavor='raw', track_allocation=True)
E
E <C object Struct cffi_ctxobj { ctx, info } at 0x211805370c0>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\ffi_obj.py", line 738, in make_plain_ffi_object
E r.__init__(space, src_ctx)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\ffi_obj.py", line 59, in __init__
E self.ctxobj = parse_c_type.allocate_ctxobj(src_ctx)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\parse_c_type.py", line 71, in allocate_ctxobj
E p = lltype.malloc(CTXOBJ, flavor='raw', zero=True)
E
E <C object Array of Char {'nolength': True} at 0x2118b4e3090>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 131, in ffiobj_init
E ntypes = allocate_array(ffi, _CFFI_OPCODE_T, n)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 109, in allocate_array
E p = allocate(ffi, nitems * nbytes)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 102, in allocate
E p = lltype.malloc(rffi.CCHARP.TO, nbytes, flavor='raw', zero=True)
E
E <C object Array of Char {'nolength': True} at 0x21188ff79a0>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\ffi_obj.py", line 191, in descr_init
E w__typenames, w__includes)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 146, in ffiobj_init
E p = allocate(ffi, size)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 102, in allocate
E p = lltype.malloc(rffi.CCHARP.TO, nbytes, flavor='raw', zero=True)
E
E <C object Array of Char {'nolength': True} at 0x21180494ad0>:
E <C object Array of Char {'nolength': True} at 0x21180494e30>:
E <C object Array of Char {'nolength': True} at 0x21180494ab0>:
E <C object Array of Char {'nolength': True} at 0x21180494af0>:
E <C object Array of Char {'nolength': True} at 0x21180494b90>:
E <C object Array of Char {'nolength': True} at 0x21180494b10>:
E <C object Array of Char {'nolength': True} at 0x21180494c50>:
E <C object Array of Char {'nolength': True} at 0x21180494ed0>:
E <C object Array of Char {'nolength': True} at 0x21180495110>:
E <C object Array of Char {'nolength': True} at 0x21180495610>:
E <C object Array of Char {'nolength': True} at 0x211804950d0>:
E <C object Array of Char {'nolength': True} at 0x21180495130>:
E <C object Array of Char {'nolength': True} at 0x21180495510>:
E <C object Array of Char {'nolength': True} at 0x21180494ff0>:
E <C object Array of Char {'nolength': True} at 0x21180495010>:
E <C object Array of Char {'nolength': True} at 0x21180494f10>:
E <C object Array of Char {'nolength': True} at 0x211804950b0>:
E <C object Array of Char {'nolength': True} at 0x211804954d0>:
E <C object Array of Char {'nolength': True} at 0x21180495470>:
E <C object Array of Char {'nolength': True} at 0x21186972590>:
E <C object Array of Char {'nolength': True} at 0x21180495550>:
E <C object Array of Char {'nolength': True} at 0x211804950f0>:
E <C object Array of Char {'nolength': True} at 0x211804951f0>:
E <C object Array of Char {'nolength': True} at 0x21180495090>:
E <C object Array of Char {'nolength': True} at 0x21180495570>:
E <C object Array of Char {'nolength': True} at 0x21180495210>:
E <C object Array of Char {'nolength': True} at 0x21180495190>:
E <C object Array of Char {'nolength': True} at 0x21180495230>:
E <C object Array of Char {'nolength': True} at 0x21180495410>:
E <C object Array of Char {'nolength': True} at 0x2118b37b4d0>:
E <C object Array of Char {'nolength': True} at 0x21180495030>:
E <C object Array of Char {'nolength': True} at 0x21180495150>:
E <C object Array of Char {'nolength': True} at 0x21180495070>:
E <C object Array of Char {'nolength': True} at 0x21180495050>:
E <C object Array of Char {'nolength': True} at 0x21180495250>:
E <C object Array of Char {'nolength': True} at 0x211804952b0>:
E <C object Array of Char {'nolength': True} at 0x21180494f90>:
E <C object Array of Char {'nolength': True} at 0x21180494fb0>:
E <C object Array of Char {'nolength': True} at 0x21180495270>:
E <C object Array of Char {'nolength': True} at 0x2118b37b290>:
E <C object Array of Char {'nolength': True} at 0x211804951b0>:
E <C object Array of Char {'nolength': True} at 0x2118b37b410>:
E <C object Array of Char {'nolength': True} at 0x21180495590>:
E <C object Array of Char {'nolength': True} at 0x21180495290>:
E <C object Array of Char {'nolength': True} at 0x2118b37bc50>:
E <C object Array of Char {'nolength': True} at 0x211804952d0>:
E <C object Array of Char {'nolength': True} at 0x211804954f0>:
E <C object Array of Char {'nolength': True} at 0x211804954b0>:
E <C object Array of Char {'nolength': True} at 0x21180495630>:
E <C object Array of Char {'nolength': True} at 0x211804955b0>:
E <C object Array of Char {'nolength': True} at 0x211804955d0>:
E <C object Array of Char {'nolength': True} at 0x211804953d0>:
E <C object Array of Char {'nolength': True} at 0x211804952f0>:
E <C object Array of Char {'nolength': True} at 0x21180495170>:
E <C object Array of Char {'nolength': True} at 0x21180494e70>:
E <C object Array of Char {'nolength': True} at 0x21180494f70>:
E <C object Array of Char {'nolength': True} at 0x211804951d0>:
E <C object Array of Char {'nolength': True} at 0x21180495350>:
E <C object Array of Char {'nolength': True} at 0x21180494fd0>:
E <C object Array of Char {'nolength': True} at 0x21186972f00>:
E <C object Array of Char {'nolength': True} at 0x211804953b0>:
E <C object Array of Char {'nolength': True} at 0x211869723d0>:
E <C object Array of Char {'nolength': True} at 0x21180494ef0>:
E <C object Array of Char {'nolength': True} at 0x21180495450>:
E <C object Array of Char {'nolength': True} at 0x21180495530>:
E <C object Array of Char {'nolength': True} at 0x211804955f0>:
E <C object Array of Char {'nolength': True} at 0x21180495810>:
E <C object Array of Char {'nolength': True} at 0x211804959b0>:
E <C object Array of Char {'nolength': True} at 0x21180495d90>:
E <C object Array of Char {'nolength': True} at 0x21180495910>:
E <C object Array of Char {'nolength': True} at 0x21180495d50>:
E <C object Array of Char {'nolength': True} at 0x21180495db0>:
E <C object Array of Char {'nolength': True} at 0x21186972c00>:
E <C object Array of Char {'nolength': True} at 0x21186972f90>:
E <C object Array of Char {'nolength': True} at 0x211869734e0>:
E <C object Array of Char {'nolength': True} at 0x21180495cf0>:
E <C object Array of Char {'nolength': True} at 0x21186972ec0>:
E <C object Array of Char {'nolength': True} at 0x21180495830>:
E <C object Array of Char {'nolength': True} at 0x21180495730>:
E <C object Array of Char {'nolength': True} at 0x21186972ca0>:
E <C object Array of Char {'nolength': True} at 0x21186973170>:
E <C object Array of Char {'nolength': True} at 0x21180495950>:
E <C object Array of Char {'nolength': True} at 0x21180495670>:
E <C object Array of Char {'nolength': True} at 0x211804956f0>:
E <C object Array of Char {'nolength': True} at 0x21186972320>:
E <C object Array of Char {'nolength': True} at 0x21180495750>:
E <C object Array of Char {'nolength': True} at 0x211869731b0>:
E <C object Array of Char {'nolength': True} at 0x21186973650>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 153, in ffiobj_init
E nglobs[i].c_name = decoder.next_name()
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 92, in next_name
E p = rffi.str2charp(self.string[frm : i])
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py", line 821, in str2charp
E array = lltype.malloc(TYPEP.TO, len(s) + 1, flavor='raw', track_allocation=True)
E
E <C object Array of Char {'nolength': True} at 0x2118880fa70>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 174, in ffiobj_init
E nstructs = allocate_array(ffi, STRUCT_UNION_S, n)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 109, in allocate_array
E p = allocate(ffi, nitems * nbytes)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 102, in allocate
E p = lltype.malloc(rffi.CCHARP.TO, nbytes, flavor='raw', zero=True)
E
E <C object Array of Char {'nolength': True} at 0x21185e3b510>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 175, in ffiobj_init
E nfields = allocate_array(ffi, FIELD_S, nftot)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 109, in allocate_array
E p = allocate(ffi, nitems * nbytes)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 102, in allocate
E p = lltype.malloc(rffi.CCHARP.TO, nbytes, flavor='raw', zero=True)
E
E <C object Array of Char {'nolength': True} at 0x21184548940>:
E <C object Array of Char {'nolength': True} at 0x21184545bf0>:
E <C object Array of Char {'nolength': True} at 0x21184545730>:
E <C object Array of Char {'nolength': True} at 0x211845457b0>:
E <C object Array of Char {'nolength': True} at 0x21184545b30>:
E <C object Array of Char {'nolength': True} at 0x21184546040>:
E <C object Array of Char {'nolength': True} at 0x21184546420>:
E <C object Array of Char {'nolength': True} at 0x211845462a0>:
E <C object Array of Char {'nolength': True} at 0x21184546380>:
E <C object Array of Char {'nolength': True} at 0x211845462d0>:
E <C object Array of Char {'nolength': True} at 0x211845464b0>:
E <C object Array of Char {'nolength': True} at 0x211804957d0>:
E <C object Array of Char {'nolength': True} at 0x21180495a30>:
E <C object Array of Char {'nolength': True} at 0x21180495710>:
E <C object Array of Char {'nolength': True} at 0x21184546130>:
E <C object Array of Char {'nolength': True} at 0x21180495a10>:
E <C object Array of Char {'nolength': True} at 0x21184546870>:
E <C object Array of Char {'nolength': True} at 0x21180495a70>:
E <C object Array of Char {'nolength': True} at 0x21180495d30>:
E <C object Array of Char {'nolength': True} at 0x2118b37b320>:
E <C object Array of Char {'nolength': True} at 0x21180491fb0>:
E <C object Array of Char {'nolength': True} at 0x21180492370>:
E <C object Array of Char {'nolength': True} at 0x211804920f0>:
E <C object Array of Char {'nolength': True} at 0x21180491eb0>:
E <C object Array of Char {'nolength': True} at 0x211804923f0>:
E <C object Array of Char {'nolength': True} at 0x211804921b0>:
E <C object Array of Char {'nolength': True} at 0x21180491f50>:
E <C object Array of Char {'nolength': True} at 0x2118b37bd10>:
E <C object Array of Char {'nolength': True} at 0x21184547500>:
E <C object Array of Char {'nolength': True} at 0x21180492510>:
E <C object Array of Char {'nolength': True} at 0x211804921f0>:
E <C object Array of Char {'nolength': True} at 0x211804923d0>:
E <C object Array of Char {'nolength': True} at 0x21180494b30>:
E <C object Array of Char {'nolength': True} at 0x21184548d20>:
E <C object Array of Char {'nolength': True} at 0x211804947f0>:
E <C object Array of Char {'nolength': True} at 0x21180494810>:
E <C object Array of Char {'nolength': True} at 0x21180494d90>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 185, in ffiobj_init
E nstructs[i].c_name = decoder.next_name()
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 92, in next_name
E p = rffi.str2charp(self.string[frm : i])
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py", line 821, in str2charp
E array = lltype.malloc(TYPEP.TO, len(s) + 1, flavor='raw', track_allocation=True)
E
E <C object Array of Char {'nolength': True} at 0x211804959d0>:
E <C object Array of Char {'nolength': True} at 0x211845457e0>:
E <C object Array of Char {'nolength': True} at 0x21184545780>:
E <C object Array of Char {'nolength': True} at 0x21184545ac0>:
E <C object Array of Char {'nolength': True} at 0x21184545d40>:
E <C object Array of Char {'nolength': True} at 0x211845456d0>:
E <C object Array of Char {'nolength': True} at 0x21184545da0>:
E <C object Array of Char {'nolength': True} at 0x211845458c0>:
E <C object Array of Char {'nolength': True} at 0x21184546020>:
E <C object Array of Char {'nolength': True} at 0x21180495850>:
E <C object Array of Char {'nolength': True} at 0x211804959f0>:
E <C object Array of Char {'nolength': True} at 0x21180495890>:
E <C object Array of Char {'nolength': True} at 0x21180495cd0>:
E <C object Array of Char {'nolength': True} at 0x21180495930>:
E <C object Array of Char {'nolength': True} at 0x211804956d0>:
E <C object Array of Char {'nolength': True} at 0x21180495d10>:
E <C object Array of Char {'nolength': True} at 0x21180495a90>:
E <C object Array of Char {'nolength': True} at 0x211845458f0>:
E <C object Array of Char {'nolength': True} at 0x21184546400>:
E <C object Array of Char {'nolength': True} at 0x211845459e0>:
E <C object Array of Char {'nolength': True} at 0x21184546440>:
E <C object Array of Char {'nolength': True} at 0x211845457a0>:
E <C object Array of Char {'nolength': True} at 0x21184546050>:
E <C object Array of Char {'nolength': True} at 0x211804958b0>:
E <C object Array of Char {'nolength': True} at 0x21180495770>:
E <C object Array of Char {'nolength': True} at 0x21184545530>:
E <C object Array of Char {'nolength': True} at 0x21184545d30>:
E <C object Array of Char {'nolength': True} at 0x211845468c0>:
E <C object Array of Char {'nolength': True} at 0x21180495790>:
E <C object Array of Char {'nolength': True} at 0x21184545630>:
E <C object Array of Char {'nolength': True} at 0x21180495690>:
E <C object Array of Char {'nolength': True} at 0x211804957b0>:
E <C object Array of Char {'nolength': True} at 0x21184546480>:
E <C object Array of Char {'nolength': True} at 0x21184546ce0>:
E <C object Array of Char {'nolength': True} at 0x211804956b0>:
E <C object Array of Char {'nolength': True} at 0x21180495a50>:
E <C object Array of Char {'nolength': True} at 0x21184545ae0>:
E <C object Array of Char {'nolength': True} at 0x21184546590>:
E <C object Array of Char {'nolength': True} at 0x21184546bc0>:
E <C object Array of Char {'nolength': True} at 0x21184546d50>:
E <C object Array of Char {'nolength': True} at 0x211845458a0>:
E <C object Array of Char {'nolength': True} at 0x21180495970>:
E <C object Array of Char {'nolength': True} at 0x211804958d0>:
E <C object Array of Char {'nolength': True} at 0x21180495990>:
E <C object Array of Char {'nolength': True} at 0x21184546720>:
E <C object Array of Char {'nolength': True} at 0x211804958f0>:
E <C object Array of Char {'nolength': True} at 0x21180495d70>:
E <C object Array of Char {'nolength': True} at 0x21180495870>:
E <C object Array of Char {'nolength': True} at 0x21180495cb0>:
E <C object Array of Char {'nolength': True} at 0x21180495b10>:
E <C object Array of Char {'nolength': True} at 0x211804957f0>:
E <C object Array of Char {'nolength': True} at 0x21184547050>:
E <C object Array of Char {'nolength': True} at 0x211845461d0>:
E <C object Array of Char {'nolength': True} at 0x21180495af0>:
E <C object Array of Char {'nolength': True} at 0x21184547460>:
E <C object Array of Char {'nolength': True} at 0x211845473f0>:
E <C object Array of Char {'nolength': True} at 0x211845462c0>:
E <C object Array of Char {'nolength': True} at 0x21184546cd0>:
E <C object Array of Char {'nolength': True} at 0x21180495ab0>:
E <C object Array of Char {'nolength': True} at 0x21184546e00>:
E <C object Array of Char {'nolength': True} at 0x21180495ad0>:
E <C object Array of Char {'nolength': True} at 0x21180495c30>:
E <C object Array of Char {'nolength': True} at 0x21180495b30>:
E <C object Array of Char {'nolength': True} at 0x21180495b90>:
E <C object Array of Char {'nolength': True} at 0x211845461c0>:
E <C object Array of Char {'nolength': True} at 0x21180495b50>:
E <C object Array of Char {'nolength': True} at 0x21180495b70>:
E <C object Array of Char {'nolength': True} at 0x21180495bf0>:
E <C object Array of Char {'nolength': True} at 0x21180495bb0>:
E <C object Array of Char {'nolength': True} at 0x21180495c10>:
E <C object Array of Char {'nolength': True} at 0x21180495c70>:
E <C object Array of Char {'nolength': True} at 0x21184547690>:
E <C object Array of Char {'nolength': True} at 0x21184546500>:
E <C object Array of Char {'nolength': True} at 0x21184546c50>:
E <C object Array of Char {'nolength': True} at 0x21180491ef0>:
E <C object Array of Char {'nolength': True} at 0x21180491f30>:
E <C object Array of Char {'nolength': True} at 0x211804925f0>:
E <C object Array of Char {'nolength': True} at 0x21180491f70>:
E <C object Array of Char {'nolength': True} at 0x211804924f0>:
E <C object Array of Char {'nolength': True} at 0x211804924d0>:
E <C object Array of Char {'nolength': True} at 0x21180492070>:
E <C object Array of Char {'nolength': True} at 0x21180492550>:
E <C object Array of Char {'nolength': True} at 0x211845461b0>:
E <C object Array of Char {'nolength': True} at 0x21180491e70>:
E <C object Array of Char {'nolength': True} at 0x21180492530>:
E <C object Array of Char {'nolength': True} at 0x21180492130>:
E <C object Array of Char {'nolength': True} at 0x21180492410>:
E <C object Array of Char {'nolength': True} at 0x21180492330>:
E <C object Array of Char {'nolength': True} at 0x21184548360>:
E <C object Array of Char {'nolength': True} at 0x211804920b0>:
E <C object Array of Char {'nolength': True} at 0x21180491fd0>:
E <C object Array of Char {'nolength': True} at 0x21184547300>:
E <C object Array of Char {'nolength': True} at 0x211804925b0>:
E <C object Array of Char {'nolength': True} at 0x21184546b90>:
E <C object Array of Char {'nolength': True} at 0x21180492290>:
E <C object Array of Char {'nolength': True} at 0x21184548220>:
E <C object Array of Char {'nolength': True} at 0x21184547d80>:
E <C object Array of Char {'nolength': True} at 0x21184548370>:
E <C object Array of Char {'nolength': True} at 0x21180492150>:
E <C object Array of Char {'nolength': True} at 0x21180492310>:
E <C object Array of Char {'nolength': True} at 0x21180492250>:
E <C object Array of Char {'nolength': True} at 0x21180491f10>:
E <C object Array of Char {'nolength': True} at 0x21180491f90>:
E <C object Array of Char {'nolength': True} at 0x21180492570>:
E <C object Array of Char {'nolength': True} at 0x21180492630>:
E <C object Array of Char {'nolength': True} at 0x21180492610>:
E <C object Array of Char {'nolength': True} at 0x21180492230>:
E <C object Array of Char {'nolength': True} at 0x211804922b0>:
E <C object Array of Char {'nolength': True} at 0x211804922d0>:
E <C object Array of Char {'nolength': True} at 0x211804922f0>:
E <C object Array of Char {'nolength': True} at 0x211804925d0>:
E <C object Array of Char {'nolength': True} at 0x21180492650>:
E <C object Array of Char {'nolength': True} at 0x21180491ff0>:
E <C object Array of Char {'nolength': True} at 0x21180492390>:
E <C object Array of Char {'nolength': True} at 0x21180492090>:
E <C object Array of Char {'nolength': True} at 0x21180492190>:
E <C object Array of Char {'nolength': True} at 0x21180492030>:
E <C object Array of Char {'nolength': True} at 0x21180491e90>:
E <C object Array of Char {'nolength': True} at 0x21180492010>:
E <C object Array of Char {'nolength': True} at 0x21180492170>:
E <C object Array of Char {'nolength': True} at 0x21180492490>:
E <C object Array of Char {'nolength': True} at 0x21180493d90>:
E <C object Array of Char {'nolength': True} at 0x21180493b90>:
E <C object Array of Char {'nolength': True} at 0x211845487f0>:
E <C object Array of Char {'nolength': True} at 0x21180493c30>:
E <C object Array of Char {'nolength': True} at 0x211804943f0>:
E <C object Array of Char {'nolength': True} at 0x211804944f0>:
E <C object Array of Char {'nolength': True} at 0x21180494170>:
E <C object Array of Char {'nolength': True} at 0x21184548e60>:
E <C object Array of Char {'nolength': True} at 0x21184547e20>:
E <C object Array of Char {'nolength': True} at 0x21180494e50>:
E <C object Array of Char {'nolength': True} at 0x21184545310>:
E <C object Array of Char {'nolength': True} at 0x21180494a90>:
E <C object Array of Char {'nolength': True} at 0x211804949b0>:
E <C object Array of Char {'nolength': True} at 0x211804948d0>:
E <C object Array of Char {'nolength': True} at 0x21180494a50>:
E <C object Array of Char {'nolength': True} at 0x21180494830>:
E <C object Array of Char {'nolength': True} at 0x21180494850>:
E <C object Array of Char {'nolength': True} at 0x211804948b0>:
E <C object Array of Char {'nolength': True} at 0x21180494d50>:
E <C object Array of Char {'nolength': True} at 0x211855e26a0>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 209, in ffiobj_init
E nfields[nf].c_name = decoder.next_name()
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 92, in next_name
E p = rffi.str2charp(self.string[frm : i])
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py", line 821, in str2charp
E array = lltype.malloc(TYPEP.TO, len(s) + 1, flavor='raw', track_allocation=True)
E
E <C object Array of Char {'nolength': True} at 0x21189d3e690>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 235, in ffiobj_init
E ntypenames = allocate_array(ffi, TYPENAME_S, n)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 109, in allocate_array
E p = allocate(ffi, nitems * nbytes)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 102, in allocate
E p = lltype.malloc(rffi.CCHARP.TO, nbytes, flavor='raw', zero=True)
E
E <C object Array of Char {'nolength': True} at 0x21180494b50>:
E <C object Array of Char {'nolength': True} at 0x21180495330>:
E <C object Array of Char {'nolength': True} at 0x21181641c40>:
E <C object Array of Char {'nolength': True} at 0x21180492050>:
E <C object Array of Char {'nolength': True} at 0x21180493710>:
E <C object Array of Char {'nolength': True} at 0x21180494bd0>:
E <C object Array of Char {'nolength': True} at 0x21180495650>:
E <C object Array of Char {'nolength': True} at 0x21181641700>:
E <C object Array of Char {'nolength': True} at 0x211869737e0>:
E <C object Array of Char {'nolength': True} at 0x21181640d00>:
E <C object Array of Char {'nolength': True} at 0x21186973ea0>:
E <C object Array of Char {'nolength': True} at 0x21186973dc0>:
E <C object Array of Char {'nolength': True} at 0x21186973ac0>:
E <C object Array of Char {'nolength': True} at 0x21186973d20>:
E <C object Array of Char {'nolength': True} at 0x21186973a80>:
E <C object Array of Char {'nolength': True} at 0x21181641010>:
E <C object Array of Char {'nolength': True} at 0x21186973cc0>:
E <C object Array of Char {'nolength': True} at 0x2118b37b3b0>:
E <C object Array of Char {'nolength': True} at 0x211869737a0>:
E <C object Array of Char {'nolength': True} at 0x21186973d60>:
E <C object Array of Char {'nolength': True} at 0x21181640e70>:
E <C object Array of Char {'nolength': True} at 0x211869738a0>:
E <C object Array of Char {'nolength': True} at 0x211869738c0>:
E <C object Array of Char {'nolength': True} at 0x21186973b80>:
E <C object Array of Char {'nolength': True} at 0x21186973a20>:
E <C object Array of Char {'nolength': True} at 0x21186973c20>:
E <C object Array of Char {'nolength': True} at 0x21186973a60>:
E <C object Array of Char {'nolength': True} at 0x21186973b60>:
E <C object Array of Char {'nolength': True} at 0x2118b37b6e0>:
E <C object Array of Char {'nolength': True} at 0x21186973ce0>:
E <C object Array of Char {'nolength': True} at 0x21186973920>:
E <C object Array of Char {'nolength': True} at 0x2118b37bce0>:
E <C object Array of Char {'nolength': True} at 0x211869737c0>:
E <C object Array of Char {'nolength': True} at 0x21186973840>:
E <C object Array of Char {'nolength': True} at 0x211869739e0>:
E <C object Array of Char {'nolength': True} at 0x211816411f0>:
E <C object Array of Char {'nolength': True} at 0x21186973720>:
E <C object Array of Char {'nolength': True} at 0x21186973c40>:
E <C object Array of Char {'nolength': True} at 0x211816418e0>:
E <C object Array of Char {'nolength': True} at 0x2118b37b7d0>:
E <C object Array of Char {'nolength': True} at 0x21186973820>:
E <C object Array of Char {'nolength': True} at 0x21186973760>:
E <C object Array of Char {'nolength': True} at 0x21186973b20>:
E <C object Array of Char {'nolength': True} at 0x21186973e00>:
E <C object Array of Char {'nolength': True} at 0x21186974460>:
E <C object Array of Char {'nolength': True} at 0x211869742a0>:
E <C object Array of Char {'nolength': True} at 0x21186974140>:
E <C object Array of Char {'nolength': True} at 0x21186974180>:
E <C object Array of Char {'nolength': True} at 0x211869743c0>:
E <C object Array of Char {'nolength': True} at 0x21181641e70>:
E <C object Array of Char {'nolength': True} at 0x21186974020>:
E <C object Array of Char {'nolength': True} at 0x21186974280>:
E <C object Array of Char {'nolength': True} at 0x211869744e0>:
E <C object Array of Char {'nolength': True} at 0x21186974480>:
E <C object Array of Char {'nolength': True} at 0x21186974240>:
E <C object Array of Char {'nolength': True} at 0x21186973fe0>:
E <C object Array of Char {'nolength': True} at 0x21181641cb0>:
E <C object Array of Char {'nolength': True} at 0x21186974580>:
E <C object Array of Char {'nolength': True} at 0x21186974400>:
E <C object Array of Char {'nolength': True} at 0x21186974340>:
E <C object Array of Char {'nolength': True} at 0x211869742c0>:
E <C object Array of Char {'nolength': True} at 0x2118b37ba10>:
E <C object Array of Char {'nolength': True} at 0x211816422a0>:
E <C object Array of Char {'nolength': True} at 0x21186974360>:
E <C object Array of Char {'nolength': True} at 0x211869744a0>:
E <C object Array of Char {'nolength': True} at 0x21181641950>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 239, in ffiobj_init
E ntypenames[i].c_name = decoder.next_name()
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\cdlopen.py", line 92, in next_name
E p = rffi.str2charp(self.string[frm : i])
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\rpython\rtyper\lltypesystem\rffi.py", line 821, in str2charp
E array = lltype.malloc(TYPEP.TO, len(s) + 1, flavor='raw', track_allocation=True)
E
E <C object Struct CIF_DESCRIPTION { cif, abi, nargs, rtype, atypes, exchange_size, exchange_result, exchange_args } at 0x21189c69140>:
E ...
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\newtype.py", line 752, in _build_function_type
E fct = ctypefunc.W_CTypeFunc(space, fargs, fresult, ellipsis, abi)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\ctypefunc.py", line 53, in __init__
E builder.rawallocate(self)
E File "d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_cffi_backend\ctypefunc.py", line 523, in rawallocate
E flavor='raw')
E }
..\rpython\conftest.py:103: MallocMismatch
============== 119 passed, 4 skipped, 1 error in 463.67 seconds ===============
++ 05:13:06 starting module/posix/test [118 started in total]
__ module/math/test [115 done in total, somefailed=False] _____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
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 384.13 seconds ===================
++ 05:13:56 starting module/pwd/test [119 started in total]
__ module/mmap/test [116 done in total, somefailed=False] _____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 46 items
module\mmap\test\test_mmap.py ....s.................s........s..ss....s..s..
=================== 39 passed, 7 skipped in 207.18 seconds ====================
++ 05:14:26 starting module/pyexpat/test [120 started in total]
__ module/pwd/test [117 done in total, somefailed=False] ______________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items / 2 skipped
========================= 2 skipped in 29.84 seconds ==========================
++ 05:14:30 starting module/pypyjit/test [121 started in total]
__ module/operator/test [118 done in total, somefailed=False] _________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 273.28 seconds =========================
++ 05:15:36 starting module/select/test [122 started in total]
__ module/posix/test [119 done in total, somefailed=True] _____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 109 items / 1 skipped
module\posix\test\apptest_posix.py .....
module\posix\test\test_interp_posix.py s...
module\posix\test\test_nt.py ..
module\posix\test\test_posix2.py .....................s........s.....s..s....ss...Fs....s.s....s......F.......s
module\posix\test\test_scandir.py ....s..ssss.s.......
================================== FAILURES ===================================
_______________________ AppTestPosix.test_urandom_large _______________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001e5b05fad40>
def test_urandom_large(self):
os = self.posix
length = 2147479553
> s = os.urandom(length)
E (application-level) MemoryError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\posix\test\test_posix2.py:1531]:4: MemoryError
________________________ AppTestNt.test_dll_directory _________________________
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001e5b2ab1408>
def test_dll_directory(self):
nt = self.posix
> ret = nt._add_dll_directory(b'c:\\')
E (application-level) TypeError: expected str, got bytes object
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\posix\test\test_posix2.py:1850]:3: TypeError
=========================== short test summary info ===========================
FAIL module\posix\test\test_posix2.py::AppTestPosix::()::test_urandom_large
FAIL module\posix\test\test_posix2.py::AppTestNt::()::test_dll_directory
============== 2 failed, 89 passed, 19 skipped in 273.85 seconds ==============
++ 05:17:44 starting module/signal/test [123 started in total]
__ module/pypyjit/test [120 done in total, somefailed=False] __________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 214.75 seconds ====================
++ 05:18:10 starting module/struct/test [124 started in total]
__ module/pyexpat/test [121 done in total, somefailed=True] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 21 items
module\pyexpat\test\apptest_pyexpat.py .FF
module\pyexpat\test\test_build.py .
module\pyexpat\test\test_parser.py .................
================================== FAILURES ===================================
________________________ test_set_activation_threshold ________________________
def test_set_activation_threshold():
parser = pyexpat.ParserCreate()
# Raises on error
> parser.SetAllocTrackerActivationThreshold(1000)
E (application-level) ExpatError: parser must be a root parser
module\pyexpat\test\apptest_pyexpat.py:14: ExpatError
_______________________ test_set_maximum_amplification ________________________
def test_set_maximum_amplification():
parser = pyexpat.ParserCreate()
# Raises on error
> parser.SetAllocTrackerMaximumAmplification(3.0)
E (application-level) ExpatError: parser must be a root parser
module\pyexpat\test\apptest_pyexpat.py:19: ExpatError
=========================== short test summary info ===========================
FAIL module\pyexpat\test\apptest_pyexpat.py::test_set_activation_threshold
FAIL module\pyexpat\test\apptest_pyexpat.py::test_set_maximum_amplification
==================== 2 failed, 19 passed in 223.10 seconds ====================
++ 05:18:13 starting module/sys/test [125 started in total]
__ module/signal/test [122 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 27 items
module\signal\test\apptest_signal.py s
module\signal\test\test_signal.py s.s.....ss..s...sssssss...
=================== 14 passed, 13 skipped in 194.94 seconds ===================
++ 05:21:03 starting module/termios/test [126 started in total]
__ module/termios/test [123 done in total, somefailed=False] __________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items / 1 skipped
========================= 1 skipped in 11.46 seconds ==========================
++ 05:21:29 starting module/test_lib_pypy [127 started in total]
__ module/select/test [124 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 46 items
module\select\test\test_epoll.py ssssssssss
module\select\test\test_kqueue.py ssssss
module\select\test\test_select.py ssssssssssssssss..........ss
module\select\test\test_select_signal.py s
module\select\test\test_ztranslation.py .
=================== 11 passed, 35 skipped in 403.78 seconds ===================
++ 05:22:29 starting module/thread/test [128 started in total]
__ module/struct/test [125 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
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 268.53 seconds =========================
++ 05:22:44 starting module/time/test [129 started in total]
__ module/sys/test [126 done in total, somefailed=False] ______________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 96 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 .s
module\sys\test\test_initpath.py ..s......
module\sys\test\test_sysmodule.py .....................ss..................ss........................
module\sys\test\test_version.py .......
=================== 90 passed, 6 skipped in 357.79 seconds ====================
++ 05:24:16 starting module/token/test [130 started in total]
__ module/token/test [127 done in total, somefailed=False] ____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 8 items
module\token\test\apptest_token.py ........
========================= 8 passed in 186.35 seconds ==========================
++ 05:27:31 starting module/unicodedata/test [131 started in total]
__ module/test_lib_pypy [128 done in total, somefailed=True] __________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 238 items / 5 skipped
module\test_lib_pypy\test_code_module.py E..
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_stackless.py ..............................
module\test_lib_pypy\test_stackless_pickling.py ..
module\test_lib_pypy\test_structseq.py ...........
module\test_lib_pypy\test_tputil.py ..s....
=================================== ERRORS ====================================
______________ ERROR at setup of AppTestCodeModule.test_cause_tb ______________
self = <CallInfo when='setup' exception: CompilationError(out="""
""")>
func = <function <lambda> at 0x0000010aa789cd40>, when = 'setup'
def __init__(self, func, when):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
..\_pytest\runner.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
..\_pytest\runner.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_HookCaller 'pytest_runtest_setup'>
kwargs = {'__multicall__': <_MultiCall 0 results, 5 meths, kwargs={'item': <AppTestMethod 'test_cause_tb'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_cause_tb'>}
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 0x0000010aa35a1440>
hook = <_HookCaller 'pytest_runtest_setup'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000010aa4ec7aa0>, <_pytest.vendored_packages.pluggy.HookImp...y.HookImpl instance at 0x0000010aa3a74660>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000010aa3a746a0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 5 meths, kwargs={'item': <AppTestMethod 'test_cause_tb'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_cause_tb'>}
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 0x0000010aa4ec7aa0>, <_pytest.vendored_packages.pluggy.HookImp...y.HookImpl instance at 0x0000010aa3a74660>, <_pytest.vendored_packages.pluggy.HookImpl instance at 0x0000010aa3a746a0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 5 meths, kwargs={'item': <AppTestMethod 'test_cause_tb'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_cause_tb'>}
self._inner_hookexec = lambda hook, methods, kwargs: \
> _MultiCall(methods, kwargs, hook.spec_opts).execute()
..\_pytest\vendored_packages\pluggy.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 5 meths, kwargs={'item': <AppTestMethod 'test_cause_tb'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
> return _wrapped_call(hook_impl.function(*args), self.execute)
..\_pytest\vendored_packages\pluggy.py:595:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wrap_controller = <generator object pytest_runtest_setup at 0x0000010aa78a2cf0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 5 meths, kwargs={'i...t_cause_tb'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>>
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
> return call_outcome.get_result()
..\_pytest\vendored_packages\pluggy.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x0000010aa789bf20>
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 0x0000010aa789bf20>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 5 meths, kwargs={'i...t_cause_tb'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>>
def __init__(self, func):
try:
> self.result = func()
..\_pytest\vendored_packages\pluggy.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_MultiCall 0 results, 5 meths, kwargs={'item': <AppTestMethod 'test_cause_tb'>, '__multicall__': <_MultiCall 0 results, 5 meths, kwargs={...}>}>
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
args = [all_kwargs[argname] for argname in hook_impl.argnames]
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
> res = hook_impl.function(*args)
..\_pytest\vendored_packages\pluggy.py:596:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <AppTestMethod 'test_cause_tb'>
@pytest.hookimpl(tryfirst=True)
def pytest_runtest_setup(item):
if isinstance(item, pytest.Function):
config = item.config
if get_marker(item, name='pypy_only'):
if config.applevel is not None and not config.applevel.is_pypy:
pytest.skip('PyPy-specific test')
appclass = item.getparent(pytest.Class)
if appclass is not None:
from pypy.tool.pytest.objspace import gettestobjspace
# Make cls.space and cls.runappdirect available in tests.
spaceconfig = getattr(appclass.obj, 'spaceconfig', {})
> appclass.obj.space = gettestobjspace(**spaceconfig)
conftest.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
kwds = {'usemodules': ['struct']}
config = <rpython.config.config.Config object at 0x0000010aa78dafa8>
key = (((False, True, False, False, True, False, ...), True, None, False, None, False, ...), False, (False, 'lltype', 'c', False, True, 'ref', ...))
def gettestobjspace(**kwds):
""" helper for instantiating and caching spaces for testing.
"""
try:
config = make_config(option, **kwds)
except ConflictConfigError as e:
# this exception is typically only raised if a module is not available.
# in this case the test should be skipped
py.test.skip(str(e))
if getattr(option, 'runappdirect', None):
return TinyObjSpace()
key = config.getkey()
try:
return _SPACECACHE[key]
except KeyError:
> space = maketestobjspace(config)
tool\pytest\objspace.py:24:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
config = <rpython.config.config.Config object at 0x0000010aa78dafa8>
def maketestobjspace(config=None):
if config is None:
config = make_config(option)
if config.objspace.usemodules.thread:
config.translation.thread = True
config.objspace.extmodules = 'pypy.tool.pytest.fake_pytest'
> space = make_objspace(config)
tool\pytest\objspace.py:34:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
config = <rpython.config.config.Config object at 0x0000010aa78dafa8>
def make_objspace(config):
from pypy.objspace.std.objspace import StdObjSpace
> return StdObjSpace(config)
tool\option.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
config = <rpython.config.config.Config object at 0x0000010aa78dafa8>
@not_rpython
def __init__(self, config=None):
"Basic initialization of objects."
self.w_default_importlib_import = None
self.fromcache = InternalSpaceCache(self).getorbuild
self.threadlocals = ThreadLocals()
# set recursion limit
# sets all the internal descriptors
if config is None:
from pypy.config.pypyoption import get_pypy_config
config = get_pypy_config(translating=False)
self.config = config
self.reverse_debugging = config.translation.reverse_debugger
self.builtin_modules = {}
self.reloading_modules = {}
self.interned_strings = make_weak_value_dictionary(self, str, W_Root)
self.actionflag = ActionFlag() # changed by the signal module
self.check_signal_action = None # changed by the signal module
make_finalizer_queue(W_Root, self)
self._code_of_sys_exc_info = None
self._builtin_functions_by_identifier = {'': None}
# can be overridden to a subclass
> self.initialize()
interpreter\baseobjspace.py:458:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
@not_rpython
def initialize(self):
"""only for initializing the space
Setup all the object types and implementations.
"""
setup_prebuilt(self)
self.FrameClass = frame.build_frame(self)
self.StringObjectCls = W_BytesObject
self.UnicodeObjectCls = W_UnicodeObject
self.IntObjectCls = W_IntObject
self.FloatObjectCls = W_FloatObject
# singletons
self.w_None = W_NoneObject.w_None
self.w_False = W_BoolObject.w_False
self.w_True = W_BoolObject.w_True
self.w_NotImplemented = self.wrap(special.NotImplemented())
self.w_Ellipsis = self.wrap(special.Ellipsis())
self.w_DisallowNew = self.wrap(special.DisallowNew())
# types
builtin_type_classes = {
W_BoolObject.typedef: W_BoolObject,
W_BytearrayObject.typedef: W_BytearrayObject,
W_BytesObject.typedef: W_BytesObject,
W_ComplexObject.typedef: W_ComplexObject,
W_DictMultiObject.typedef: W_DictMultiObject,
W_FloatObject.typedef: W_FloatObject,
W_IntObject.typedef: W_AbstractIntObject,
W_AbstractSeqIterObject.typedef: W_AbstractSeqIterObject,
W_ListObject.typedef: W_ListObject,
W_MemoryView.typedef: W_MemoryView,
W_NoneObject.typedef: W_NoneObject,
W_ObjectObject.typedef: W_ObjectObject,
W_SetObject.typedef: W_SetObject,
W_FrozensetObject.typedef: W_FrozensetObject,
W_SliceObject.typedef: W_SliceObject,
W_TupleObject.typedef: W_TupleObject,
W_TypeObject.typedef: W_TypeObject,
W_UnicodeObject.typedef: W_UnicodeObject,
}
self.builtin_types = {}
self._interplevel_classes = {}
for typedef, cls in builtin_type_classes.items():
w_type = self.gettypeobject(typedef)
self.builtin_types[typedef.name] = w_type
setattr(self, 'w_' + typedef.name, w_type)
self._interplevel_classes[w_type] = cls
# The loop above sets space.w_str and space.w_bytes.
# We rename 'space.w_str' to 'space.w_unicode' and
# 'space.w_text'.
self.w_unicode = self.w_str
self.w_text = self.w_str
del self.w_str
self.w_long = self.w_int
self.w_dict.flag_map_or_seq = 'M'
from pypy.objspace.std import dictproxyobject
dictproxyobject._set_flag_map_or_seq(self)
self.w_list.flag_map_or_seq = 'S'
self.w_tuple.flag_map_or_seq = 'S'
self.builtin_types['str'] = self.w_unicode
self.builtin_types['bytes'] = self.w_bytes
self.builtin_types["NotImplemented"] = self.w_NotImplemented
self.builtin_types["Ellipsis"] = self.w_Ellipsis
# exceptions & builtins
> self.make_builtins()
objspace\std\objspace.py:115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
@not_rpython
def make_builtins(self):
"only for initializing the space."
from pypy.module.exceptions.moduledef import Module
w_name = self.newtext('__exceptions__')
self.exceptions_module = Module(self, w_name)
self.exceptions_module.install()
from pypy.module.imp.moduledef import Module
w_name = self.newtext('_imp')
> mod = Module(self, w_name)
interpreter\baseobjspace.py:637:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.imp.moduledef.Module object at 0x0000010aa786d018>
space = StdObjSpace, args = (W_UnicodeObject('_imp'),)
add_fork_hook = <function add_fork_hook at 0x0000010aa79672e0>
def __init__(self, space, *args):
"NOT_RPYTHON"
MixedModule.__init__(self, space, *args)
from pypy.module.posix.interp_posix import add_fork_hook
> from pypy.module.imp import interp_imp
module\imp\moduledef.py:44:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> from pypy.module.imp import importing
module\imp\interp_imp.py:1:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
"""
Implementation of the interpreter-level default import logic.
"""
import sys, os, stat, re, platform
from pypy.interpreter.module import Module, init_extra_module_attrs
from pypy.interpreter.gateway import interp2app, unwrap_spec
from pypy.interpreter.typedef import TypeDef, generic_new_descr
from pypy.interpreter.error import OperationError, oefmt, wrap_oserror
from pypy.interpreter.baseobjspace import W_Root, CannotHaveLock
from pypy.interpreter.eval import Code
from pypy.interpreter.pycode import PyCode
> from rpython.rlib import streamio, jit
module\imp\importing.py:14:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
"""New standard I/O library.
Based on sio.py from Guido van Rossum.
- This module contains various stream classes which provide a subset of the
classic Python I/O API: read(n), write(s), tell(), seek(offset, whence=0),
readall(), readline(), truncate(size), flush(), close(), peek(),
flushable(), try_to_find_file_descriptor().
- This is not for general usage:
* read(n) may return less than n bytes, just like os.read().
* some other methods also have no default parameters.
* close() should be called exactly once and no further operations performed;
there is no __del__() closing the stream for you.
* some methods may raise MyNotImplementedError.
* peek() returns some (or no) characters that have already been read ahead.
* flushable() returns True/False if flushing that stream is useful/pointless.
- A 'basis stream' provides I/O using a low-level API, like the os, mmap or
socket modules.
- A 'filtering stream' builds on top of another stream. There are filtering
streams for universal newline translation, for unicode translation, and
for buffering.
You typically take a basis stream, place zero or more filtering
streams on top of it, and then top it off with an input-buffering and/or
an outout-buffering stream.
"""
# File offsets are all 'r_longlong', but a single read or write cannot
# transfer more data that fits in an RPython 'int' (because that would not
# fit in a single string anyway). This module needs to be careful about
# where r_longlong values end up: as argument to seek() and truncate() and
# return value of tell(), but not as argument to read().
import os, sys, errno
from rpython.rlib.objectmodel import specialize, we_are_translated, not_rpython
from rpython.rlib.rarithmetic import r_longlong, intmask
> from rpython.rlib import rposix, nonconst, _rsocket_rffi as _c
..\rpython\rlib\streamio.py:40:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
from rpython.rtyper.lltypesystem import rffi
from rpython.rtyper.lltypesystem import lltype
from rpython.rtyper.tool import rffi_platform as platform
from rpython.rtyper.lltypesystem.rffi import CCHARP, CONST_CCHARP
from rpython.rlib import jit
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.translator.platform import platform as target_platform
from rpython.rlib.rarithmetic import intmask, r_uint, widen
import os,sys
from textwrap import dedent
_POSIX = os.name == "posix"
_WIN32 = sys.platform == "win32"
_MSVC = target_platform.name == "msvc"
_MINGW = target_platform.name == "mingw32"
_SOLARIS = sys.platform == "sunos5"
_MACOSX = sys.platform == "darwin"
_HAS_AF_PACKET = sys.platform.startswith('linux') # only Linux for now
if _POSIX:
includes = ('sys/types.h',
'sys/socket.h',
'sys/un.h',
'poll.h',
'sys/select.h',
'sys/types.h',
'netinet/in.h',
'netinet/tcp.h',
'unistd.h',
'fcntl.h',
'stdio.h',
'netdb.h',
'arpa/inet.h',
'stdint.h',
'errno.h',
'limits.h',
'net/if.h',
)
if _HAS_AF_PACKET:
includes += ('netpacket/packet.h',
'sys/ioctl.h',
)
cond_includes = [('AF_NETLINK', 'linux/netlink.h')]
cond_includes += [('AF_ALG', 'linux/if_alg.h')]
cond_includes += [('AF_QIPCRTR', 'linux/qrtr.h')]
libraries = ()
calling_conv = 'c'
HEADER = ''.join(['#include <%s>\n' % filename for filename in includes])
COND_HEADER = ''.join(['#ifdef %s\n#include <%s>\n#endif\n' % cond_include
for cond_include in cond_includes])
if _SOLARIS:
libraries = libraries + ('socket', 'nsl')
if _WIN32:
includes = ()
libraries = ('ws2_32', 'Iphlpapi')
calling_conv = 'win'
header_lines = [
'#include <WinSock2.h>',
'#include <WS2tcpip.h>',
# winsock2 defines AF_UNIX, but not sockaddr_un
'#undef AF_UNIX',
]
if _MSVC:
header_lines.extend([
'#include <Mstcpip.h>',
# these types do not exist on microsoft compilers
'#ifdef _WIN64',
'typedef long long ssize_t;',
'typedef unsigned long long size_t;',
'#else',
'typedef int ssize_t;',
'typedef unsigned int size_t;',
'#endif',
'typedef unsigned __int16 uint16_t;',
'typedef unsigned __int32 uint32_t;',
])
else: # MINGW
includes = ('stdint.h',)
header_lines.extend([
'''\
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif''',
'#define SIO_RCVALL _WSAIOW(IOC_VENDOR,1)',
'#define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4)',
'#define RCVALL_OFF 0',
'#define RCVALL_ON 1',
'#define RCVALL_SOCKETLEVELONLY 2',
'''\
#ifndef __MINGW32__
struct tcp_keepalive {
u_long onoff;
u_long keepalivetime;
u_long keepaliveinterval;
};
#endif
'''
])
HEADER = '\n'.join(header_lines)
COND_HEADER = ''
constants = {}
eci = ExternalCompilationInfo(
post_include_bits = [HEADER, COND_HEADER],
includes = includes,
libraries = libraries,
)
class CConfig:
_compilation_info_ = eci
# constants
linux = platform.Defined('linux')
WIN32 = platform.Defined('_WIN32')
O_RDONLY = platform.DefinedConstantInteger('O_RDONLY')
O_WRONLY = platform.DefinedConstantInteger('O_WRONLY')
O_RDWR = platform.DefinedConstantInteger('O_RDWR')
O_NONBLOCK = platform.DefinedConstantInteger('O_NONBLOCK')
F_GETFL = platform.DefinedConstantInteger('F_GETFL')
F_SETFL = platform.DefinedConstantInteger('F_SETFL')
FIONBIO = platform.DefinedConstantInteger('FIONBIO')
PIPE_BUF = platform.DefinedConstantInteger('PIPE_BUF')
INVALID_SOCKET = platform.DefinedConstantInteger('INVALID_SOCKET')
INET_ADDRSTRLEN = platform.DefinedConstantInteger('INET_ADDRSTRLEN')
INET6_ADDRSTRLEN= platform.DefinedConstantInteger('INET6_ADDRSTRLEN')
EINTR = platform.DefinedConstantInteger('EINTR')
WSAEINTR = platform.DefinedConstantInteger('WSAEINTR')
EINPROGRESS = platform.DefinedConstantInteger('EINPROGRESS')
WSAEINPROGRESS = platform.DefinedConstantInteger('WSAEINPROGRESS')
EWOULDBLOCK = platform.DefinedConstantInteger('EWOULDBLOCK')
WSAEWOULDBLOCK = platform.DefinedConstantInteger('WSAEWOULDBLOCK')
EAFNOSUPPORT = platform.DefinedConstantInteger('EAFNOSUPPORT')
WSAEAFNOSUPPORT = platform.DefinedConstantInteger('WSAEAFNOSUPPORT')
EISCONN = platform.DefinedConstantInteger('EISCONN')
WSAEISCONN = platform.DefinedConstantInteger('WSAEISCONN')
constant_names = '''
AF_AAL5 AF_ALG AF_APPLETALK AF_ASH AF_ATMPVC AF_ATMSVC AF_AX25 AF_BLUETOOTH
AF_BRIDGE AF_CAN AD_DECnet AF_DEC AF_DECnet AF_DIVERT AF_ECONET AF_HYPERV
AF_INET AF_INET6 AF_IPX AF_IRDA AF_KEY AF_LINK AF_LLC AF_NETBEUI AF_NETLINK
AF_NETROM AF_PACKET AF_PPPOX AF_QIPCRTR AF_RDS AF_ROSE AF_ROUTE AF_SECURITY
AF_SNA AF_SYSTEM AF_TIPC AF_UNIX AF_VSOCK AF_WANPIPE AF_X25 AF_UNSPEC
AI_ADDRCONFIG AI_ALL AI_CANONNAME AI_DEFAULT AI_MASK AI_NUMERICHOST
AI_NUMERICSERV AI_PASSIVE AI_V4MAPPED AI_V4MAPPED_CFG
BTPROTO_HCI BTPROTO_L2CAP BTPROTO_SCO BTPROTO_RFCOMM
ALG_OP_DECRYPT ALG_OP_ENCRYPT ALG_OP_SIGN ALG_OP_VERIFY ALG_SET_AEAD_ASSOCLEN
ALG_SET_AEAD_AUTHSIZE ALG_SET_IV ALG_SET_KEY ALG_SET_OP ALG_SET_PUBKEY SOL_ALG
HCI_DATA_DIR HCI_FILTER HCI_TIME_STAMP
HV_PROTOCOL_RAW
HVSOCKET_ADDRESS_FLAG_PASSTHRU HVSOCKET_CONNECTED_SUSPEND
HVSOCKET_CONNECT_TIMEOUT HVSOCKET_CONNECT_TIMEOUT_MAX
INADDR_ALLHOSTS_GROUP INADDR_ANY INADDR_BROADCAST INADDR_LOOPBACK
INADDR_MAX_LOCAL_GROUP INADDR_NONE INADDR_UNSPEC_GROUP
IOCTL_VM_SOCKETS_GET_LOCAL_CID
EAI_ADDRFAMILY EAI_AGAIN EAI_BADFLAGS EAI_BADHINTS EAI_FAIL EAI_FAMILY EAI_MAX
EAI_MEMORY EAI_NODATA EAI_NONAME EAI_OVERFLOW EAI_PROTOCOL EAI_SERVICE
EAI_SOCKTYPE EAI_SYSTEM
IPPROTO_AH IPPROTO_BIP IPPROTO_CBT IPPROTO_DSTOPTS IPPROTO_EGP IPPROTO_EON IPPROTO_ESP
IPPROTO_FRAGMENT IPPROTO_GGP IPPROTO_GRE IPPROTO_HELLO IPPROTO_HOPOPTS IPPROTO_ICLFXBM
IPPROTO_ICMPV6 IPPROTO_IDP IPPROTO_IGP IPPROTO_IGMP IPPROTO_IPCOMP IPPROTO_IPIP
IPPROTO_IPV4 IPPROTO_IPV6 IPPROTO_L2TP IPPROTO_MAX IPPROTO_MOBILE IPPROTO_ND IPPROTO_NONE
IPPROTO_PGM IPPROTO_PIM IPPROTO_PUP IPPROTO_RDP IPPROTO_ROUTING IPPROTO_RSVP
IPPROTO_MPTCP IPPROTO_ST IPPROTO_TCP IPPROTO_TP IPPROTO_UDPLITE IPPROTO_VRRP IPPROTO_XTP IPPROTO_SCTP
IPV6_CHECKSUM IPV6_DONTFRAG IPV6_DSTOPTS IPV6_HOPLIMIT IPV6_HOPOPTS
IPV6_JOIN_GROUP IPV6_LEAVE_GROUP IPV6_MULTICAST_HOPS IPV6_MULTICAST_IF
IPV6_MULTICAST_LOOP IPV6_NEXTHOP IPV6_PATHMTU IPV6_PKTINFO IPV6_RECVDSTOPTS
IPV6_RECVHOPLIMIT IPV6_RECVHOPOPTS IPV6_RECVPATHMTU IPV6_RECVPKTINFO
IPV6_RECVRTHDR IPV6_RECVTCLASS IPV6_RTHDR IPV6_RTHDRDSTOPTS IPV6_RTHDR_TYPE_0
IPV6_TCLASS IPV6_UNICAST_HOPS IPV6_USE_MIN_MTU IPV6_V6ONLY
IP_ADD_MEMBERSHIP IP_ADD_SOURCE_MEMBERSHIP IP_BIND_ADDRESS_NO_PORT IP_BLOCK_SOURCE
IP_DEFAULT_MULTICAST_LOOP IP_DEFAULT_MULTICAST_TTL
IP_DROP_MEMBERSHIP IP_DROP_SOURCE_MEMBERSHIP IP_HDRINCL IP_MAX_MEMBERSHIPS
IP_MULTICAST_IF IP_MULTICAST_LOOP IP_MULTICAST_TTL IP_OPTIONS IP_PKTINFO
IP_RECVDSTADDR IP_RECVOPTS IP_RECVRETOPTS IP_RECVTOS IP_RETOPTS
IP_TOS IP_TRANSPARENT IP_TTL IP_UNBLOCK_SOURCE
MSG_BCAST MSG_BTAG MSG_CMSG_CLOEXEC MSG_CONFIRM MSG_CTRUNC MSG_DONTROUTE
MSG_DONTWAIT MSG_EOF MSG_ERRQUEUE MSG_EOR MSG_ETAG MSG_FASTOPEN MSG_MCAST
MSG_MORE MSG_NOSIGNAL MSG_NOTIFICATION MSG_OOB MSG_PEEK MSG_TRUNC MSG_WAITALL
NI_DGRAM NI_IDN NI_MAXHOST NI_MAXSERV NI_NAMEREQD NI_NOFQDN NI_NUMERICHOST
NI_NUMERICSERV
NETLINK_ARPD NETLINK_CRYPTO NETLINK_DNRTMSG NETLINK_FIREWALL NETLINK_IP6_FW
NETLINK_NFLOG NETLINK_ROUTE NETLINK_ROUTE6 NETLINK_SKIP NETLINK_TAPBASE
NETLINK_TCPDIAG NETLINK_USERSOCK NETLINK_W1 NETLINK_XFRM
PACKET_HOST PACKET_BROADCAST PACKET_MULTICAST PACKET_OTHERHOST PACKET_OUTGOING
PACKET_LOOPBACK PACKET_FASTROUTE
PF_CAN PF_DIVERT PF_PACKET PF_RDS PF_SYSTEM
RCVALL_IPLEVEL RCVALL_MAX RCVALL_OFF RCVALL_ON RCVALL_SOCKETLEVELONLY
RDS_CANCEL_SENT_TO RDS_CMSG_RDMA_ARGS RDS_CMSG_RDMA_DEST RDS_CMSG_RDMA_MAP
RDS_CMSG_RDMA_STATUS RDS_CMSG_RDMA_UPDATE RDS_CONG_MONITOR RDS_FREE_MR
RDS_GET_MR RDS_GET_MR_FOR_DEST RDS_RDMA_DONTWAIT RDS_RDMA_FENCE
RDS_RDMA_INVALIDATE RDS_RDMA_NOTIFY_ME RDS_RDMA_READWRITE RDS_RDMA_SILENT
RDS_RDMA_USE_ONCE RDS_RECVERR
SOCK_DGRAM SOCK_RAW SOCK_RDM SOCK_SEQPACKET SOCK_STREAM
SOCK_CLOEXEC SOCK_NONBLOCK
SOL_SOCKET SOL_IPX SOL_AX25 SOL_ATALK SOL_NETROM SOL_ROSE
SO_ACCEPTCONN SO_BINDTODEVICE SO_BINDTOIFINDEX SO_BROADCAST SO_DEBUG
SO_DOMAIN SO_DONTROUTE SO_ERROR SO_EXCLUSIVEADDRUSE SO_INCOMING_CPU
SO_J1939_ERRQUEUE SO_J1939_FILTER SO_J1939_PROMISC SO_J1939_SEND_PRIO
SO_KEEPALIVE SO_LINGER SO_MARK SO_OOBINLINE SO_PASSCRED SO_PASSSEC
SO_PEERCRED SO_PEERSEC SO_PRIORITY SO_PROTOCOL
SO_RCVBUF SO_RCVLOWAT SO_RCVTIMEO SO_REUSEADDR SO_REUSEPORT SO_RTABLE
SO_SETFIB SO_SNDBUF SO_SNDLOWAT SO_SNDTIMEO SO_TYPE SO_USELOOPBACK
SO_USER_COOKIE SO_VM_SOCKETS_BUFFER_MAX_SIZE SO_VM_SOCKETS_BUFFER_MIN_SIZE
SO_VM_SOCKETS_BUFFER_SIZE
SIO_KEEPALIVE_VALS SIO_LOOPBACK_FAST_PATH SIO_RCVALL
SYSPROTO_CONTROL
TCP_CC_INFO TCP_CONGESTION TCP_CONNECTION_INFO TCP_CORK TCP_DEFER_ACCEPT
TCP_FASTOPEN TCP_FASTOPEN_CONNECT TCP_FASTOPEN_KEY TCP_FASTOPEN_NO_COOKIE
TCP_INFO TCP_INQ TCP_KEEPALIVE TCP_KEEPCNT TCP_KEEPIDLE TCP_KEEPINTVL
TCP_LINGER2 TCP_MAXSEG TCP_MD5SIG TCP_MD5SIG_EXT TCP_NODELAY
TCP_NOTSENT_LOWAT TCP_QUEUE_SEQ TCP_QUICKACK TCP_REPAIR TCP_REPAIR_OPTIONS
TCP_REPAIR_QUEUE TCP_REPAIR_WINDOW TCP_SAVED_SYN TCP_SAVE_SYN TCP_SYNCNT
TCP_THIN_DUPACK TCP_THIN_LINEAR_TIMEOUTS TCP_TIMESTAMP TCP_TX_DELAY TCP_ULP
TCP_USER_TIMEOUT TCP_WINDOW_CLAMP TCP_ZEROCOPY_RECEIVE
IPX_TYPE
LOCAL_CREDS LOCAL_CREDS_PERSISTENT LOCAL_PEERCRED
SCM_CREDENTIALS SCM_CREDS SCM_CREDS2 SCM_J1939_DEST_ADDR SCM_J1939_DEST_NAME
SCM_J1939_ERRQUEUE SCM_J1939_PRIO SCM_RIGHTS
CAN_BCM CAN_BCM_CAN_FD_FRAME CAN_BCM_RX_ANNOUNCE_RESUME CAN_BCM_RX_CHANGED
CAN_BCM_RX_CHECK_DLC CAN_BCM_RX_DELETE CAN_BCM_RX_FILTER_ID
CAN_BCM_RX_NO_AUTOTIMER CAN_BCM_RX_READ CAN_BCM_RX_RTR_FRAME CAN_BCM_RX_SETUP
CAN_BCM_RX_STATUS CAN_BCM_RX_TIMEOUT CAN_BCM_SETTIMER CAN_BCM_STARTTIMER
CAN_BCM_TX_ANNOUNCE CAN_BCM_TX_COUNTEVT CAN_BCM_TX_CP_CAN_ID CAN_BCM_TX_DELETE
CAN_BCM_TX_EXPIRED CAN_BCM_TX_READ CAN_BCM_TX_RESET_MULTI_IDX CAN_BCM_TX_SEND
CAN_BCM_TX_SETUP CAN_BCM_TX_STATUS
CAN_EFF_FLAG CAN_EFF_MASK CAN_ERR_FLAG CAN_ERR_MASK CAN_ISOTP CAN_J1939 CAN_RAW
CAN_RAW_ERR_FILTER CAN_RAW_FD_FRAMES CAN_RAW_FILTER CAN_RAW_JOIN_FILTERS
CAN_RAW_LOOPBACK CAN_RAW_RECV_OWN_MSGS CAN_RTR_FLAG CAN_SFF_MASK
J1939_EE_INFO_NONE J1939_EE_INFO_TX_ABORT J1939_FILTER_MAX J1939_IDLE_ADDR
J1939_MAX_UNICAST_ADDR J1939_NLA_BYTES_ACKED J1939_NLA_PAD J1939_NO_ADDR
J1939_NO_NAME J1939_NO_PGN J1939_PGN_ADDRESS_CLAIMED
J1939_PGN_ADDRESS_COMMANDED J1939_PGN_MAX J1939_PGN_PDU1_MAX J1939_PGN_REQUEST
ETH_P_ALL ETHERTYPE_ARP ETHERTYPE_IP ETHERTYPE_IPV6 ETHERTYPE_VLAN
UDPLITE_RECV_CSCOV UDPLITE_SEND_CSCOV
TIPC_ADDR_ID TIPC_ADDR_NAME TIPC_ADDR_NAMESEQ TIPC_CFG_SRV TIPC_CLUSTER_SCOPE
TIPC_CONN_TIMEOUT TIPC_CRITICAL_IMPORTANCE TIPC_DEST_DROPPABLE
TIPC_HIGH_IMPORTANCE TIPC_IMPORTANCE TIPC_LOW_IMPORTANCE TIPC_MEDIUM_IMPORTANCE
TIPC_NODE_SCOPE TIPC_PUBLISHED TIPC_SRC_DROPPABLE TIPC_SUBSCR_TIMEOUT
TIPC_SUB_CANCEL TIPC_SUB_PORTS TIPC_SUB_SERVICE TIPC_TOP_SRV TIPC_WAIT_FOREVER
TIPC_WITHDRAWN TIPC_ZONE_SCOPE
VMADDR_CID_ANY VMADDR_CID_HOST VMADDR_PORT_ANY VM_SOCKETS_INVALID_VERSION
POLLIN POLLPRI POLLOUT POLLERR POLLHUP POLLNVAL
POLLRDNORM POLLRDBAND POLLWRNORM POLLWEBAND POLLMSG
FD_READ FD_WRITE FD_ACCEPT FD_CONNECT FD_CLOSE
WSA_WAIT_TIMEOUT WSA_WAIT_FAILED INFINITE
FD_CONNECT_BIT FD_CLOSE_BIT
WSA_IO_PENDING WSA_IO_INCOMPLETE WSA_INVALID_HANDLE
WSA_INVALID_PARAMETER WSA_NOT_ENOUGH_MEMORY WSA_OPERATION_ABORTED
WSA_FLAG_OVERLAPPED WSA_FLAG_NO_HANDLE_INHERIT
SIO_RCVALL SIO_KEEPALIVE_VALS
SIOCGIFNAME SIOCGIFINDEX
SO_DOMAIN SO_PROTOCOL SO_PEERSEC SO_PASSSEC TCP_USER_TIMEOUT TCP_CONGESTION TCP_NOTSENT_LOWAT
'''.split()
for name in constant_names:
setattr(CConfig, name, platform.DefinedConstantInteger(name))
if _WIN32:
# some SDKs define these values with an enum, #ifdef won't work
for name in ('RCVALL_ON', 'RCVALL_OFF', 'RCVALL_SOCKETLEVELONLY', 'TCP_FASTOPEN'):
setattr(CConfig, name, platform.ConstantInteger(name))
constant_names.append(name)
constants["BDADDR_ANY"] = "00:00:00:00:00:00"
constants["BDADDR_LOCAL"] = "00:00:00:FF:FF:FF"
constants_w_defaults = [('SOL_IP', 0),
('SOL_TCP', 6),
('SOL_UDP', 17),
('SOMAXCONN', 5),
('IPPROTO_IP', 6),
('IPPROTO_IPV6', 41),
('IPPROTO_ICMP', 1),
('IPPROTO_TCP', 6),
('IPPROTO_UDP', 17),
('IPPROTO_RAW', 255),
('IPPORT_RESERVED', 1024),
('IPPORT_USERRESERVED', 5000),
('INADDR_ANY', 0x00000000),
('INADDR_BROADCAST', 0xffffffff),
('INADDR_LOOPBACK', 0x7F000001),
('INADDR_UNSPEC_GROUP', 0xe0000000),
('INADDR_ALLHOSTS_GROUP', 0xe0000001),
('INADDR_MAX_LOCAL_GROUP', 0xe00000ff),
('INADDR_NONE', 0xffffffff),
('SHUT_RD', 0),
('SHUT_WR', 1),
('SHUT_RDWR', 2),
('POLLIN', 1),
('POLLPRI', 2),
('POLLOUT', 4),
('POLLERR', 8),
('POLLHUP', 16),
('FD_SETSIZE', 64),
]
for name, default in constants_w_defaults:
setattr(CConfig, name, platform.DefinedConstantInteger(name))
# types
if _MSVC:
socketfd_type = lltype.Unsigned
else:
socketfd_type = rffi.INT_real
CConfig.uint16_t = platform.SimpleType('uint16_t', rffi.USHORT)
CConfig.uint32_t = platform.SimpleType('uint32_t', rffi.UINT)
CConfig.size_t = platform.SimpleType('size_t', rffi.INT)
CConfig.ssize_t = platform.SimpleType('ssize_t', rffi.INT)
CConfig.socklen_t = platform.SimpleType('socklen_t', rffi.UINT_real)
sockaddr_ptr = lltype.Ptr(lltype.ForwardReference())
addrinfo_ptr = lltype.Ptr(lltype.ForwardReference())
# struct types
CConfig.sockaddr = platform.Struct('struct sockaddr',
[('sa_family', rffi.INT),
('sa_data', rffi.CFixedArray(rffi.CHAR, 1)),
])
CConfig.in_addr = platform.Struct('struct in_addr',
[('s_addr', rffi.UINT)])
CConfig.in6_addr = platform.Struct('struct in6_addr',
[('s6_addr', rffi.CFixedArray(rffi.CHAR, 16))])
CConfig.sockaddr_in = platform.Struct('struct sockaddr_in',
[('sin_family', rffi.INT),
('sin_port', rffi.USHORT),
('sin_addr', CConfig.in_addr)])
CConfig.sockaddr_in6 = platform.Struct('struct sockaddr_in6',
[('sin6_family', rffi.INT),
('sin6_port', rffi.USHORT),
('sin6_flowinfo', rffi.INT),
('sin6_addr', CConfig.in6_addr),
('sin6_scope_id', rffi.INT)])
CConfig.sockaddr_un = platform.Struct('struct sockaddr_un',
[('sun_family', rffi.INT),
('sun_path', rffi.CFixedArray(rffi.CHAR, 1))],
ifdef='AF_UNIX')
CConfig.sockaddr_nl = platform.Struct('struct sockaddr_nl',
[('nl_family', rffi.INT),
('nl_pid', rffi.INT),
('nl_groups', rffi.INT)],
ifdef='AF_NETLINK')
CConfig.sockaddr_alg = platform.Struct('struct sockaddr_alg',
[('salg_family', rffi.INT),
('salg_type', rffi.CFixedArray(rffi.CHAR, 14)),
('salg_feat', rffi.SHORT),
('salg_mask', rffi.SHORT),
('salg_name', rffi.CFixedArray(rffi.CHAR, 64)),
], ifdef='AF_ALG')
CConfig.sockaddr_qrtr = platform.Struct('struct sockaddr_qrtr',
[('sq_family', rffi.INT),
('sq_node', rffi.INT),
('sq_port', rffi.INT),
], ifdef='AF_QIPCRTR')
CConfig.addrinfo = platform.Struct('struct addrinfo',
[('ai_flags', rffi.INT),
('ai_family', rffi.INT),
('ai_socktype', rffi.INT),
('ai_protocol', rffi.INT),
('ai_addrlen', rffi.INT),
('ai_addr', sockaddr_ptr),
('ai_canonname', CCHARP),
('ai_next', addrinfo_ptr)])
CConfig.hostent = platform.Struct('struct hostent',
[('h_name', CCHARP),
('h_aliases', rffi.CCHARPP),
('h_addrtype', rffi.INT),
('h_length', rffi.INT),
('h_addr_list', rffi.CCHARPP),
])
CConfig.servent = platform.Struct('struct servent',
[('s_name', CCHARP),
('s_port', rffi.INT),
('s_proto', CCHARP),
])
CConfig.protoent = platform.Struct('struct protoent',
[('p_proto', rffi.INT),
])
CConfig.HAVE_ACCEPT4 = platform.Has('accept4')
if _POSIX:
CConfig.nfds_t = platform.SimpleType('nfds_t')
CConfig.pollfd = platform.Struct('struct pollfd',
[('fd', socketfd_type),
('events', rffi.SHORT),
('revents', rffi.SHORT)])
CConfig.if_nameindex_s = platform.Struct('struct if_nameindex',
[('if_index', rffi.UINT),
('if_name', rffi.CCHARP)])
if _HAS_AF_PACKET:
CConfig.sockaddr_ll = platform.Struct('struct sockaddr_ll',
[('sll_family', rffi.INT),
('sll_ifindex', rffi.INT),
('sll_protocol', rffi.INT),
('sll_pkttype', rffi.INT),
('sll_hatype', rffi.INT),
('sll_addr', rffi.CFixedArray(rffi.UCHAR, 8)),
('sll_halen', rffi.INT)])
CConfig.ifreq = platform.Struct('struct ifreq',
[('ifr_ifindex', rffi.INT),
('ifr_name', rffi.CFixedArray(rffi.CHAR, 8))])
else:
CConfig.if_nameindex_s = rffi.CStruct('if_nameindex',
('if_index', rffi.UINT),
('if_name', rffi.CCHARP))
includes = []
separate_module_sources = []
post_include_bits = []
# insert handler for sendmsg / recvmsg here
HAVE_SENDMSG = bool(_POSIX)
if HAVE_SENDMSG:
includes += ['stddef.h',
'sys/socket.h',
'unistd.h',
'string.h',
'stdlib.h',
'errno.h',
'limits.h',
'stdio.h',
'sys/types.h',
'netinet/in.h',
'arpa/inet.h']
separate_module_sources += ['''
// special defines for returning from recvmsg
#define BAD_MSG_SIZE_GIVEN -10000
#define BAD_ANC_SIZE_GIVEN -10001
#define MAL_ANC -10002
// special defines for returning from sendmsg
#define MUL_MSGS_NOT_SUP -1000
#define ANC_DATA_TOO_LARGE -1001
#define ANC_DATA_TOO_LARGEX -1002
#if INT_MAX > 0x7fffffff
#define SOCKLEN_T_LIMIT 0x7fffffff
#else
#define SOCKLEN_T_LIMIT INT_MAX
#endif
// #########################################################################
// Recvmsg implementation and associated functions
// Taken from CPython. Determines the minimum memory space required for the ancillary data.
#ifdef CMSG_SPACE
static int
cmsg_min_space(struct msghdr *msg, struct cmsghdr *cmsgh, size_t space)
{
size_t cmsg_offset;
static const size_t cmsg_len_end = (offsetof(struct cmsghdr, cmsg_len) +
sizeof(cmsgh->cmsg_len));
/* Note that POSIX allows msg_controllen to be of signed type. */
if (cmsgh == NULL || msg->msg_control == NULL)
return 0;
/* Note that POSIX allows msg_controllen to be of a signed type. This is
annoying under OS X as it's unsigned there and so it triggers a
tautological comparison warning under Clang when compared against 0.
Since the check is valid on other platforms, silence the warning under
Clang. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-compare"
#endif
#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wtype-limits"
#endif
if (msg->msg_controllen < 0)
return 0;
#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))
#pragma GCC diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
if (space < cmsg_len_end)
space = cmsg_len_end;
cmsg_offset = (char *)cmsgh - (char *)msg->msg_control;
return (cmsg_offset <= (size_t)-1 - space &&
cmsg_offset + space <= msg->msg_controllen);
}
#endif
// Taken from CPython.
#ifdef CMSG_LEN
/* If pointer CMSG_DATA(cmsgh) is in buffer msg->msg_control, set
*space to number of bytes following it in the buffer and return
true; otherwise, return false. Assumes cmsgh, msg->msg_control and
msg->msg_controllen are valid. */
static int
get_cmsg_data_space(struct msghdr *msg, struct cmsghdr *cmsgh, size_t *space)
{
size_t data_offset;
char *data_ptr;
if ((data_ptr = (char *)CMSG_DATA(cmsgh)) == NULL)
return 0;
data_offset = data_ptr - (char *)msg->msg_control;
if (data_offset > msg->msg_controllen)
return 0;
*space = msg->msg_controllen - data_offset;
return 1;
}
// Taken from CPython.
/* If cmsgh is invalid or not contained in the buffer pointed to by
msg->msg_control, return -1. If cmsgh is valid and its associated
data is entirely contained in the buffer, set *data_len to the
length of the associated data and return 0. If only part of the
associated data is contained in the buffer but cmsgh is otherwise
valid, set *data_len to the length contained in the buffer and
return 1. */
static int
get_cmsg_data_len(struct msghdr *msg, struct cmsghdr *cmsgh, size_t *data_len)
{
size_t space, cmsg_data_len;
if (!cmsg_min_space(msg, cmsgh, CMSG_LEN(0)) ||
cmsgh->cmsg_len < CMSG_LEN(0))
return -1;
cmsg_data_len = cmsgh->cmsg_len - CMSG_LEN(0);
if (!get_cmsg_data_space(msg, cmsgh, &space))
return -1;
if (space >= cmsg_data_len) {
*data_len = cmsg_data_len;
return 0;
}
*data_len = space;
return 1;
}
#endif /* CMSG_LEN */
/*
Structure meant to hold the information received after a recvmsg is performed.
Essentially it holds: the address, the message, the ancillary data and the return flags.
I use this structure for 2 main reasons:
- keep things ordered
- some of the ancillary parameters need to be int not long (rffi SignedP is actually long*),
therefore I cannot use the parameters directly
*/
struct recvmsg_info
{
struct sockaddr* address; // address fields
socklen_t addrlen;
int size_of_ancillary; // ancillary fields
int* levels;
int* types;
char** file_descr;
int* descr_per_ancillary;
int retflag; // return flag field
};
/*
Wrapper function over recvmsg. Since it returns a lot of data,
in a structure that is hard to parse in rffi, it was implemented in C.
All the parameters, save the socket fd, message_size, ancillary_size
will be malloc'd and/or modified.
*/
RPY_EXTERN
int recvmsg_implementation(
int socket_fd,
int ancillary_size,
int flags,
struct sockaddr* address,
socklen_t* addrlen,
int* message_lengths,
char** messages,
int no_of_messages,
long* size_of_ancillary,
long** levels,
long** types,
char** file_descr,
long** descr_per_ancillary,
long* retflag)
{
struct sockaddr* recvd_address;
socklen_t recvd_addrlen;
struct msghdr msg = {0};
void *controlbuf = NULL;
struct cmsghdr *cmsgh;
int cmsg_status;
struct recvmsg_info* retinfo;
int error_flag = 0; // variable to be set in case of special errors.
int cmsgdatalen = 0;
size_t i;
// variables that are set to 1, if the message charp has been allocated
// and if the ancillary variables have been allocated. To be used in case of failure.
int iov_alloc = 0;
int anc_alloc = 0;
retinfo = (struct recvmsg_info*) malloc(sizeof(struct recvmsg_info));
if (ancillary_size > SOCKLEN_T_LIMIT){
error_flag = BAD_ANC_SIZE_GIVEN;
goto fail;
}
// Add the message
struct iovec *iovs = NULL;
if (no_of_messages > 0) {
iovs = (struct iovec*) malloc(no_of_messages * sizeof(struct iovec));
memset(iovs, 0, no_of_messages * sizeof(struct iovec));
for (i=0; i < no_of_messages; i++) {
iovs[i].iov_base = messages[i];
iovs[i].iov_len = message_lengths[i];
}
}
// Setup the ancillary buffer memory
controlbuf = malloc(ancillary_size);
// Setup the recv address memory
recvd_addrlen = sizeof(struct sockaddr_storage);
recvd_address = (struct sockaddr*) malloc(recvd_addrlen);
memset(recvd_address, 0,recvd_addrlen);
// Setup the msghdr struct
msg.msg_name = recvd_address;
msg.msg_namelen = recvd_addrlen;
msg.msg_iov = iovs;
msg.msg_iovlen = no_of_messages;
msg.msg_control = controlbuf;
msg.msg_controllen = ancillary_size;
// Link my structure to the msghdr fields
retinfo->address = msg.msg_name;
iov_alloc = 1;
ssize_t bytes_recvd = 0;
bytes_recvd = recvmsg(socket_fd, &msg, flags);
if (bytes_recvd < 0){
goto fail;
}
retinfo->addrlen = (socklen_t) msg.msg_namelen;
// Count the ancillary items & allocate the memory
int anc_counter = 0;
for (cmsgh = ((msg.msg_controllen > 0) ? CMSG_FIRSTHDR(&msg) : NULL);
cmsgh != NULL; cmsgh = CMSG_NXTHDR(&msg, cmsgh)) {
anc_counter++;
}
retinfo->size_of_ancillary = anc_counter;
retinfo->file_descr = (char**) malloc (anc_counter * sizeof(char*));
retinfo->levels = (int*) malloc(anc_counter * sizeof(int));
retinfo->types = (int*) malloc(anc_counter * sizeof(int));
retinfo->descr_per_ancillary = (int*) malloc(anc_counter * sizeof(int));
anc_alloc = 1;
// Extract the ancillary items
i=0;
for (cmsgh = ((msg.msg_controllen > 0) ? CMSG_FIRSTHDR(&msg) : NULL);
cmsgh != NULL; cmsgh = CMSG_NXTHDR(&msg, cmsgh)) {
size_t local_size = 0;
cmsg_status = get_cmsg_data_len(&msg, cmsgh, &local_size);
if (cmsg_status !=0 ){
error_flag = MAL_ANC;
goto err_closefds;
}
retinfo->file_descr[i] = (char*) malloc(local_size);
memcpy(retinfo->file_descr[i], CMSG_DATA(cmsgh), local_size);
retinfo->levels[i] = cmsgh->cmsg_level;
retinfo->types[i] = cmsgh->cmsg_type;
retinfo->descr_per_ancillary[i] =local_size;
i++;
}
retinfo->retflag = msg.msg_flags;
// Set the parameters of address
memcpy(address,retinfo->address,retinfo->addrlen);
*addrlen = retinfo->addrlen;
// Set the parameters of message
size_of_ancillary[0] = retinfo->size_of_ancillary;
// Set the parameters of ancillary
*levels = (long*) malloc (sizeof(long) * retinfo->size_of_ancillary);
*types = (long*) malloc (sizeof(long) * retinfo->size_of_ancillary);
*descr_per_ancillary = (long*) malloc (sizeof(long) * retinfo->size_of_ancillary);
int counter = 0;
for (i=0; i < retinfo->size_of_ancillary; i++){
counter += retinfo->descr_per_ancillary[i];
// Convert the int* to long*
levels[0][i] = (long) retinfo->levels[i];
types[0][i] = (long) retinfo->types[i];
descr_per_ancillary[0][i] = (long) retinfo->descr_per_ancillary[i];
}
*file_descr = (char*) malloc (sizeof(char) * counter);
memset(*file_descr, 0, sizeof(char) * counter);
counter = 0;
for (i=0; i<retinfo->size_of_ancillary; i++){
memcpy(*file_descr+counter,retinfo->file_descr[i], retinfo->descr_per_ancillary[i]);
counter += retinfo->descr_per_ancillary[i];
}
// Set the retflag
retflag[0] = retinfo->retflag;
// Free the memory
free(retinfo->address);
free(retinfo->levels);
free(retinfo->types);
free(retinfo->descr_per_ancillary);
for (i = 0; i < retinfo->size_of_ancillary; i++)
free(retinfo->file_descr[i]);
free(retinfo->file_descr);
free(retinfo);
free(controlbuf);
if (iovs != NULL)
free(iovs);
return bytes_recvd;
fail:
if (anc_alloc){
free(retinfo->file_descr);
free(retinfo->levels);
free(retinfo->types);
free(retinfo->descr_per_ancillary);
free(retinfo->address);
free(retinfo);
free(controlbuf);
}else{
if (iov_alloc){
free(retinfo->address);
free(controlbuf);
free(retinfo);
}
}
if (iovs != NULL)
free(iovs);
if (error_flag==0) error_flag = -1;
return error_flag;
err_closefds:
// Special case for UNIX sockets. In case file descriptors are received, they need to be closed.
// Taken from CPython
#ifdef SCM_RIGHTS
/* Close all descriptors coming from SCM_RIGHTS, so they don't leak. */
for (cmsgh = ((msg.msg_controllen > 0) ? CMSG_FIRSTHDR(&msg) : NULL);
cmsgh != NULL; cmsgh = CMSG_NXTHDR(&msg, cmsgh)) {
size_t dataleng;
cmsg_status = get_cmsg_data_len(&msg, cmsgh, &dataleng);
cmsgdatalen = (int) dataleng;
if (cmsg_status < 0)
break;
if (cmsgh->cmsg_level == SOL_SOCKET &&
cmsgh->cmsg_type == SCM_RIGHTS) {
size_t numfds;
int *fdp;
numfds = cmsgdatalen / sizeof(int);
fdp = (int *)CMSG_DATA(cmsgh);
while (numfds-- > 0)
close(*fdp++);
}
if (cmsg_status != 0)
break;
}
#endif /* SCM_RIGHTS */
goto fail;
}
// ##########################################################################
// Sendmsg implementation and associated functions
#ifdef CMSG_LEN
static int
get_CMSG_LEN(size_t length, size_t *result)
{
size_t tmp;
if (length > (SOCKLEN_T_LIMIT - CMSG_LEN(0)))
return 0;
tmp = CMSG_LEN(length);
if ((tmp > SOCKLEN_T_LIMIT) || (tmp < length))
return 0;
*result = tmp;
return 1;
}
#endif
#ifdef CMSG_SPACE
/* If length is in range, set *result to CMSG_SPACE(length) and return
true; otherwise, return false. */
static int
get_CMSG_SPACE(size_t length, size_t *result)
{
size_t tmp;
/* Use CMSG_SPACE(1) here in order to take account of the padding
necessary before *and* after the data. */
if (length > (SOCKLEN_T_LIMIT - CMSG_SPACE(1)))
return 0;
tmp = CMSG_SPACE(length);
if ((tmp > SOCKLEN_T_LIMIT) || (tmp < length))
return 0;
*result = tmp;
return 1;
}
#endif
/*
sendmsg_implementation is a wrapper over sendmsg of the API.
It was inspired from the way CPython did their implementation of this.
The main reason that it was written in C, is the struct msghdr,
which contains the ancillary data in a linked list of cmsghdr structures.
It was simpler to use it in C, and then push the simpler types of data via rffi.
*/
RPY_EXTERN
int sendmsg_implementation
(int socket,
struct sockaddr* address,
socklen_t addrlen,
long* length_of_messages,
char** messages,
int no_of_messages,
long* levels,
long* types,
char** file_descriptors,
long* no_of_fds,
int control_length,
int flag
)
{
struct msghdr msg = {0};
struct cmsghdr *cmsg;
void* controlbuf = NULL;
int retval;
size_t i;
// Prepare the msghdr structure for the send:
// Add the address
if (address != NULL) {
msg.msg_name = address;
msg.msg_namelen = addrlen;
}
// Add the message
struct iovec *iovs = NULL;
if (no_of_messages > 0){
iovs = (struct iovec*) malloc(no_of_messages * sizeof(struct iovec));
memset(iovs, 0, no_of_messages * sizeof(struct iovec));
msg.msg_iov = iovs;
msg.msg_iovlen = no_of_messages;
for (i=0; i < no_of_messages; i++){
iovs[i].iov_base = messages[i];
iovs[i].iov_len = length_of_messages[i];
}
}
// Add the ancillary
#ifndef CMSG_SPACE
if (control_length > 1){
free(iovs);
return MUL_MSGS_NOT_SUP;
}
#endif
if (control_length > 0){
//compute the total size of the ancillary
//getting the exact amount of space can be tricky and os dependent.
size_t total_size_of_ancillary = 0;
size_t space;
size_t controllen = 0, controllen_last = 0;
for (i = 0; i< control_length; i++){
total_size_of_ancillary = no_of_fds[i];
#ifdef CMSG_SPACE
if (!get_CMSG_SPACE(total_size_of_ancillary, &space)) {
#else
if (!get_CMSG_LEN(total_size_of_ancillary, &space)) {
#endif
if (iovs != NULL)
free(iovs);
return ANC_DATA_TOO_LARGE;
}
controllen +=space;
if ((controllen > SOCKLEN_T_LIMIT) || (controllen < controllen_last)) {
if (iovs != NULL)
free(iovs);
return ANC_DATA_TOO_LARGEX;
}
controllen_last = controllen;
}
controlbuf = malloc(controllen);
msg.msg_control = controlbuf;
msg.msg_controllen = controllen;
// memset controlbuf to 0 to avoid trash in the ancillary
memset(controlbuf, 0, controllen);
cmsg = NULL;
for (i = 0; i < control_length; i++) {
cmsg = (i == 0) ? CMSG_FIRSTHDR(&msg) : CMSG_NXTHDR(&msg, cmsg);
cmsg->cmsg_level = (int) levels[i];
cmsg->cmsg_type = (int) types[i];
cmsg->cmsg_len = CMSG_LEN(sizeof(char) * no_of_fds[i]);
memcpy(CMSG_DATA(cmsg), file_descriptors[i], sizeof(char) * no_of_fds[i]);
}
}
// Add the flags
msg.msg_flags = flag;
// Send the data
retval = sendmsg(socket, &msg, flag);
// free everything that was allocated here, and we would not need in rsocket
if (iovs != NULL)
free(iovs);
if (controlbuf !=NULL)
free(controlbuf);
return retval;
}
// ############################################################################
// Wrappers for CMSG_SPACE and CMSG_LEN
/*
These 2 functions are wrappers over sys/socket.h's CMSG_SPACE and CMSG_LEN.
They are identical to CPython's.
*/
#ifdef CMSG_SPACE
RPY_EXTERN
size_t CMSG_SPACE_wrapper(size_t desired_space){
size_t result;
if (!get_CMSG_SPACE(desired_space, &result)){
return 0;
}
return result;
}
#endif
#ifdef CMSG_LEN
RPY_EXTERN
size_t CMSG_LEN_wrapper(size_t desired_len){
size_t result;
if (!get_CMSG_LEN(desired_len, &result)){
return 0;
}
return result;
}
#endif
// ###########################################################################
// Extra functions that I needed
/*
This function is used to memcpy from a char* at an offset.
Could not get rffi.c_memcpy to do it at an offset, so I made my own.
*/
RPY_EXTERN
int memcpy_from_CCHARP_at_offset_and_size(char* stringfrom, char** stringto, int offset, int size){
*stringto = memcpy(*stringto, stringfrom + offset, size);
return 0;
}
/*
These functions free memory that was allocated in C (sendmsg or recvmsg) was used in rsocket and now needs cleanup
*/
RPY_EXTERN
int free_pointer_to_signedp(long** ptrtofree){
free(*ptrtofree);
return 0;
}
RPY_EXTERN
int free_ptr_to_charp(char** ptrtofree){
free(*ptrtofree);
return 0;
}
''',]
post_include_bits +=[ "RPY_EXTERN "
"int sendmsg_implementation(int socket, struct sockaddr* address, socklen_t addrlen, long* length_of_messages, char** messages, int no_of_messages, long* levels, long* types, char** file_descriptors, long* no_of_fds, int control_length, int flag );\n"
"RPY_EXTERN "
"int recvmsg_implementation(int socket_fd, int ancillary_size, int flags, struct sockaddr* address, socklen_t* addrlen, int* message_lengths, char** messages, int no_of_messages, long* size_of_ancillary, long** levels, long** types, char** file_descr, long** descr_per_ancillary, long* flag);\n"
"static "
"int cmsg_min_space(struct msghdr *msg, struct cmsghdr *cmsgh, size_t space);\n"
"static "
"int get_cmsg_data_space(struct msghdr *msg, struct cmsghdr *cmsgh, size_t *space);\n"
"static "
"int get_cmsg_data_len(struct msghdr *msg, struct cmsghdr *cmsgh, size_t *data_len);\n"
"static "
"int get_CMSG_LEN(size_t length, size_t *result);\n"
"static "
"int get_CMSG_SPACE(size_t length, size_t *result);\n"
"RPY_EXTERN "
"size_t CMSG_LEN_wrapper(size_t desired_len);\n"
"RPY_EXTERN "
"size_t CMSG_SPACE_wrapper(size_t desired_space);\n"
"RPY_EXTERN "
"int memcpy_from_CCHARP_at_offset_and_size(char* stringfrom, char** stringto, int offset, int size);\n"
"RPY_EXTERN "
"int free_pointer_to_signedp(long** ptrtofree);\n"
"RPY_EXTERN "
"int free_ptr_to_charp(char** ptrtofree);\n"
]
if _WIN32:
CConfig.WSAEVENT = platform.SimpleType('WSAEVENT', rffi.VOIDP)
CConfig.WSANETWORKEVENTS = platform.Struct(
'struct _WSANETWORKEVENTS',
[('lNetworkEvents', rffi.LONG),
('iErrorCode', rffi.CFixedArray(rffi.INT, 10)), #FD_MAX_EVENTS
])
CConfig.WSAPROTOCOL_INFO = platform.Struct(
'WSAPROTOCOL_INFOA',
[]) # Struct is just passed between functions
CConfig.FROM_PROTOCOL_INFO = platform.DefinedConstantInteger(
'FROM_PROTOCOL_INFO')
post_include_bits +=[dedent("""\
struct if_nameindex {
unsigned int if_index;
char * if_name;
};
RPY_EXTERN struct if_nameindex * if_nameindex(void);
RPY_EXTERN void if_freenameindex(struct if_nameindex *ptr);
""")]
separate_module_sources += [dedent("""\
#include <Iphlpapi.h>
#include <stdlib.h>
RPY_EXTERN
struct if_nameindex * if_nameindex(void) {
PMIB_IF_TABLE2 tbl;
int ret;
if (GetIfTable2Ex(MibIfTableRaw, &tbl) != NO_ERROR) {
return NULL;
}
size_t memsize = sizeof(struct if_nameindex) * (tbl->NumEntries + 1);
struct if_nameindex *out = malloc(memsize);
if (out == NULL) {
return NULL;
}
ULONG i = 0;
for (i; i < tbl->NumEntries; i++) {
MIB_IF_ROW2 r = tbl->Table[i];
WCHAR buf[NDIS_IF_MAX_STRING_SIZE + 1];
if ((ret = ConvertInterfaceLuidToNameW(&r.InterfaceLuid, buf,
NDIS_IF_MAX_STRING_SIZE))) {
FreeMibTable(tbl);
for (ULONG j=0; j<i; j++) {
free(out[j].if_name);
}
free(out);
return NULL;
}
/* convert from wchar_t to char */
size_t origsize = wcslen(buf) + 1;
size_t newsize = origsize * 2 + 2;
size_t convertedChars = 0;
out[i].if_name = malloc(newsize);
out[i].if_name[0] = '\\0';
wcstombs_s(&convertedChars, out[i].if_name, newsize, buf, newsize - 1);
out[i].if_index = r.InterfaceIndex;
}
out[i].if_name = NULL;
out[i].if_index = 0;
return out;
}
RPY_EXTERN
void if_freenameindex(struct if_nameindex *ptr) {
if (ptr == NULL) return;
int index = 0;
while (1) {
if (ptr[index].if_name == NULL) break;
free(ptr[index].if_name);
index += 1;
}
free(ptr);
}""")]
compilation_info = eci.merge(ExternalCompilationInfo(
includes=includes,
separate_module_sources=separate_module_sources,
post_include_bits=post_include_bits,
))
CConfig.timeval = platform.Struct('struct timeval',
[('tv_sec', rffi.LONG),
('tv_usec', rffi.LONG)])
fd_set = rffi.COpaquePtr('fd_set', compilation_info=eci)
if _WIN32:
CConfig.WSAData = platform.Struct('struct WSAData',
[('wVersion', rffi.USHORT),
('wHighVersion', rffi.USHORT),
('szDescription', rffi.CFixedArray(lltype.Char, 1)), # (WSADESCRIPTION_LEN+1)
('szSystemStatus', rffi.CFixedArray(lltype.Char, 1)), # (WSASYS_STATUS_LEN+1)
('iMaxSockets', rffi.USHORT),
('iMaxUdpDg', rffi.USHORT),
('lpVendorInfo', CCHARP)])
CConfig.tcp_keepalive = platform.Struct(
'struct tcp_keepalive',
[('onoff', rffi.ULONG),
('keepalivetime', rffi.ULONG),
('keepaliveinterval', rffi.ULONG)])
CConfig.GUID = platform.Struct(
'struct _GUID',
[('Data1', rffi.UINT),
('Data2', rffi.UINT),
('Data3', rffi.UINT),
('Data4', rffi.CFixedArray(rffi.UCHAR, 8))
])
CConfig.WSAPROTOCOLCHAIN = platform.Struct(
'struct _WSAPROTOCOLCHAIN',
[('ChainLen', rffi.INT),
('ChainEntries', rffi.CFixedArray(rffi.UINT, 7))])
WSAPROTOCOLCHAIN = CConfig.WSAPROTOCOLCHAIN
GUID = CConfig.GUID
CConfig.WSAPROTOCOL_INFOW = platform.Struct(
'struct _WSAPROTOCOL_INFOW',
[('dwServiceFlags1', rffi.UINT),
('dwServiceFlags2', rffi.UINT),
('dwServiceFlags3', rffi.UINT),
('dwServiceFlags4', rffi.UINT),
('dwProviderFlags', rffi.UINT),
('ProviderId', GUID),
('dwCatalogEntryId', rffi.UINT),
('ProtocolChain', WSAPROTOCOLCHAIN),
('iVersion', rffi.INT),
('iAddressFamily', rffi.INT),
('iMaxSockAddr', rffi.INT),
('iMinSockAddr', rffi.INT),
('iSocketType', rffi.INT),
('iProtocol', rffi.INT),
('iProtocolMaxOffset', rffi.INT),
('iNetworkByteOrder', rffi.INT),
('iSecurityScheme', rffi.INT),
('dwMessageSize', rffi.UINT),
('dwProviderReserved', rffi.UINT),
('szProtocol', rffi.CFixedArray(rffi.UCHAR, 256))])
class cConfig:
pass
cConfig.__dict__.update(platform.configure(CConfig))
sockaddr_ptr.TO.become(cConfig.sockaddr)
addrinfo_ptr.TO.become(cConfig.addrinfo)
# fill in missing constants with reasonable defaults
cConfig.NI_MAXHOST = cConfig.NI_MAXHOST or 1025
cConfig.NI_MAXSERV = cConfig.NI_MAXSERV or 32
cConfig.INET_ADDRSTRLEN = cConfig.INET_ADDRSTRLEN or 16
for name in constant_names:
value = getattr(cConfig, name)
if value is not None:
constants[name] = value
for name, default in constants_w_defaults:
value = getattr(cConfig, name)
if value is not None:
constants[name] = value
else:
constants[name] = default
if not _HAS_AF_PACKET and 'AF_PACKET' in constants:
del constants['AF_PACKET']
constants['has_ipv6'] = True # This is a configuration option in CPython
for name, value in constants.items():
if isinstance(value, long):
if r_uint(value) == value:
constants[name] = intmask(value)
locals().update(constants)
O_RDONLY = cConfig.O_RDONLY
O_WRONLY = cConfig.O_WRONLY
O_RDWR = cConfig.O_RDWR
O_NONBLOCK = cConfig.O_NONBLOCK
F_GETFL = cConfig.F_GETFL
F_SETFL = cConfig.F_SETFL
FIONBIO = cConfig.FIONBIO
INET_ADDRSTRLEN = cConfig.INET_ADDRSTRLEN
INET6_ADDRSTRLEN = cConfig.INET6_ADDRSTRLEN
EINTR = cConfig.EINTR or cConfig.WSAEINTR
EINPROGRESS = cConfig.EINPROGRESS or cConfig.WSAEINPROGRESS
EWOULDBLOCK = cConfig.EWOULDBLOCK or cConfig.WSAEWOULDBLOCK
EAFNOSUPPORT = cConfig.EAFNOSUPPORT or cConfig.WSAEAFNOSUPPORT
# vs 2010 and above define both the constansts
WSAEINPROGRESS = cConfig.WSAEINPROGRESS or cConfig.EINPROGRESS
WSAEWOULDBLOCK = cConfig.WSAEWOULDBLOCK or cConfig.EWOULDBLOCK
WSAEAFNOSUPPORT = cConfig.WSAEAFNOSUPPORT or cConfig.EAFNOSUPPORT
EISCONN = cConfig.EISCONN or cConfig.WSAEISCONN
PIPE_BUF = cConfig.PIPE_BUF # may be None
linux = cConfig.linux
WIN32 = cConfig.WIN32
assert WIN32 == _WIN32
if _MSVC:
def invalid_socket(fd):
return widen(fd) == INVALID_SOCKET
INVALID_SOCKET = r_uint(cConfig.INVALID_SOCKET)
else:
def invalid_socket(fd):
return widen(fd) < 0
INVALID_SOCKET = -1
uint16_t = cConfig.uint16_t
uint32_t = cConfig.uint32_t
size_t = cConfig.size_t
ssize_t = cConfig.ssize_t
socklen_t = cConfig.socklen_t
sockaddr = cConfig.sockaddr
#sockaddr_size = sizeof(sockaddr)
sockaddr_in = cConfig.sockaddr_in
sockaddr_in6 = cConfig.sockaddr_in6
sockaddr_un = cConfig.sockaddr_un
if cConfig.sockaddr_nl is not None:
sockaddr_nl = cConfig.sockaddr_nl
if cConfig.sockaddr_alg is not None:
sockaddr_alg = cConfig.sockaddr_alg
if cConfig.sockaddr_qrtr is not None:
sockaddr_qrtr = cConfig.sockaddr_qrtr
in_addr = cConfig.in_addr
#in_addr_size = sizeof(in_addr)
in6_addr = cConfig.in6_addr
addrinfo = cConfig.addrinfo
if _POSIX:
nfds_t = cConfig.nfds_t
pollfd = cConfig.pollfd
if _HAS_AF_PACKET:
sockaddr_ll = cConfig.sockaddr_ll
ifreq = cConfig.ifreq
if_nameindex_s = cConfig.if_nameindex_s
if WIN32:
WSAEVENT = cConfig.WSAEVENT
WSANETWORKEVENTS = cConfig.WSANETWORKEVENTS
SAVE_ERR = rffi.RFFI_SAVE_WSALASTERROR
if_nameindex_s = CConfig.if_nameindex_s
else:
SAVE_ERR = rffi.RFFI_SAVE_ERRNO
timeval = cConfig.timeval
def external(name, args, result, **kwds):
return rffi.llexternal(name, args, result, compilation_info=eci,
calling_conv=calling_conv, **kwds)
def external_c(name, args, result, **kwargs):
return rffi.llexternal(name, args, result, compilation_info=eci,
calling_conv='c', **kwargs)
if _POSIX:
dup = external('dup', [socketfd_type], socketfd_type, save_err=SAVE_ERR)
gai_strerror = external('gai_strerror', [rffi.INT], CONST_CCHARP)
#h_errno = c_int.in_dll(socketdll, 'h_errno')
#
#hstrerror = socketdll.hstrerror
#hstrerror.argtypes = [c_int]
#hstrerror.restype = c_char_p
socket = external('socket', [rffi.INT, rffi.INT, rffi.INT], socketfd_type,
save_err=SAVE_ERR)
if WIN32:
socketclosename = 'closesocket'
else:
socketclosename = 'close'
socketclose = external(socketclosename, [socketfd_type], rffi.INT,
releasegil=False, save_err=SAVE_ERR)
socketclose_no_errno = external(socketclosename, [socketfd_type], rffi.INT,
releasegil=False)
socketconnect = external('connect', [socketfd_type, sockaddr_ptr, socklen_t],
rffi.INT, save_err=SAVE_ERR)
getaddrinfo = external('getaddrinfo', [CCHARP, CCHARP,
addrinfo_ptr,
lltype.Ptr(rffi.CArray(addrinfo_ptr))], rffi.INT)
freeaddrinfo = external('freeaddrinfo', [addrinfo_ptr], lltype.Void)
getnameinfo = external('getnameinfo', [sockaddr_ptr, socklen_t, CCHARP,
size_t, CCHARP, size_t, rffi.INT], rffi.INT)
if sys.platform.startswith("openbsd") or sys.platform.startswith("darwin"):
htonl = external('htonl', [rffi.UINT], rffi.UINT, releasegil=False, macro=True)
htons = external('htons', [rffi.USHORT], rffi.USHORT, releasegil=False, macro=True)
ntohl = external('ntohl', [rffi.UINT], rffi.UINT, releasegil=False, macro=True)
ntohs = external('ntohs', [rffi.USHORT], rffi.USHORT, releasegil=False, macro=True)
else:
htonl = external('htonl', [rffi.UINT], rffi.UINT, releasegil=False)
htons = external('htons', [rffi.USHORT], rffi.USHORT, releasegil=False)
ntohl = external('ntohl', [rffi.UINT], rffi.UINT, releasegil=False)
ntohs = external('ntohs', [rffi.USHORT], rffi.USHORT, releasegil=False)
if _POSIX:
inet_aton = external('inet_aton', [CCHARP, lltype.Ptr(in_addr)],
rffi.INT)
inet_ntoa = external('inet_ntoa', [in_addr], rffi.CCHARP)
inet_pton = external('inet_pton', [rffi.INT, rffi.CCHARP,
rffi.VOIDP], rffi.INT,
save_err=SAVE_ERR)
inet_ntop = external('inet_ntop', [rffi.INT, rffi.VOIDP, CCHARP,
socklen_t], CONST_CCHARP,
save_err=SAVE_ERR)
inet_addr = external('inet_addr', [rffi.CCHARP], rffi.UINT)
socklen_t_ptr = lltype.Ptr(rffi.CFixedArray(socklen_t, 1))
socketaccept = external('accept', [socketfd_type, sockaddr_ptr,
socklen_t_ptr], socketfd_type,
save_err=SAVE_ERR)
HAVE_ACCEPT4 = cConfig.HAVE_ACCEPT4
if HAVE_ACCEPT4:
socketaccept4 = external('accept4', [socketfd_type, sockaddr_ptr,
socklen_t_ptr, rffi.INT],
socketfd_type,
save_err=SAVE_ERR)
socketbind = external('bind', [socketfd_type, sockaddr_ptr, socklen_t],
rffi.INT, save_err=SAVE_ERR)
socketlisten = external('listen', [socketfd_type, rffi.INT], rffi.INT,
save_err=SAVE_ERR)
socketgetpeername = external('getpeername', [socketfd_type,
sockaddr_ptr, socklen_t_ptr], rffi.INT,
save_err=SAVE_ERR)
socketgetsockname = external('getsockname', [socketfd_type,
sockaddr_ptr, socklen_t_ptr], rffi.INT,
save_err=SAVE_ERR)
socketgetsockopt = external('getsockopt', [socketfd_type, rffi.INT,
rffi.INT, rffi.VOIDP, socklen_t_ptr], rffi.INT,
save_err=SAVE_ERR)
socketsetsockopt = external('setsockopt', [socketfd_type, rffi.INT,
rffi.INT, rffi.VOIDP, socklen_t], rffi.INT,
save_err=SAVE_ERR)
if WIN32:
socketrecv = external('recv', [socketfd_type, rffi.VOIDP, rffi.INT,
rffi.INT], rffi.INT, save_err=SAVE_ERR)
else:
socketrecv = external('recv', [socketfd_type, rffi.VOIDP, rffi.INT,
rffi.INT], ssize_t, save_err=SAVE_ERR)
recvfrom = external('recvfrom', [socketfd_type, rffi.VOIDP, size_t,
rffi.INT, sockaddr_ptr, socklen_t_ptr], rffi.INT,
save_err=SAVE_ERR)
recvmsg = jit.dont_look_inside(rffi.llexternal(
"recvmsg_implementation",
[rffi.INT, rffi.INT, rffi.INT, sockaddr_ptr, socklen_t_ptr,
rffi.INT_realP, rffi.CCHARPP, rffi.INT, rffi.SIGNEDP, rffi.SIGNEDPP, rffi.SIGNEDPP,
rffi.CCHARPP, rffi.SIGNEDPP, rffi.SIGNEDP], rffi.INT,
save_err=SAVE_ERR, compilation_info=compilation_info))
memcpy_from_CCHARP_at_offset = jit.dont_look_inside(rffi.llexternal("memcpy_from_CCHARP_at_offset_and_size",
[rffi.CCHARP, rffi.CCHARPP,rffi.INT,rffi.INT],rffi.INT,save_err=SAVE_ERR,compilation_info=compilation_info))
freeccharp = jit.dont_look_inside(rffi.llexternal("free_ptr_to_charp",
[rffi.CCHARPP],rffi.INT,save_err=SAVE_ERR,compilation_info=compilation_info))
freesignedp = jit.dont_look_inside(rffi.llexternal("free_pointer_to_signedp",
[rffi.SIGNEDPP],rffi.INT,save_err=SAVE_ERR,compilation_info=compilation_info))
send = external('send', [socketfd_type, rffi.CCHARP, size_t, rffi.INT],
ssize_t, save_err=SAVE_ERR)
sendto = external('sendto', [socketfd_type, rffi.VOIDP, size_t, rffi.INT,
sockaddr_ptr, socklen_t], ssize_t,
save_err=SAVE_ERR)
sendmsg = jit.dont_look_inside(rffi.llexternal("sendmsg_implementation",
[rffi.INT, sockaddr_ptr, socklen_t, rffi.SIGNEDP, rffi.CCHARPP, rffi.INT,
rffi.SIGNEDP, rffi.SIGNEDP, rffi.CCHARPP, rffi.SIGNEDP, rffi.INT, rffi.INT],
rffi.INT, save_err=SAVE_ERR,
compilation_info=compilation_info))
CMSG_SPACE = jit.dont_look_inside(rffi.llexternal("CMSG_SPACE_wrapper",[size_t], size_t, save_err=SAVE_ERR,compilation_info=compilation_info))
CMSG_LEN = jit.dont_look_inside(rffi.llexternal("CMSG_LEN_wrapper",[size_t], size_t, save_err=SAVE_ERR,compilation_info=compilation_info))
socketshutdown = external('shutdown', [socketfd_type, rffi.INT], rffi.INT,
save_err=SAVE_ERR)
gethostname = external('gethostname', [rffi.CCHARP, rffi.INT], rffi.INT,
save_err=SAVE_ERR)
gethostbyname = external('gethostbyname', [rffi.CCHARP],
lltype.Ptr(cConfig.hostent))
gethostbyaddr = external('gethostbyaddr', [rffi.VOIDP, rffi.INT, rffi.INT], lltype.Ptr(cConfig.hostent))
getservbyname = external('getservbyname', [rffi.CCHARP, rffi.CCHARP], lltype.Ptr(cConfig.servent))
getservbyport = external('getservbyport', [rffi.INT, rffi.CCHARP], lltype.Ptr(cConfig.servent))
getprotobyname = external('getprotobyname', [rffi.CCHARP], lltype.Ptr(cConfig.protoent))
if _POSIX:
fcntl = external('fcntl', [socketfd_type, rffi.INT, rffi.INT], rffi.INT,
save_err=SAVE_ERR, natural_arity=2)
socketpair_t = rffi.CArray(socketfd_type)
socketpair = external('socketpair', [rffi.INT, rffi.INT, rffi.INT,
lltype.Ptr(socketpair_t)], rffi.INT,
save_err=SAVE_ERR)
sethostname = external('sethostname', [rffi.CCHARP, rffi.INT], rffi.INT,
save_err=SAVE_ERR)
if _HAS_AF_PACKET:
ioctl = external('ioctl', [socketfd_type, rffi.INT, lltype.Ptr(ifreq)],
rffi.INT)
if _WIN32:
ioctlsocket = external('ioctlsocket',
[socketfd_type, rffi.LONG, rffi.ULONGP],
rffi.INT, save_err=SAVE_ERR)
select = external('select',
[rffi.INT, fd_set, fd_set,
fd_set, lltype.Ptr(timeval)],
rffi.INT,
save_err=SAVE_ERR)
if_nameindex = rffi.llexternal('if_nameindex', [], lltype.Ptr(if_nameindex_s),
save_err=SAVE_ERR, compilation_info=compilation_info,
calling_conv=calling_conv)
if_freenameindex = rffi.llexternal('if_freenameindex', [lltype.Ptr(if_nameindex_s)],
lltype.Void, save_err=SAVE_ERR, compilation_info=compilation_info,
calling_conv=calling_conv)
FD_CLR = external_c('FD_CLR', [rffi.INT, fd_set], lltype.Void, macro=True)
FD_ISSET = external_c('FD_ISSET', [rffi.INT, fd_set], rffi.INT, macro=True)
FD_SET = external_c('FD_SET', [rffi.INT, fd_set], lltype.Void, macro=True)
FD_ZERO = external_c('FD_ZERO', [fd_set], lltype.Void, macro=True)
if _POSIX:
pollfdarray = rffi.CArray(pollfd)
poll = external('poll', [lltype.Ptr(pollfdarray), nfds_t, rffi.INT],
rffi.INT, save_err=SAVE_ERR)
# workaround for Mac OS/X on which poll() seems to behave a bit strangely
# (see test_recv_send_timeout in pypy.module._socket.test.test_sock_app)
# https://issues.apache.org/bugzilla/show_bug.cgi?id=34332
poll_may_be_broken = _MACOSX
elif WIN32:
from rpython.rlib import rwin32
#
# The following is for rpython.rlib.rpoll
#
WSAEVENT_ARRAY = rffi.CArray(WSAEVENT)
WSACreateEvent = external('WSACreateEvent', [], WSAEVENT)
WSACloseEvent = external('WSACloseEvent', [WSAEVENT], rffi.INT)
WSAEventSelect = external('WSAEventSelect',
[socketfd_type, WSAEVENT, rffi.LONG],
rffi.INT)
WSAWaitForMultipleEvents = external('WSAWaitForMultipleEvents',
[rffi.LONG, lltype.Ptr(WSAEVENT_ARRAY),
rffi.INT, rffi.LONG, rffi.INT],
rffi.ULONG)
WSAEnumNetworkEvents = external('WSAEnumNetworkEvents',
[socketfd_type, WSAEVENT,
lltype.Ptr(WSANETWORKEVENTS)],
rffi.INT)
WSAIoctl = external('WSAIoctl',
[socketfd_type, rwin32.DWORD,
rffi.VOIDP, rwin32.DWORD,
rffi.VOIDP, rwin32.DWORD,
rwin32.LPDWORD, rffi.VOIDP, rffi.VOIDP],
rffi.INT, save_err=SAVE_ERR)
WSAPROTOCOL_INFOW = cConfig.WSAPROTOCOL_INFOW
WSADuplicateSocketW = external('WSADuplicateSocketW',
[socketfd_type, rwin32.DWORD,
lltype.Ptr(WSAPROTOCOL_INFOW)],
rffi.INT, save_err=SAVE_ERR)
WSASocketW = external('WSASocketW',
[rffi.INT, rffi.INT, rffi.INT,
lltype.Ptr(WSAPROTOCOL_INFOW),
rwin32.DWORD, rwin32.DWORD],
socketfd_type, save_err=SAVE_ERR)
tcp_keepalive = cConfig.tcp_keepalive
WSAPROTOCOL_INFO = cConfig.WSAPROTOCOL_INFO
FROM_PROTOCOL_INFO = cConfig.FROM_PROTOCOL_INFO
WSADuplicateSocket = external('WSADuplicateSocketA',
[socketfd_type, rwin32.DWORD,
lltype.Ptr(WSAPROTOCOL_INFO)],
rffi.INT, save_err=SAVE_ERR)
WSASocket = external('WSASocketA',
[rffi.INT, rffi.INT, rffi.INT,
lltype.Ptr(WSAPROTOCOL_INFO),
rwin32.DWORD, rwin32.DWORD],
socketfd_type, save_err=SAVE_ERR)
if WIN32:
WSAData = cConfig.WSAData
WSAStartup = external('WSAStartup', [rwin32.WORD, lltype.Ptr(WSAData)],
rffi.INT)
_WSAGetLastError = external('WSAGetLastError', [], rwin32.DWORD,
_nowrapper=True, sandboxsafe=True)
geterrno = rwin32.GetLastError_saved
# In tests, the first call to GetLastError is always wrong, because error
# is hidden by operations in ll2ctypes. Call it now.
> _WSAGetLastError()
..\rpython\rlib\_rsocket_rffi.py:1582:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <* fn WSAGetLastError>, args = ()
rffi = <module 'rpython.rtyper.lltypesystem.rffi' from 'd:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\rpython\\rtyper\\lltypesystem\\rffi.pyc'>
def __call__(self, *args):
from rpython.rtyper.lltypesystem import rffi
if isinstance(self._T, FuncType):
if len(args) != len(self._T.ARGS):
raise TypeError("calling %r with wrong argument number: %r" %
(self._T, args))
for i, a, ARG in zip(range(len(self._T.ARGS)), args, self._T.ARGS):
if typeOf(a) != ARG:
# ARG could be Void
if ARG == Void:
try:
value = getattr(self._obj, '_void' + str(i))
except AttributeError:
pass
else:
assert a == value
# None is acceptable for any pointer
elif isinstance(ARG, Ptr) and a is None:
pass
# Any pointer is convertible to void*
elif ARG is rffi.VOIDP and isinstance(typeOf(a), Ptr):
pass
# special case: ARG can be a container type, in which
# case a should be a pointer to it. This must also be
# special-cased in the backends.
elif (isinstance(ARG, ContainerType) and
typeOf(a) == Ptr(ARG)):
pass
else:
args_repr = [typeOf(arg) for arg in args]
raise TypeError("calling %r with wrong argument "
"types: %r" % (self._T, args_repr))
callb = self._obj._callable
if callb is None:
raise RuntimeError("calling undefined function")
> return callb(*args)
..\rpython\rtyper\lltypesystem\lltype.py:1384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.rtyper.lltypesystem.ll2ctypes.LL2CtypesCallable object at 0x0000010aa94509c0>
argvalues = ()
def __call__(self, *argvalues):
with rlock:
if self.trampoline is None:
# lazily build the corresponding ctypes function object
cfunc = get_ctypes_callable(self.funcptr, self.calling_conv,
> self.natural_arity)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1339:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
funcptr = <* fn WSAGetLastError>, calling_conv = 'win', natural_arity = -1
def get_ctypes_callable(funcptr, calling_conv, natural_arity):
if not ctypes:
raise ImportError("ctypes is needed to use ll2ctypes")
def get_on_lib(lib, elem):
""" Wrapper to always use lib[func] instead of lib.func
"""
try:
return lib[elem]
except AttributeError:
pass
old_eci = funcptr._obj.compilation_info
funcname = funcptr._obj._name
if hasattr(old_eci, '_with_ctypes'):
old_eci = old_eci._with_ctypes
try:
eci = _eci_cache[old_eci]
except KeyError:
eci = old_eci.compile_shared_lib(ignore_a_files=True,
defines=['RPYTHON_LL2CTYPES'],
> symbolic=True)
..\rpython\rtyper\lltypesystem\ll2ctypes.py:1236:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ExternalCompilationInfo (pre_include_bits=(), includes=(), include_dirs=(), p...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-415\\shared_cache\\externmod_0'
ignore_a_files = False, debug_mode = True, defines = ['RPYTHON_LL2CTYPES']
symbolic = True
def compile_shared_lib(self, outputfilename=None, ignore_a_files=False,
debug_mode=True, defines=[], symbolic=False):
self = self.convert_sources_to_files()
if ignore_a_files:
if not [fn for fn in self.link_files if fn.endswith('.a')]:
ignore_a_files = False # there are none
if not self.separate_module_files and not ignore_a_files:
return self # xxx there was some condition about win32 here
else:
#basepath = py.path.local(self.separate_module_files[0]).dirpath()
basepath = udir.join('shared_cache')
if outputfilename is None:
# find more or less unique name there
pth = basepath.join('externmod').new(ext=host.so_ext)
num = 0
while pth.check():
pth = basepath.join(
'externmod_%d' % (num,)).new(ext=host.so_ext)
num += 1
basepath.ensure(dir=1)
outputfilename = str(pth.dirpath().join(pth.purebasename))
d = self._copy_attributes()
if ignore_a_files:
d['link_files'] = [fn for fn in d['link_files']
if not fn.endswith('.a')]
if debug_mode and sys.platform != 'win32':
d['compile_extra'] = d['compile_extra'] + ('-g', '-O0')
d['compile_extra'] = d['compile_extra'] + (
'-DRPY_EXTERN=RPY_EXPORTED',)
for define in defines:
d['compile_extra'] += ('-D%s' % define,)
# On ELF platforms (Linux), prevent symbol interposition: when the host
# interpreter (e.g. pypy2.7) also exports symbols like pypysig_counter,
# the shared lib's own references would otherwise resolve to the host's
# copy via the GOT. -Bsymbolic makes the shared lib bind its own global
# symbol references to its own definitions. Only needed when running
# under a host interpreter (tests), not during translation.
if symbolic and sys.platform not in ('win32', 'darwin'):
d['link_extra'] = d['link_extra'] + ('-Wl,-Bsymbolic',)
self = ExternalCompilationInfo(**d)
lib = str(host.compile([], self, outputfilename=outputfilename,
> standalone=False))
..\rpython\translator\tool\cbuild.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cfiles = []
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=(), include_dirs=(), p...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
outputfilename = 'd:\\systemtemp\\pytest\\usession-py3.11-415\\shared_cache\\externmod_0'
standalone = False
def compile(self, cfiles, eci, outputfilename=None, standalone=True):
> ofiles = self._compile_o_files(cfiles, eci, standalone)
..\rpython\translator\platform\__init__.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>
cfiles = [local('d:\\systemtemp\\pytest\\usession-py3.11-415\\module_cache\\module_0.c'), local('d:\\systemtemp\\pytest\\usessi...py3.11-415\\module_cache\\module_2.c'), local('d:\\systemtemp\\pytest\\usession-py3.11-415\\module_cache\\module_3.c')]
eci = <ExternalCompilationInfo (pre_include_bits=(), includes=(), include_dirs=(), p...estonly_libraries=(), use_cpp_linker=False, platform=<MsvcPlatform cc=cl.exe>)>
standalone = False
def _compile_o_files(self, cfiles, eci, standalone=True):
cfiles = self._all_cfiles(cfiles, eci)
compile_args = self._compile_args_from_eci(eci, standalone)
ofiles = []
for cfile in cfiles:
# Windows hack: use masm for files ending in .asm
if str(cfile).lower().endswith('.asm'):
ofiles.append(self._compile_c_file(self.masm, cfile, []))
else:
> ofiles.append(self._compile_c_file(self.cc, cfile, compile_args))
..\rpython\translator\platform\__init__.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'cl.exe'
cfile = local('d:\\systemtemp\\pytest\\usession-py3.11-415\\module_cache\\module_1.c')
compile_args = ['/MD', '/O2', '-DRPY_EXTERN=RPY_EXPORTED', '-DRPYTHON_LL2CTYPES', '/Fdd:\\systemtemp\\pytest\\usession-py3.11-415\\module_cache\\']
def _compile_c_file(self, cc, cfile, compile_args):
oname = self._make_o_file(cfile, ext='obj')
# notabene: (tismer)
# This function may be called for .c but also .asm files.
# The c compiler accepts any order of arguments, while
# the assembler still has the old behavior that all options
# must come first, and after the file name all options are ignored.
# So please be careful with the order of parameters! ;-)
pdb_dir = oname.dirname
if pdb_dir:
compile_args = compile_args + ['/Fd%s\\' % (pdb_dir,)]
args = ['/nologo', '/c'] + compile_args + ['/Fo%s' % (oname,), str(cfile)]
> self._execute_c_compiler(cc, args, oname)
..\rpython\translator\platform\windows.py:290:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, cc = 'cl.exe'
args = ['/nologo', '/c', '/MD', '/O2', '-DRPY_EXTERN=RPY_EXPORTED', '-DRPYTHON_LL2CTYPES', ...]
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-415\\module_cache\\module_1.obj')
cwd = None
def _execute_c_compiler(self, cc, args, outname, cwd=None):
#log.execute(cc + ' ' + ' '.join(args))
# 'cc' can also contain some options for the C compiler;
# e.g. it can be "gcc -m32". We handle it by splitting on ' '.
cclist = cc.split()
cc = cclist[0]
args = cclist[1:] + args
returncode, stdout, stderr = _run_subprocess(cc, args, self.c_environ,
cwd)
> self._handle_error(returncode, stdout, stderr, outname)
..\rpython\translator\platform\__init__.py:143:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MsvcPlatform cc=cl.exe>, returncode = 3221225477, stdout = ''
stderr = ''
outname = local('d:\\systemtemp\\pytest\\usession-py3.11-415\\module_cache\\module_1.obj')
def _handle_error(self, returncode, stdout, stderr, outname):
if returncode != 0:
# Microsoft compilers write compilation errors to stdout
stderr = stdout + stderr
errorfile = outname.new(ext='errors')
errorfile.write(stderr, mode='wb')
if self.log_errors:
stderrlines = stderr.splitlines()
for line in stderrlines:
log.Error(line)
# ^^^ don't use ERROR, because it might actually be fine.
# Also, ERROR confuses lib-python/conftest.py.
> raise CompilationError(stdout, stderr)
E CompilationError: CompilationError(out="""
E """)
..\rpython\translator\platform\windows.py:319: CompilationError
============== 235 passed, 7 skipped, 1 error in 429.33 seconds ===============
++ 05:28:47 starting module/zipimport/test [132 started in total]
__ module/time/test [129 done in total, somefailed=False] _____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 43 items
module\time\test\apptest_time.py ....ssss..........ss....s.s...........s..
module\time\test\test_timeutils.py .
module\time\test\test_ztranslation.py .
=================== 34 passed, 9 skipped in 409.78 seconds ====================
++ 05:29:42 starting module/zlib/test [133 started in total]
__ module/zipimport/test [130 done in total, somefailed=False] ________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 1 items
module\zipimport\test\apptest_zipimport.py .
========================== 1 passed in 85.34 seconds ==========================
++ 05:30:16 starting objspace/fake/test [134 started in total]
__ module/unicodedata/test [131 done in total, somefailed=False] ______________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 166.74 seconds =========================
++ 05:30:22 starting objspace/std/test [135 started in total]
__ module/zlib/test [132 done in total, somefailed=False] _____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 38 items
module\zlib\test\test_zlib.py ......................................
========================= 38 passed in 90.22 seconds ==========================
++ 05:31:19 starting objspace/test [136 started in total]
__ module/thread/test [133 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 56 items
module\thread\test\test_fork.py ssss
module\thread\test\test_gil.py ....
module\thread\test\test_import_lock.py .....
module\thread\test\test_local.py .......
module\thread\test\test_lock.py ...............ssss..
module\thread\test\test_thread.py .............s.
=================== 47 passed, 9 skipped in 551.44 seconds ====================
++ 05:31:46 starting sandbox/test [137 started in total]
__ sandbox/test [134 done in total, somefailed=False] _________________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 0 items / 1 skipped
========================== 1 skipped in 5.45 seconds ==========================
++ 05:31:53 starting tool/bench/test [138 started in total]
__ objspace/fake/test [135 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-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 94.78 seconds ==========================
++ 05:31:53 starting tool/memusage/test [139 started in total]
__ tool/memusage/test [136 done in total, somefailed=False] ___________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 5 items
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
tool\memusage\test\test_log2gnumeric.py .....
========================== 5 passed in 5.43 seconds ===========================
++ 05:32:01 starting tool/pytest/fake_pytest/test [140 started in total]
__ tool/bench/test [137 done in total, somefailed=False] ______________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 3 items / 1 skipped
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
tool\bench\test\test_pypyresult.py ...
===================== 3 passed, 1 skipped in 6.31 seconds =====================
++ 05:32:02 starting tool/pytest/test [141 started in total]
__ objspace/test [138 done in total, somefailed=False] ________________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
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 64.47 seconds ====================
++ 05:32:26 starting tool/release/test [142 started in total]
__ tool/pytest/fake_pytest/test [139 done in total, somefailed=False] _________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 1 items
tool\pytest\fake_pytest\test\apptest_fake_pytest.py .
========================== 1 passed in 44.32 seconds ==========================
++ 05:32:53 starting tool/test [143 started in total]
__ tool/test [140 done in total, somefailed=False] ____________________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 29 items
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
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 77.00 seconds ==========================
__ tool/release/test [141 done in total, somefailed=False] ____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 8 items
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
tool\release\test\test_package.py ...ss
tool\release\test\test_smartstrip.py sss
==================== 3 passed, 5 skipped in 104.73 seconds ====================
__ tool/pytest/test [142 done in total, somefailed=False] _____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
collected 25 items
tool\pytest\test\test_appsupport.py .........
tool\pytest\test\test_astrewrite.py .....
tool\pytest\test\test_conftest1.py ...xx
tool\pytest\test\test_pytestsupport.py ......
=================== 23 passed, 2 xfailed in 390.86 seconds ====================
__ objspace/std/test [143 done in total, somefailed=True] _____________________
============================= test session starts =============================
platform win32 -- Python 2.7.18[pypy-7.3.18-alpha], pytest-2.9.2, py-1.4.29, pluggy-0.3.1
hypothesis profile 'default' -> deadline=None, database=DirectoryBasedExampleDatabase('d:\\pypy_stuff\\buildbot64\\slave\\own-win-x86-64\\build\\pypy\\.hypothesis\\examples')
pytest-2.9.2 from d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pytest.pyc
rootdir: d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build, inifile: pytest.ini
plugins: hypothesis-4.39.3
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
collected 2509 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_fstring.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_specializedtuple.py ........................
objspace\std\test\apptest_stringformat.py .................s......s..................s........................
objspace\std\test\apptest_tuple.py ........................
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 ..........................F..................................................................................................................................
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 ...............................................................
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 ..........................F..................................................................................................................................................F...................................................................
objspace\std\test\test_specialisedtupleobject.py ....................ss....
objspace\std\test\test_stdobjspace.py s........
objspace\std\test\test_translate.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 ...............
================================== FAILURES ===================================
_________________ TestW_IntObject.test_lshift_without_fromint _________________
self = <pypy.objspace.std.test.test_intobject.TestW_IntObject instance at 0x000002e591378de0>
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x000002e5913794a0>
def test_lshift_without_fromint(self, monkeypatch):
if LONG_BIT != 64:
pytest.skip("64-bit only speedup")
space = self.space
monkeypatch.setattr(rbigint, 'fromint', None)
x = sys.maxint // 4
y = 16
f1 = iobj.W_IntObject(x)
f2 = iobj.W_IntObject(y)
> v = f1.descr_lshift(space, f2)
objspace\std\test\test_intobject.py:388:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
objspace\std\intobject.py:834: in descr_binop
return ovf2long(space, x, self, y, w_other)
objspace\std\intobject.py:865: in _ovf2long_lshift
return space.newlong_from_rbigint(rbigint.lshift_int_int_bigint_result(x, y))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
iself = 2305843009213693951, int_other = 16
@staticmethod
@jit.elidable
def lshift_int_int_bigint_result(iself, int_other):
if not SUPPORT_INT128 or SHIFT != 63 or not int_in_valid_range(iself):
> return rbigint.fromint(iself).lshift(int_other)
E TypeError: 'NoneType' object is not callable
..\rpython\rlib\rbigint.py:1383: TypeError
_________________ TestW_IntObject.test_lshift_without_fromint _________________
self = <pypy.objspace.std.test.test_intobject.TestW_IntObject instance at 0x000002e5cb30e7a0>
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x000002e5cb30e7e0>
def test_lshift_without_fromint(self, monkeypatch):
if LONG_BIT != 64:
pytest.skip("64-bit only speedup")
space = self.space
monkeypatch.setattr(rbigint, 'fromint', None)
x = sys.maxint // 4
y = 16
f1 = iobj.W_IntObject(x)
f2 = iobj.W_IntObject(y)
> v = f1.descr_lshift(space, f2)
objspace\std\test\test_intobject.py:388:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
objspace\std\intobject.py:834: in descr_binop
return ovf2long(space, x, self, y, w_other)
objspace\std\intobject.py:865: in _ovf2long_lshift
return space.newlong_from_rbigint(rbigint.lshift_int_int_bigint_result(x, y))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
iself = 2305843009213693951, int_other = 16
@staticmethod
@jit.elidable
def lshift_int_int_bigint_result(iself, int_other):
if not SUPPORT_INT128 or SHIFT != 63 or not int_in_valid_range(iself):
> return rbigint.fromint(iself).lshift(int_other)
E TypeError: 'NoneType' object is not callable
..\rpython\rlib\rbigint.py:1383: TypeError
__________ TestW_IntObjectWithSmallLong.test_lshift_without_fromint ___________
self = <pypy.objspace.std.test.test_smalllongobject.TestW_IntObjectWithSmallLong instance at 0x000002e5a377f4a0>
monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x000002e5a377f520>
def test_lshift_without_fromint(self, monkeypatch):
if LONG_BIT != 64:
pytest.skip("64-bit only speedup")
space = self.space
monkeypatch.setattr(rbigint, 'fromint', None)
x = sys.maxint // 4
y = 16
f1 = iobj.W_IntObject(x)
f2 = iobj.W_IntObject(y)
> v = f1.descr_lshift(space, f2)
objspace\std\test\test_intobject.py:388:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
objspace\std\intobject.py:834: in descr_binop
return ovf2long(space, x, self, y, w_other)
objspace\std\intobject.py:865: in _ovf2long_lshift
return space.newlong_from_rbigint(rbigint.lshift_int_int_bigint_result(x, y))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
iself = 2305843009213693951, int_other = 16
@staticmethod
@jit.elidable
def lshift_int_int_bigint_result(iself, int_other):
if not SUPPORT_INT128 or SHIFT != 63 or not int_in_valid_range(iself):
> return rbigint.fromint(iself).lshift(int_other)
E TypeError: 'NoneType' object is not callable
..\rpython\rlib\rbigint.py:1383: TypeError
=========================== short test summary info ===========================
FAIL objspace\std\test\test_intobject.py::TestW_IntObject::()::test_lshift_without_fromint
FAIL objspace\std\test\test_smalllongobject.py::TestW_IntObject::()::test_lshift_without_fromint
FAIL objspace\std\test\test_smalllongobject.py::TestW_IntObjectWithSmallLong::()::test_lshift_without_fromint
============= 3 failed, 2476 passed, 30 skipped in 581.33 seconds =============
program finished with exit code 1
elapsedTime=7750.947000