pypy/module/_io/test/test_bufferedio.py::AppTestBufferedReaderWithThreads::()::test_readinto1
self = <CallInfo when='call' exception: [<W_TypeObject 'LookupError' at 0x1119864b8>: W_BaseExceptionUserWeakrefable([W_UnicodeObject('unknown encoding: utf-8')])]>
func = <function <lambda> at 0x0000000112388b60>, 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_readinto1'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_readinto1'>}
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 0x00000001102549f8>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00000001582870e0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_readinto1'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_readinto1'>}
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 0x00000001582870e0>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_readinto1'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_readinto1'>}
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_readinto1'>, '__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 0x0000000112fcbe70>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._readinto1'>, '__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 0x000000015c25b960>
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 0x000000015c25b960>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._readinto1'>, '__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_readinto1'>, '__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 0x0000000123343fd8>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._readinto1'>, '__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 0x000000015c25b920>
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 0x000000015c25b920>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._readinto1'>, '__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_readinto1'>, '__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_readinto1'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_readinto1'>
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:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_readinto1'>, space = StdObjSpace
target = <function test_readinto1 at 0x0000000112388bd8>
args = (StdObjSpace, <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000000015bf7bd38>)
e = OperationError(<W_TypeObject 'LookupError' at 0x1119864b8>)
tb = <traceback object at 0x0000000145bacda0>
appexcinfo = <AppExceptionInfo LookupError: unknown encoding: utf-8>
def execute_appex(self, space, target, *args):
self.space = space
space.getexecutioncontext().set_sys_exc_info(None)
try:
> target(*args)
tool/pytest/apptest.py:281:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
args_w = (<pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000000015bf7bd38>,)
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)
interpreter/gateway.py:1402:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='[/Users/matti/build-worker-arm64/own-macos-arm64/build/pypy/module/_io/test/test_bufferedio.py:210]'>
space = StdObjSpace, name = 'test_readinto1'
def wget(self, space, name):
> w_globals = self.getwdict(space)
interpreter/gateway.py:1393:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='[/Users/matti/build-worker-arm64/own-macos-arm64/build/pypy/module/_io/test/test_bufferedio.py:210]'>
space = StdObjSpace
def getwdict(self, space): # no cache
> return build_applevel_dict(self, space)
interpreter/gateway.py:1498:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='[/Users/matti/build-worker-arm64/own-macos-arm64/build/pypy/module/_io/test/test_bufferedio.py:210]'>
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 = 'def test_readinto1(self):\n import _io\n\n class MockIO(_io._IOBase):\n def readable(self):\..._io.BufferedWriter(MockIO(), buffer_size=10)\n raises(_io.UnsupportedOperation, bufio.readinto1, bytearray(10))'
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x0000000145bd2f38>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x0000000145bd2f38>)
hidden_applevel = False
filename = '[/Users/matti/build-worker-arm64/own-macos-arm64/build/pypy/module/_io/test/test_bufferedio.py:210]'
@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)
interpreter/baseobjspace.py:1402:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
filename = '[/Users/matti/build-worker-arm64/own-macos-arm64/build/pypy/module/_io/test/test_bufferedio.py:210]'
source = 'def test_readinto1(self):\n import _io\n\n class MockIO(_io._IOBase):\n def readable(self):\..._io.BufferedWriter(MockIO(), buffer_size=10)\n raises(_io.UnsupportedOperation, bufio.readinto1, bytearray(10))'
mode = 'exec', flags = 0, hidden_applevel = False, ast_transform = None
@not_rpython
def _cached_compile(self, filename, source, mode, flags, hidden_applevel, ast_transform=None):
import os
from hashlib import md5
from rpython.config.translationoption import CACHE_DIR
from rpython.tool.gcc_cache import try_atomic_write
from pypy.module.marshal import interp_marshal
from pypy.interpreter.pycode import default_magic
h = md5(str(default_magic))
h.update(filename)
h.update(source)
h.update(mode)
h.update(str(flags))
h.update(str(hidden_applevel))
addition = ''
if ast_transform:
addition = ast_transform.func_name
cachename = os.path.join(
CACHE_DIR, "applevel_exec_%s_%s" % (addition, h.hexdigest()))
try:
if self.config.translating:
raise IOError("don't use the cache when translating pypy")
with open(cachename, 'rb') as f:
w_bin = self.newbytes(f.read())
> w_code = interp_marshal._loads(self, w_bin, hidden_applevel)
interpreter/baseobjspace.py:1436:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_str = W_BytesObject('\xe3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0...00\x00\x00\x01\x01I6\x01\x01I6\x01\x01I6\x01\x01I6\x01\x01I6s\x00\x00\x00\x00')
hidden_applevel = False
def _loads(space, w_str, hidden_applevel=False):
u = StringUnmarshaller(space, w_str, hidden_applevel=hidden_applevel)
try:
> obj = u.load_w_obj()
module/marshal/interp_marshal.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.marshal.interp_marshal.StringUnmarshaller object at 0x0000000145bd30c0>
allow_null = False
def load_w_obj(self, allow_null=False):
try:
> return self._get_w_obj(allow_null)
module/marshal/interp_marshal.py:420:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.marshal.interp_marshal.StringUnmarshaller object at 0x0000000145bd30c0>
allow_null = False
def _get_w_obj(self, allow_null=False):
space = self.space
tc = self.get1()
typecode = ord(tc)
save_ref = bool(typecode & FLAG_REF)
typecode = chr(typecode & ~FLAG_REF)
bad = False
index = len(self.refs_w)
w_ret = None
if save_ref:
self.refs_w.append(None)
for current_tc, func, save_ref_in_func in _unmarshallers_unroll:
if current_tc == typecode:
if save_ref_in_func:
save_ref = False
> w_ret = func(space, self, tc)
module/marshal/interp_marshal.py:406:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
u = <pypy.module.marshal.interp_marshal.StringUnmarshaller object at 0x0000000145bd30c0>
tc = '\xe3'
@unmarshaller(TYPE_CODE, save_ref=True)
def unmarshal_pycode(space, u, tc):
w_codeobj = objectmodel.instantiate(PyCode)
u.save_ref(tc, w_codeobj)
argcount = u.get_int()
posonlyargcount = u.get_int()
kwonlyargcount = u.get_int()
nlocals = u.get_int()
stacksize = u.get_int()
flags = u.get_int()
code = space.bytes_w(u.load_w_obj())
> consts_w = _unmarshal_tuple_w(u)
objspace/std/marshal_impl.py:437:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
u = <pypy.module.marshal.interp_marshal.StringUnmarshaller object at 0x0000000145bd30c0>
def _unmarshal_tuple_w(u):
> w_obj = u.load_w_obj()
objspace/std/marshal_impl.py:418:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.marshal.interp_marshal.StringUnmarshaller object at 0x0000000145bd30c0>
allow_null = False
def load_w_obj(self, allow_null=False):
try:
> return self._get_w_obj(allow_null)
E OpErrFmt: [<W_TypeObject 'LookupError' at 0x1119864b8>: W_BaseExceptionUserWeakrefable([W_UnicodeObject('unknown encoding: utf-8')])]
module/marshal/interp_marshal.py:420: OpErrFmt
builder: own-macos-arm64 build #1354+
test: pypy/module/_io/test/test_bufferedio.py::AppTestBufferedReaderWithThreads::()::test_readinto1