Help with asmmemmgr.py:_copy_to_raw_memory()

M A <[email protected]> Tue, 19 Oct 2021 14:47:08 -0400
Newsgroups gmane.comp.python.pypy
Message-ID <[email protected]>
Hi, I'm trying to call a C function from the asmmemmgr.py:_copy_to_raw_memory() function now. I tried following an example for malloc() and used llexternal() to make the call work. Here is what I tried:

        from rpython.translator.tool.cbuild import ExternalCompilationInfo
        info = ExternalCompilationInfo(includes=["pthread.h"])
        write_protect = rffi.llexternal("pthread_jit_write_protect_np", [lltype.Bool], lltype.Void)

This results in this error:
[translation:ERROR] Exception: A function calling locals() is not RPython.  Note that if you're translating code outside the PyPy repository, a likely cause is that py.test's --assert=rewrite mode is getting in the way.  You should copy the file pytest.ini from the root of the PyPy repository into your own project.


What am I doing wrong?