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

rlib/test/test_rsiphash.py::test_translated

def test_translated():
        d1 = {"foo": 123}
        d2 = {u"foo": 456, u"\u1234\u5678": 789}
        class G:
            pass
        g = G()
        g.v1 = d1.copy()
        g.v2 = d2.copy()
    
        def fetch(n):
            if n == 0: return d1.get("foo", -1)
            if n == 1: return g.v1.get("foo", -1)
            if n == 2: return compute_hash("foo")
            if n == 3: return d2.get(u"foo", -1)
            if n == 4: return g.v2.get(u"foo", -1)
            if n == 5: return compute_hash(u"foo")
            if n == 6: return d2.get(u"\u1234\u5678", -1)
            if n == 7: return g.v2.get(u"\u1234\u5678", -1)
            if n == 8: return compute_hash(u"\u1234\u5678")
            assert 0
    
        def entrypoint(n):
            enable_siphash24()
            g.v1["bar"] = -2
            g.v2[u"bar"] = -2
            if n >= 0:    # get items one by one, because otherwise it may
                          # be the case that one line influences the next
                return str(fetch(n))
            else:
                # ...except in random mode, because we want all results
                # to be computed with the same seed
                return ' '.join([str(fetch(n)) for n in range(9)])
    
>       fn = compile(entrypoint, [int])

rlib\test\test_rsiphash.py:131: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
translator\c\test\test_genc.py:110: in compile
    t.annotate()
translator\interactive.py:83: in annotate
    return self.driver.annotate()
translator\driver.py:108: in proc
    return self.proceed(backend_goal)
translator\driver.py:569: in proceed
    result = self._execute(goals, task_skip = self._maybe_skip())
translator\tool\taskengine.py:114: in _execute
    res = self._do(goal, taskcallable, *args, **kwds)
translator\driver.py:278: in _do
    res = func()
translator\driver.py:315: in task_annotate
    s = annotator.build_types(self.entry_point, self.inputtypes)
annotator\annrpython.py:92: in build_types
    return self.build_graph_types(flowgraph, inputs_s, complete_now=complete_now)
annotator\annrpython.py:140: in build_graph_types
    self.complete()
annotator\annrpython.py:229: in complete
    self.complete_pending_blocks()
annotator\annrpython.py:224: in complete_pending_blocks
    self.processblock(graph, block)
annotator\annrpython.py:398: in processblock
    self.flowin(graph, block)
annotator\annrpython.py:501: in flowin
    self.consider_op(op)
annotator\annrpython.py:653: in consider_op
    resultcell = op.consider(self)
flowspace\operation.py:104: in consider
    return spec(annotator, *self.args)
annotator\unaryop.py:118: in simple_call_SomeObject
    return s_func.call(argspec)
annotator\unaryop.py:987: in call
    return bookkeeper.pbc_call(self, args)
annotator\bookkeeper.py:535: in pbc_call
    results.append(desc.pycall(whence, args, s_previous_result, op))
annotator\description.py:285: in pycall
    graph = self.specialize(inputcells, op)
annotator\description.py:279: in specialize
    return self.specializer(self, inputcells, op)
annotator\specialize.py:370: in specialize_call_location
    return maybe_star_args(funcdesc, (op,), args_s)
annotator\specialize.py:327: in maybe_star_args
    return funcdesc.cachedgraph(key, builder=builder)
annotator\description.py:247: in cachedgraph
    graph = self.buildgraph(alt_name, builder)
annotator\description.py:210: in buildgraph
    graph = translator.buildflowgraph(self.pyobj)
translator\translator.py:78: in buildflowgraph
    graph = build_flow(func)
flowspace\objspace.py:49: in build_flow
    ctx.build_flow()
flowspace\flowcontext.py:405: in build_flow
    self.record_block(block)
flowspace\flowcontext.py:413: in record_block
    next_offset = self.handle_bytecode(next_offset)
flowspace\flowcontext.py:492: in handle_bytecode
    offset = getattr(self, methodname)(oparg)
flowspace\flowcontext.py:670: in IMPORT_NAME
    w_obj = self.import_name(modulename, glob, None, fromlist, level)
flowspace\flowcontext.py:660: in import_name
    mod = __import__(name, glob, loc, frm, level)
rlib\_rsocket_rffi.py:1582: in <module>
    _WSAGetLastError()
rtyper\lltypesystem\lltype.py:1384: in __call__
    return callb(*args)
rtyper\lltypesystem\ll2ctypes.py:1339: in __call__
    self.natural_arity)
rtyper\lltypesystem\ll2ctypes.py:1236: in get_ctypes_callable
    symbolic=True)
translator\tool\cbuild.py:345: in compile_shared_lib
    standalone=False))
translator\platform\__init__.py:58: in compile
    return self._finish_linking(ofiles, eci, outputfilename, standalone)
translator\platform\__init__.py:235: in _finish_linking
    return self._link(cc_link, ofiles, largs, standalone, exe_name)
