1

In order to get sandbox version of Pypy, first i build Pypy from source using this instruction:

pypy ../../rpython/bin/rpython -O2 --sandbox targetpypystandalone  

(Then I rename Pypy-c to Pypy-c-sandbox)

When i test:

./pyinteractive.py  

It works correctly but when i want to run sandbox version using this command:

./pyinteractive.py ../goal/pypy-c-sandbox

Following error appears:

[platform:execute] gcc -shared /tmp/usession-release-2.5.1-15/module_cache/module_0.o /tmp/usession-release-2.5.1-15/module_cache/module_1.o /tmp/usession-release-2.5.1-15/module_cache/module_2.o /tmp/usession-release-2.5.1-15/module_cache/module_3.o -pthread -Wl,--export-dynamic -lrt -o /tmp/usession-release-2.5.1-15/shared_cache/externmod.so
TypeError: compile() expected string without null bytes

What should I do to solve this issue?

Mazdak
  • 105,000
  • 18
  • 159
  • 188
Majid
  • 638
  • 6
  • 21
  • 1
    I had a very similar error playing with an earlier version of PyPy's sandbox because I switched from PyPy3 to PyPy2 without realizing it at some point, so ultimately the front end was treating wide Unicode strings as 8-bit strings. I'd say it's unlikely you made the same mistake as me, but if you did, the fix is simple: just trash it and redo it. :) – abarnert Apr 24 '15 at 11:58
  • 1
    The line `./pyinteractive.py ../goal/pypy-c-sandbox` makes no sense; it's like typing `python /usr/bin/python` and getting a SyntaxError. Where did you find it? – Armin Rigo Apr 24 '15 at 16:09
  • @ArminRigo in this link [link](http://pypy.org/features.html#sandboxing) pypy_interact.py path/to/pypy-sandbox I use this syntax and i think it brings me a sandbox interpreter. – Majid Apr 27 '15 at 04:25
  • @ArminRigo I have problem with adding modules (like time, random, ...) to sandbox version, Is there any option to add all (safe) python modules to sandbox ? – Majid Apr 27 '15 at 04:30

1 Answers1

2

You're misreading the docs: it's not pyinteractive.py path/to/pypy-sandbox. It's pypy_interact.py path/to/pypy-sandbox (from pypy/sandbox/).

The modules that work in the sandbox are in a very limited number. Recently even the time module stopped working there, so was removed. We'd welcome contributions, but more of the kind "continued support", which would include special support for more modules and a better pypy_interact.py --- the present one is only there for demo purposes.

Armin Rigo
  • 12,048
  • 37
  • 48