Home - Summaries: (main) : (py3.11) : (py3.12) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

pypy/objspace/std/test/test_unicodeobject.py::AppTestUnicodeString::()::test_formatting_char

self = <CallInfo when='call' exception: [<W_TypeObject 'SyntaxError' at 0x1e011890>: W_SyntaxError([W_UnicodeObject("Missing ...3]'), W_IntObject(4), W_IntObject(13), W_UnicodeObject('            print num\n'), W_IntObject(4), W_IntObject(22))])]>
func = <function <lambda> at 0x286c2d90>, 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_formatting_char'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_formatting_char'>}

    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 0xf44c4df0>
hook = <_HookCaller 'pytest_runtest_call'>
methods = [<_pytest.vendored_packages.pluggy.HookImpl instance at 0x09755dfc>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_formatting_char'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_formatting_char'>}

    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 0x09755dfc>]
kwargs = {'__multicall__': <_MultiCall 0 results, 1 meths, kwargs={'item': <AppTestMethod 'test_formatting_char'>, '__multicall__': <_MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_formatting_char'>}

    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_formatting_char'>, '__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 0x2874c0b8>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...tting_char'>, '__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 0x286fac70>

    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 0x286fac70>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...tting_char'>, '__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_formatting_char'>, '__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 0x28745fd0>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...tting_char'>, '__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 0x286fac4c>

    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 0x286fac4c>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 1 meths, kwargs={'i...tting_char'>, '__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_formatting_char'>, '__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_formatting_char'>

    def pytest_runtest_call(item):
        try:
>           item.runtest()

../_pytest/runner.py:91: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <AppTestMethod 'test_formatting_char'>

    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_formatting_char'>, space = StdObjSpace
target = <function test_formatting_char at 0x28751050>
args = (StdObjSpace, <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x1c33d9f0>)
e = OperationError(<W_TypeObject 'SyntaxError' at 0x1e011890>)
tb = <traceback object at 0x2874b9e8>
appexcinfo = <AppExceptionInfo SyntaxError: Missing parentheses in call to 'print'. Did you mean print(num)? (test_unicodeobject.py:593], line 4)>

    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 0x1c33d9f0>,)

    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='[/buildbot/slave/own-linux-x86-32/build/pypy/objspace/std/test/test_unicodeobject.py:593]'>
space = StdObjSpace, name = 'test_formatting_char'

    def wget(self, space, name):
>       w_globals = self.getwdict(space)

interpreter/gateway.py:1393: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ApplevelClass filename='[/buildbot/slave/own-linux-x86-32/build/pypy/objspace/std/test/test_unicodeobject.py:593]'>
space = StdObjSpace

    def getwdict(self, space):    # no cache
>       return build_applevel_dict(self, space)

interpreter/gateway.py:1498: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ApplevelClass filename='[/buildbot/slave/own-linux-x86-32/build/pypy/objspace/std/test/test_unicodeobject.py:593]'>
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_formatting_char(self):\n        for num in range(0x80,0x100):\n            uchar = unichr(num)\n            ...  raises(UnicodeDecodeError, u"%c".__mod__, chr(num))\n            raises(UnicodeDecodeError, u"%s".__mod__, chr(num))'
w_globals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x28759f50>)
w_locals = W_ModuleDictObject(<pypy.objspace.std.celldict.ModuleDictStrategy object at 0x28759f50>)
hidden_applevel = False
filename = '[/buildbot/slave/own-linux-x86-32/build/pypy/objspace/std/test/test_unicodeobject.py:593]'

    @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:1413: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = StdObjSpace
filename = '[/buildbot/slave/own-linux-x86-32/build/pypy/objspace/std/test/test_unicodeobject.py:593]'
source = 'def test_formatting_char(self):\n        for num in range(0x80,0x100):\n            uchar = unichr(num)\n            ...  raises(UnicodeDecodeError, u"%c".__mod__, chr(num))\n            raises(UnicodeDecodeError, u"%s".__mod__, chr(num))'
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
    
        # Unlike rpython.tool.gcc_cache, the path below is used directly
        # without going through cache_file_path(), so CACHE_DIR may not
        # exist yet.  Create it here, otherwise try_atomic_write() fails
        # with ENOENT when this is the first writer to touch the cache.
        if not os.path.isdir(CACHE_DIR):
            try:
                os.makedirs(CACHE_DIR)
            except OSError:
                pass    # raced with another process; that is fine
        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:1467: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pypy.interpreter.pycompiler.PythonAstCompiler object at 0x1ce6ec90>
source = 'def test_formatting_char(self):\n        for num in range(0x80,0x100):\n            uchar = unichr(num)\n            ...  raises(UnicodeDecodeError, u"%c".__mod__, chr(num))\n            raises(UnicodeDecodeError, u"%s".__mod__, chr(num))'
filename = '[/buildbot/slave/own-linux-x86-32/build/pypy/objspace/std/test/test_unicodeobject.py:593]'
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)

interpreter/pycompiler.py:182: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pypy.interpreter.pycompiler.PythonAstCompiler object at 0x1ce6ec90>
source = 'def test_formatting_char(self):\n        for num in range(0x80,0x100):\n            uchar = unichr(num)\n            ...  raises(UnicodeDecodeError, u"%c".__mod__, chr(num))\n            raises(UnicodeDecodeError, u"%s".__mod__, chr(num))'
info = <pypy.interpreter.pyparser.pyparse.CompileInfo object at 0x2874ea30>

    def _compile_to_ast(self, source, info):
        space = self.space
        self.parser.reset()
        try:
            mod = self.parser.parse_source(source, info)
        except parseerror.TabError as e:
            raise OperationError(space.w_TabError,
                                 e.find_sourceline_and_wrap_info(space, source, info.filename))
        except parseerror.IndentationError as e:
            raise OperationError(space.w_IndentationError, e.find_sourceline_and_wrap_info(space, source, info.filename))
        except parseerror.SyntaxError as e:
            #import pdb;pdb.xpm()
>           raise OperationError(space.w_SyntaxError, e.find_sourceline_and_wrap_info(space, source, info.filename))
E           OperationError: [<W_TypeObject 'SyntaxError' at 0x1e011890>: W_SyntaxError([W_UnicodeObject("Missing parentheses in call to 'print'. Did you mean print(...)?"), W_TupleObject(W_UnicodeObject('[/buildbot/slave/own-linux-x86-32/build/pypy/objspace/std/test/test_unicodeobject.py:593]'), W_IntObject(4), W_IntObject(13), W_UnicodeObject('            print num\n'), W_IntObject(4), W_IntObject(22))])]

interpreter/pycompiler.py:172: OperationError
builder: own-linux-x86-32 build #9465+
test: pypy/objspace/std/test/test_unicodeobject.py::AppTestUnicodeString::()::test_formatting_char