pypy/interpreter/test/test_syntax.py::AppTestSyntaxError::()::test_cpython_issue2382
self = <CallInfo when='call' exception: assert -11 == 19
+ where -11 = <function _check_utf8 at 0x00007fc9c12bc368>(*('Python = "\xe1\xb9\x94\xc3\xbd\xc5\xa3\xc4\xa5\xc3\xb2\xc3\xb1" +', True, 0, -1))>
func = <function <lambda> at 0x00007fc9c5274638>, 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_cpython_issue2382'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_cpython_issue2382'>}
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 0x00007fc9e806c9f8>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x00007fc9e8599a20>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_cpython_issue2382'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_cpython_issue2382'>}
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 0x00007fc9e8599a20>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_cpython_issue2382'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_cpython_issue2382'>}
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_cpython_issue2382'>, '__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 0x00007fc9ec620db8>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._issue2382'>, '__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 0x00007fca133f6d60>
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 0x00007fca133f6d60>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._issue2382'>, '__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_cpython_issue2382'>, '__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 0x00007fc9ec620d40>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._issue2382'>, '__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 0x00007fca133f6d20>
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 0x00007fca133f6d20>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i..._issue2382'>, '__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_cpython_issue2382'>, '__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_cpython_issue2382'>
def pytest_runtest_call(item):
try:
> item.runtest()
../_pytest/runner.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AppTestMethod 'test_cpython_issue2382'>
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_cpython_issue2382'>, space = StdObjSpace
target = <function test_cpython_issue2382 at 0x00007fc9c52746b0>
args = (StdObjSpace, <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x00007fc9ebde2218>)
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 0x00007fc9ebde2218>,)
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-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]'>
space = StdObjSpace, name = 'test_cpython_issue2382'
def wget(self, space, name):
> w_globals = self.getwdict(space)
interpreter/gateway.py:1393:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ApplevelClass filename='[/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]'>
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-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]'>
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_cpython_issue2382(self):\n code = \'Python = "\\u1e54\\xfd\\u0163\\u0125\\xf2\\xf1" +\'\n exc = raises(SyntaxError, compile, code, \'foo\', \'exec\')\n assert exc.value.offset in (19, 20) # pypy, cpython'
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x00007fca136d7d00>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x00007fca136d7d00>)
hidden_applevel = False
filename = '[/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]'
@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-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]'
source = 'def test_cpython_issue2382(self):\n code = \'Python = "\\u1e54\\xfd\\u0163\\u0125\\xf2\\xf1" +\'\n exc = raises(SyntaxError, compile, code, \'foo\', \'exec\')\n assert exc.value.offset in (19, 20) # pypy, cpython'
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)
except IOError:
# must (re)compile the source
ec = self.getexecutioncontext()
if ast_transform:
c = self.createcompiler()
tree = c.compile_to_ast(source, filename, "exec", 0)
tree = ast_transform(self, tree)
w_code = c.compile_ast(tree, filename, 'exec', 0)
else:
w_code = ec.compiler.compile(
> source, filename, mode, flags, hidden_applevel)
interpreter/baseobjspace.py:1447:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.pycompiler.PythonAstCompiler object at 0x00007fc9e94ad088>
source = 'def test_cpython_issue2382(self):\n code = \'Python = "\\u1e54\\xfd\\u0163\\u0125\\xf2\\xf1" +\'\n exc = raises(SyntaxError, compile, code, \'foo\', \'exec\')\n assert exc.value.offset in (19, 20) # pypy, cpython'
filename = '[/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]'
mode = 'exec', flags = 0, hidden_applevel = False, optimize = 0
def compile(self, source, filename, mode, flags=0, hidden_applevel=False,
optimize=-1):
if optimize == -1:
optimize = self.space.sys.get_optimize()
assert optimize >= 0
info = pyparse.CompileInfo(filename, mode, flags,
hidden_applevel=hidden_applevel, optimize=optimize)
mod = self._compile_to_ast(source, info)
> return self._compile_ast(mod, info, source)
interpreter/pycompiler.py:181:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.pycompiler.PythonAstCompiler object at 0x00007fc9e94ad088>
node = <pypy.interpreter.astcompiler.ast.Module object at 0x00007fc9c3a322c0>
info = <pypy.interpreter.pyparser.pyparse.CompileInfo object at 0x00007fca136d7e88>
source = 'def test_cpython_issue2382(self):\n code = \'Python = "\\u1e54\\xfd\\u0163\\u0125\\xf2\\xf1" +\'\n exc = raises(SyntaxError, compile, code, \'foo\', \'exec\')\n assert exc.value.offset in (19, 20) # pypy, cpython'
def _compile_ast(self, node, info, source=None):
from pypy.interpreter.astcompiler.unparse import unparse_annotations
space = self.space
try:
if info.flags & consts.CO_FUTURE_ANNOTATIONS:
node = unparse_annotations(space, node)
mod = optimize.optimize_ast(space, node, info)
> code = codegen.compile_ast(space, mod, info)
interpreter/pycompiler.py:140:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
module = <pypy.interpreter.astcompiler.ast.Module object at 0x00007fc9c3a322c0>
info = <pypy.interpreter.pyparser.pyparse.CompileInfo object at 0x00007fca136d7e88>
set_debug_flag = False
def compile_ast(space, module, info, set_debug_flag=False):
"""Generate a code object from AST."""
symbols = symtable.SymtableBuilder(space, module, info)
> return TopLevelCodeGenerator(space, module, symbols, info, set_debug_flag).assemble()
interpreter/astcompiler/codegen.py:23:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker <module> in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
space = StdObjSpace
tree = <pypy.interpreter.astcompiler.ast.Module object at 0x00007fc9c3a322c0>
symbols = <pypy.interpreter.astcompiler.symtable.SymtableBuilder object at 0x00007fc9c3a326b0>
compile_info = <pypy.interpreter.pyparser.pyparse.CompileInfo object at 0x00007fca136d7e88>
set_debug_flag = False
def __init__(self, space, tree, symbols, compile_info, set_debug_flag=False):
if not we_are_translated():
self._debug_flag = set_debug_flag # to set strategic pdbs
self.is_async_seen = False
PythonCodeGenerator.__init__(self, space, "<module>", tree, -1,
> symbols, compile_info, qualname=None)
interpreter/astcompiler/codegen.py:2783:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker <module> in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
space = StdObjSpace, name = '<module>'
tree = <pypy.interpreter.astcompiler.ast.Module object at 0x00007fc9c3a322c0>
lineno = -1
symbols = <pypy.interpreter.astcompiler.symtable.SymtableBuilder object at 0x00007fc9c3a326b0>
compile_info = <pypy.interpreter.pyparser.pyparse.CompileInfo object at 0x00007fca136d7e88>
qualname = None
def __init__(self, space, name, tree, lineno, symbols, compile_info,
qualname):
self.scope = symbols.find_scope(tree)
assemble.PythonCodeMaker.__init__(self, space, name, lineno,
self.scope, compile_info)
self.symbols = symbols
self.frame_blocks = []
self.interactive = False
self.temporary_name_counter = 1
self.qualname = qualname
self._allow_top_level_await = compile_info.flags & consts.PyCF_ALLOW_TOP_LEVEL_AWAIT
> self._compile(tree)
interpreter/astcompiler/codegen.py:260:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker <module> in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
tree = <pypy.interpreter.astcompiler.ast.Module object at 0x00007fc9c3a322c0>
def _compile(self, tree):
if isinstance(tree, ast.Module):
self.first_lineno = 1
self._maybe_setup_annotations()
> tree.walkabout(self)
interpreter/astcompiler/codegen.py:2790:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.astcompiler.ast.Module object at 0x00007fc9c3a322c0>
visitor = <PythonCodeMaker <module> in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
def walkabout(self, visitor):
> visitor.visit_Module(self)
interpreter/astcompiler/ast.py:197:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker <module> in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
mod = <pypy.interpreter.astcompiler.ast.Module object at 0x00007fc9c3a322c0>
def visit_Module(self, mod):
> self._handle_body(mod.body)
interpreter/astcompiler/codegen.py:486:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker <module> in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
body = [<pypy.interpreter.astcompiler.ast.FunctionDef object at 0x00007fc9c3a322f8>]
def _handle_body(self, body):
"""Compile a list of statements, handling doc strings if needed."""
if body:
start = 0
doc_expr = self.possible_docstring(body[0])
if doc_expr is not None:
start = 1
doc_expr.walkabout(self)
if doc_expr.lineno > 0:
self.update_position(doc_expr)
self.name_op("__doc__", ast.Store, doc_expr)
self.scope.doc_removable = True
> self._visit_body(body, start)
interpreter/astcompiler/codegen.py:468:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker <module> in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
body = [<pypy.interpreter.astcompiler.ast.FunctionDef object at 0x00007fc9c3a322f8>]
start = 0
def _visit_body(self, body, start=0):
if body is None:
return
for i in range(start, len(body)):
stmt = body[i]
if stmt is not None:
assert isinstance(stmt, ast.stmt)
if stmt.lineno > 0:
self.update_position(stmt)
> stmt.walkabout(self)
interpreter/astcompiler/codegen.py:505:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.astcompiler.ast.FunctionDef object at 0x00007fc9c3a322f8>
visitor = <PythonCodeMaker <module> in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
def walkabout(self, visitor):
> visitor.visit_FunctionDef(self)
interpreter/astcompiler/ast.py:434:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker <module> in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
func = <pypy.interpreter.astcompiler.ast.FunctionDef object at 0x00007fc9c3a322f8>
def visit_FunctionDef(self, func):
> self._visit_function(func, FunctionCodeGenerator)
interpreter/astcompiler/codegen.py:636:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker <module> in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
func = <pypy.interpreter.astcompiler.ast.FunctionDef object at 0x00007fc9c3a322f8>
function_code_generator = <class 'pypy.interpreter.astcompiler.codegen.FunctionCodeGenerator'>
@specialize.arg(2)
def _visit_function(self, func, function_code_generator):
# Load decorators first, but apply them after the function is created.
if func.decorator_list:
for dec in func.decorator_list:
if dec.lineno > 0:
self.update_position(dec)
dec.walkabout(self)
if func.lineno > 0:
self.update_position(func)
args = func.args
assert isinstance(args, ast.arguments)
oparg = 0
if args.defaults is not None and len(args.defaults):
oparg = oparg | 0x01
self._visit_defaults(args.defaults)
if args.kwonlyargs:
kw_default_count = self._visit_kwonlydefaults(args)
if kw_default_count:
oparg = oparg | 0x02
num_annotations = self._visit_annotations(func, args, func.returns)
if num_annotations:
oparg = oparg | 0x04
code, qualname = self.sub_scope(function_code_generator, func.name,
> func, func.lineno)
interpreter/astcompiler/codegen.py:624:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker <module> in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
kind = <class 'pypy.interpreter.astcompiler.codegen.FunctionCodeGenerator'>
name = 'test_cpython_issue2382'
node = <pypy.interpreter.astcompiler.ast.FunctionDef object at 0x00007fc9c3a322f8>
lineno = 1
def sub_scope(self, kind, name, node, lineno):
"""Convenience function for compiling a sub scope."""
if self.scope.lookup(name) == symtable.SCOPE_GLOBAL_EXPLICIT:
qualname = name
elif self.qualname:
if isinstance(self.scope, symtable.FunctionScope):
qualname = '%s.<locals>.%s' % (self.qualname, name)
else:
qualname = '%s.%s' % (self.qualname, name)
else:
qualname = name
generator = kind(self.space, name, node, lineno, self.symbols,
> self.compile_info, qualname)
interpreter/astcompiler/codegen.py:278:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker test_cpython_issue2382 in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
space = StdObjSpace, name = 'test_cpython_issue2382'
tree = <pypy.interpreter.astcompiler.ast.FunctionDef object at 0x00007fc9c3a322f8>
lineno = 1
symbols = <pypy.interpreter.astcompiler.symtable.SymtableBuilder object at 0x00007fc9c3a326b0>
compile_info = <pypy.interpreter.pyparser.pyparse.CompileInfo object at 0x00007fca136d7e88>
qualname = 'test_cpython_issue2382'
def __init__(self, space, name, tree, lineno, symbols, compile_info,
qualname):
self.scope = symbols.find_scope(tree)
assemble.PythonCodeMaker.__init__(self, space, name, lineno,
self.scope, compile_info)
self.symbols = symbols
self.frame_blocks = []
self.interactive = False
self.temporary_name_counter = 1
self.qualname = qualname
self._allow_top_level_await = compile_info.flags & consts.PyCF_ALLOW_TOP_LEVEL_AWAIT
> self._compile(tree)
interpreter/astcompiler/codegen.py:260:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker test_cpython_issue2382 in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
func = <pypy.interpreter.astcompiler.ast.FunctionDef object at 0x00007fc9c3a322f8>
def _compile(self, func):
assert isinstance(func, ast.FunctionDef)
self.first_lineno = func.lineno
if func.decorator_list and func.decorator_list[0].lineno > 0:
self.first_lineno = func.decorator_list[0].lineno
has_docstring = self.ensure_docstring_constant(func.body)
args = func.args
assert isinstance(args, ast.arguments)
self._init_argcounts(args)
start = 1 if has_docstring else 0
> self._visit_body(func.body, start)
interpreter/astcompiler/codegen.py:2859:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker test_cpython_issue2382 in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
body = [<pypy.interpreter.astcompiler.ast.Assign object at 0x00007fc9c3a75210>, <pypy.interpreter.astcompiler.ast.Assign object at 0x00007fc9c3a44950>, <pypy.interpreter.astcompiler.ast.Assert object at 0x00007fc9c3a32410>]
start = 0
def _visit_body(self, body, start=0):
if body is None:
return
for i in range(start, len(body)):
stmt = body[i]
if stmt is not None:
assert isinstance(stmt, ast.stmt)
if stmt.lineno > 0:
self.update_position(stmt)
> stmt.walkabout(self)
interpreter/astcompiler/codegen.py:505:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.astcompiler.ast.Assign object at 0x00007fc9c3a75210>
visitor = <PythonCodeMaker test_cpython_issue2382 in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
def walkabout(self, visitor):
> visitor.visit_Assign(self)
interpreter/astcompiler/ast.py:856:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker test_cpython_issue2382 in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
assign = <pypy.interpreter.astcompiler.ast.Assign object at 0x00007fc9c3a75210>
def visit_Assign(self, assign):
if self._optimize_unpacking(assign):
return
> assign.value.walkabout(self)
interpreter/astcompiler/codegen.py:1426:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.interpreter.astcompiler.ast.Constant object at 0x00007fc9c3a44ad8>
visitor = <PythonCodeMaker test_cpython_issue2382 in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
def walkabout(self, visitor):
> visitor.visit_Constant(self)
interpreter/astcompiler/ast.py:3715:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker test_cpython_issue2382 in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
expr = <pypy.interpreter.astcompiler.ast.Constant object at 0x00007fc9c3a44ad8>
def updater(self, expr):
assert isinstance(expr, ast.expr)
if expr.lineno > 0:
new_position_info = _get_positions_for_expr(expr)
else:
new_position_info = (-1,) * 4
old_position_info = self.position_info
self.position_info = new_position_info
try:
> return func(self, expr)
interpreter/astcompiler/codegen.py:235:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker test_cpython_issue2382 in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
const = <pypy.interpreter.astcompiler.ast.Constant object at 0x00007fc9c3a44ad8>
@update_pos_expr
def visit_Constant(self, const):
> self.load_const(const.value)
interpreter/astcompiler/codegen.py:1701:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker test_cpython_issue2382 in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
obj = W_UnicodeObject('Python = "\xe1\xb9\x94\xc3\xbd\xc5\xa3\xc4\xa5\xc3\xb2\xc3\xb1" +')
def load_const(self, obj):
if self.is_dead_code():
return
> index = self.add_const(obj)
interpreter/astcompiler/assemble.py:508:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <PythonCodeMaker test_cpython_issue2382 in [/Users/matti/build-worker-x86_64/own-macos-x86-64/build/pypy/interpreter/test/test_syntax.py:674]:1>
w_obj = W_UnicodeObject('Python = "\xe1\xb9\x94\xc3\xbd\xc5\xa3\xc4\xa5\xc3\xb2\xc3\xb1" +')
def add_const(self, w_obj):
"""Add a W_Root to the constant array and return its location."""
space = self.space
if isinstance(w_obj, PyCode):
# unlike CPython, never share code objects, it's pointless
w_key = space.id(w_obj)
else:
w_key = PyCode.const_comparison_key(self.space, w_obj)
w_len = space.finditem(self.w_consts, w_key)
if w_len is not None:
length = space.int_w(w_len)
else:
length = len(self.consts_w)
> w_obj = misc.intern_if_common_string(space, w_obj)
interpreter/astcompiler/assemble.py:497:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
space = StdObjSpace
w_const = W_UnicodeObject('Python = "\xe1\xb9\x94\xc3\xbd\xc5\xa3\xc4\xa5\xc3\xb2\xc3\xb1" +')
def intern_if_common_string(space, w_const):
# only intern identifier-like strings
from pypy.objspace.std.unicodeobject import _isidentifier
if (space.is_w(space.type(w_const), space.w_unicode) and
> _isidentifier(space.utf8_w(w_const))):
interpreter/astcompiler/misc.py:106:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = StdObjSpace
w_obj = W_UnicodeObject('Python = "\xe1\xb9\x94\xc3\xbd\xc5\xa3\xc4\xa5\xc3\xb2\xc3\xb1" +')
def utf8_w(self, w_obj):
> return w_obj.utf8_w(self)
interpreter/baseobjspace.py:1940:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = W_UnicodeObject('Python = "\xe1\xb9\x94\xc3\xbd\xc5\xa3\xc4\xa5\xc3\xb2\xc3\xb1" +')
space = StdObjSpace
def utf8_w(self, space):
> jit.record_known_result(self._length, rutf8._check_utf8, self._utf8, True, 0, -1)
objspace/std/unicodeobject.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
result = 19, func = <function _check_utf8 at 0x00007fc9c12bc368>
args = ('Python = "\xe1\xb9\x94\xc3\xbd\xc5\xa3\xc4\xa5\xc3\xb2\xc3\xb1" +', True, 0, -1)
llop = <rpython.rtyper.lltypesystem.lloperation._LLOP object at 0x00007fca10a40608>
@specialize.arg(1)
def record_known_result(result, func, *args):
""" Assure the JIT that func(*args) will produce result. func must be an
elidable function. """
from rpython.rtyper.lltypesystem.lloperation import llop
if not we_are_translated():
# consistency check
> assert func(*args) == result
E assert -11 == 19
E + where -11 = <function _check_utf8 at 0x00007fc9c12bc368>(*('Python = "\xe1\xb9\x94\xc3\xbd\xc5\xa3\xc4\xa5\xc3\xb2\xc3\xb1" +', True, 0, -1))
../rpython/rlib/jit.py:1231: AssertionError
builder: own-macos-x86-64 build #1268+
test: pypy/interpreter/test/test_syntax.py::AppTestSyntaxError::()::test_cpython_issue2382