Hi Armin,
For the RPython module I added, I had added and passed test_ztranslation.py, and sucessfully built libpypy-c.so.
And in pypy console, it worked correctly.
The problem happened when I tried to use this RPython module for the existed RPython module in pypy/module.
The test I failed was test_ztranslation.py. It reported the error:
...
else:
if hasattr(pyobj, '__call__'):
msg = "object with a __call__ is not RPython"
else:
msg = "unexpected prebuilt constant"
> raise Exception("%s: %r" % (msg, pyobj)
E Exception: object with a __call__ is not RPython: <built-in function testFunc>
The corresponding line is where I used my RPython module:
myModule.testFunc()
---------------------------------------------------------------------
And here are my thoughts why I need to use RPython module:
I tried to implement a special lightweight sandbox or critical section to block certain builtin function.
One user scenario might look like this:
criticalSection.start()
criticalSection.block('select.epoll')
...some code in critical section...
criticcalSection.exit()
Different from "usual sandbox", we would like to only block some customized builtin functions for a segment of the code.
To achieve this purpose, here are my plans:
1. Write a builtin RPython module 'criticalsection', because I thought only builtin RPython module could be used for existed builtin RPython module
2. For the list of builtin functions that we might block, add the code in the begining of those functions, e.g.
def epoll:
if criticalsection.isInCriticalSection() and criticalsection.block('select.epoll')
return None
... the original code...