translator\platform\windows.py:303: in _link
    self._execute_c_compiler(self.link, args, exe_name)
translator\platform\__init__.py:143: in _execute_c_compiler
    self._handle_error(returncode, stdout, stderr, outname)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <MsvcPlatform cc=cl.exe>, returncode = 3221225477, stdout = ''
stderr = ''
outname = local('d:\\systemtemp\\pytest\\usession-main-527\\shared_cache\\externmod_1.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           	""")

translator\platform\windows.py:319: CompilationError
---------- Captured stderr call ----------
[platform:msg] Updated environment with vsver 160, using x64 True
[flowgraph] (rpython.translator.c.test.test_genc:66)entry_point
[translation:info] Annotating&simplifying...
[translation:info] with policy: rpython.annotator.policy.AnnotatorPolicy
[flowgraph] (rpython.rlib.test.test_rsiphash:119)entrypoint
[flowgraph] (rpython.rlib.rsiphash:63)initialize_from_env
[flowgraph] (rpython.rlib.test.test_rsiphash:107)fetch
[flowgraph] (rpython.rtyper.controllerentry:80)getattr
[flowgraph] (rpython.rlib.rposix_environ:66)get_get
[flowgraph] (rpython.flowspace.specialcase:76)rpython_print_item
[flowgraph] (rpython.rtyper.lltypesystem.rffi:1466)scoped_view_charp.__init__
[flowgraph] (rpython.rtyper.lltypesystem.rffi:1470)scoped_view_charp.__enter__
[flowgraph] (rpython.rtyper.lltypesystem.rffi:934)get_nonmovingbuffer_ll_final_null
[flowgraph] (rpython.rtyper.lltypesystem.rffi:881)get_nonmovingbuffer_ll
[flowgraph] (rpython.rlib.objectmodel:315)we_are_translated_to_c
[flowgraph] (rpython.rlib.rurandom:35)urandom
[flowgraph] (rpython.rlib.rposix:500)write
[flowgraph] (rpython.rtyper.lltypesystem.rffi:1448)scoped_nonmovingbuffer.__init__
[flowgraph] (rpython.rtyper.lltypesystem.rffi:1452)scoped_nonmovingbuffer.__enter__
[flowgraph] (rpython.rtyper.lltypesystem.lltype:2296)scoped_alloc
[flowgraph] (rpython.rtyper.lltypesystem.lltype:2280)ScopedAlloc_Array of UCHAR {'nolength': True} .__init__
[flowgraph] (rpython.rtyper.lltypesystem.lltype:2286)ScopedAlloc_Array of UCHAR {'nolength': True} .__enter__
[flowgraph] (rpython.rtyper.lltypesystem.rstr:116)copy_string_to_raw
[flowgraph] (rpython.rtyper.lltypesystem.rstr:63)_get_raw_buf
[flowgraph] (rpython.rtyper.lltypesystem.rstr:57)_str_ofs
[flowgraph] (rpython.rtyper.lltypesystem.llmemory:411)sizeof
[flowgraph] (rpython.rtyper.lltypesystem.lltype:2296)scoped_alloc
[flowgraph] (rpython.rtyper.lltypesystem.rffi:278)wrap_write
[flowgraph] (rpython.rtyper.lltypesystem.rffi:278)BCryptGenRandom
[flowgraph] (rpython.translator.c.test.test_genc:39)llrepr_out
[flowgraph] (rpython.rtyper.lltypesystem.lltype:2289)ScopedAlloc_Array of UCHAR {'nolength': True} .__exit__
[flowgraph] (rpython.rtyper.lltypesystem.rffi:3)ccall_BCryptGenRandom
[flowgraph] (rpython.rlib.rgil:160)release
[flowgraph] (rpython.rtyper.lltypesystem.rffi:1454)scoped_nonmovingbuffer.__exit__
[flowgraph] (rpython.rtyper.lltypesystem.rffi:945)free_nonmovingbuffer_ll
[flowgraph] (rpython.rtyper.lltypesystem.rffi:3)ccall_wrap_write
[flowgraph] (rpython.rlib.rposix:151)_errno_before
[flowgraph] (rpython.rlib.rthread:349)getraw
[flowgraph] (rpython.rlib.rthread:349)getraw
[flowgraph] (rpython.rlib.rthread:349)getraw
[flowgraph] (rpython.rlib.rthread:349)getraw
[flowgraph] (rpython.rtyper.lltypesystem.rffi:1472)scoped_view_charp.__exit__
[flowgraph] (rpython.rtyper.lltypesystem.lltype:2280)ScopedAlloc_Array of * Array of Char {'nolength': True}  {'nolength': True} .__init__
[flowgraph] (rpython.rlib.rposix:170)_errno_after
 (somefailed=True in rlib/test/test_rsiphash.py)
builder: rpython-win-x86-64 build #460+
test: rlib/test/test_rsiphash.py::test_translated