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

pypy/interpreter/test/test_main.py::TestMainPEP3120::()::test_pep3120

self = <pypy.interpreter.test.test_main.TestMainPEP3120 instance at 0x00007fc9eb720a60>

    def test_pep3120(self):
        # Ensure '日本' written to the file above is interpreted as utf-8
        # per PEP3120
        checkoutput(self.space, 'b' + repr(u'日本'.encode('utf-8')),
>                   main.run_file, str(testfn))

interpreter/test/test_main.py:107: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
interpreter/test/test_main.py:36: in checkoutput
    f(*(args + (space,)))
interpreter/main.py:74: in run_file
    run_string(istring, filename, space)
interpreter/main.py:62: in run_string
    _run_eval_string(source, filename, space, False)
interpreter/main.py:40: in _run_eval_string
    pycode = compilecode(space, source, filename or '<string>', cmd)
interpreter/main.py:24: in compilecode
    space.newtext(cmd), space.newint(0), space.newint(0))
interpreter/mixedmodule.py:93: in call
    return self.space.call_function(w_builtin, *args_w)
interpreter/baseobjspace.py:1241: in call_function
    return self.call_args(w_func, args)
objspace/descroperation.py:192: in call_args
    return w_obj.call_args(args)
interpreter/function.py:81: in call_args
    w_res = self.getcode().funcrun(self, args)
interpreter/gateway.py:869: in funcrun
    return BuiltinCode.funcrun_obj(self, func, None, args)
interpreter/gateway.py:884: in funcrun_obj
    self.handle_exception(space, e)
interpreter/gateway.py:908: in handle_exception
    raise error.get_converted_unexpected_exception(space, e)
interpreter/gateway.py:878: in funcrun_obj
    w_result = activation._run(space, scope_w)
<2523-codegen /Users/matti/build-worker-x86_64/own-macos-x86-64/build/rpython/tool/sourcetools.py:200>:3: in _run
    return self.behavior(space, scope_w[0], space.fsencode_w(scope_w[1]), space.text_w(scope_w[2]), space.gateway_int_w(scope_w[3]), space.gateway_int_w(scope_w[4]), space.gateway_int_w(scope_w[5]), space.gateway_int_w(scope_w[6]))
module/__builtin__/compiling.py:86: in compile
    optimize=optimize)
interpreter/pycompiler.py:180: in compile
    mod = self._compile_to_ast(source, info)
interpreter/pycompiler.py:170: in _compile_to_ast
    raise OperationError(space.w_SyntaxError, e.find_sourceline_and_wrap_info(space, source, info.filename))
interpreter/pyparser/error.py:93: in find_sourceline_and_wrap_info
    text, space.newbytes(text), 'replace', False, make_replace_error_handler(space), True)
interpreter/unicodehelper.py:537: in _str_decode_utf8_slowpath
    return r, rutf8.check_utf8(r, True), pos
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

s = "print('\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd'.encode('utf-8'), end='')\n"
allow_surrogates = True, start = 0, stop = -1

    def check_utf8(s, allow_surrogates, start=0, stop=-1):
        """Check that 's' is a utf-8-encoded byte string.
    
        Returns the length (number of chars) or raise CheckError.
        If allow_surrogates is False, then also raise if we see any.
        Note also codepoints_in_utf8(), which also computes the length
        faster by assuming that 's' is valid utf-8.
        """
        res = _check_utf8(s, allow_surrogates, start, stop)
        if res >= 0:
            return res
>       raise CheckError(~res)
E       CheckError

../rpython/rlib/rutf8.py:362: CheckError
builder: own-macos-x86-64 build #1268+
test: pypy/interpreter/test/test_main.py::TestMainPEP3120::()::test_pep3120