diff options
author | Armin Rigo <arigo@tunes.org> | 2016-12-17 14:10:46 +0100 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2016-12-17 14:10:46 +0100 |
commit | 2d6211020d0b48546f0a839bcdb7330ce00ee71e (patch) | |
tree | 0e5a8cf10d0ca53c3b63953e10223fe120714465 /pypy | |
parent | Try to import 'embedding' from __init__(), which might allow us (diff) | |
download | pypy-2d6211020d0b48546f0a839bcdb7330ce00ee71e.tar.gz pypy-2d6211020d0b48546f0a839bcdb7330ce00ee71e.tar.bz2 pypy-2d6211020d0b48546f0a839bcdb7330ce00ee71e.zip |
Add the config option 'disable_entrypoints' for embedding PyPy together
with another RPython VM
Diffstat (limited to 'pypy')
-rw-r--r-- | pypy/config/pypyoption.py | 6 | ||||
-rw-r--r-- | pypy/goal/targetpypystandalone.py | 18 | ||||
-rw-r--r-- | pypy/module/_cffi_backend/__init__.py | 9 |
3 files changed, 23 insertions, 10 deletions
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py index 785e8217a8..03f49a42cf 100644 --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -190,6 +190,12 @@ pypy_optiondescription = OptionDescription("objspace", "Object Space Options", [ "make sure that all calls go through space.call_args", default=False), + BoolOption("disable_entrypoints", + "Disable external entry points, notably the" + " cpyext module and cffi's embedding mode.", + default=False, + requires=[("objspace.usemodules.cpyext", False)]), + OptionDescription("std", "Standard Object Space Options", [ BoolOption("withtproxy", "support transparent proxies", default=True), diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py index 13c4561dc9..998b92d85e 100644 --- a/pypy/goal/targetpypystandalone.py +++ b/pypy/goal/targetpypystandalone.py @@ -83,12 +83,18 @@ def create_entry_point(space, w_dict): return 1 return exitcode + return entry_point, get_additional_entrypoints(space) + + +def get_additional_entrypoints(space): # register the minimal equivalent of running a small piece of code. This # should be used as sparsely as possible, just to register callbacks - from rpython.rlib.entrypoint import entrypoint_highlevel from rpython.rtyper.lltypesystem import rffi, lltype + if space.config.objspace.disable_entrypoints: + return {} + @entrypoint_highlevel('main', [rffi.CCHARP, rffi.INT], c_name='pypy_setup_home') def pypy_setup_home(ll_home, verbose): @@ -188,11 +194,11 @@ def create_entry_point(space, w_dict): return -1 return 0 - return entry_point, {'pypy_execute_source': pypy_execute_source, - 'pypy_execute_source_ptr': pypy_execute_source_ptr, - 'pypy_init_threads': pypy_init_threads, - 'pypy_thread_attach': pypy_thread_attach, - 'pypy_setup_home': pypy_setup_home} + return {'pypy_execute_source': pypy_execute_source, + 'pypy_execute_source_ptr': pypy_execute_source_ptr, + 'pypy_init_threads': pypy_init_threads, + 'pypy_thread_attach': pypy_thread_attach, + 'pypy_setup_home': pypy_setup_home} # _____ Define and setup target ___ diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py index 88c687c653..1ceb407c75 100644 --- a/pypy/module/_cffi_backend/__init__.py +++ b/pypy/module/_cffi_backend/__init__.py @@ -71,10 +71,11 @@ class Module(MixedModule): def __init__(self, space, *args): MixedModule.__init__(self, space, *args) # - # import 'embedding', which has the side-effect of registering - # the 'pypy_init_embedded_cffi_module' entry point - from pypy.module._cffi_backend import embedding - embedding.glob.space = space + if not space.config.objspace.disable_entrypoints: + # import 'embedding', which has the side-effect of registering + # the 'pypy_init_embedded_cffi_module' entry point + from pypy.module._cffi_backend import embedding + embedding.glob.space = space def get_dict_rtld_constants(): |