[pypy-commit] pypy py3.5: Fix for cpyext test_translate when run after test_buffer. Not sure why

arigo pypy.commits at gmail.com
Mon Aug 27 16:24:34 EDT 2018


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r95032:06709625320e
Date: 2018-08-27 22:23 +0200
http://bitbucket.org/pypy/pypy/changeset/06709625320e/

Log:	Fix for cpyext test_translate when run after test_buffer. Not sure
	why but it must be something like the thread support in the
	embedding mode of cffi.

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -200,6 +200,10 @@
                default=False,
                requires=[("objspace.usemodules.cpyext", False)]),
 
+    BoolOption("disable_entrypoints_in_cffi",
+               "Disable only cffi's embedding mode.",
+               default=False),
+
     BoolOption("fstrings",
                "if you are really convinced that f-strings are a security "
                "issue, you can disable them here",
diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py
--- a/pypy/module/_cffi_backend/__init__.py
+++ b/pypy/module/_cffi_backend/__init__.py
@@ -71,7 +71,8 @@
     def __init__(self, space, *args):
         MixedModule.__init__(self, space, *args)
         #
-        if not space.config.objspace.disable_entrypoints:
+        if (not space.config.objspace.disable_entrypoints and
+            not space.config.objspace.disable_entrypoints_in_cffi):
             # import 'embedding', which has the side-effect of registering
             # the 'pypy_init_embedded_cffi_module' entry point
             from pypy.module._cffi_backend import embedding
diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -136,10 +136,11 @@
 
 class LeakCheckingTest(object):
     """Base class for all cpyext tests."""
-    spaceconfig = dict(usemodules=['cpyext', 'thread', 'struct', 'array',
+    spaceconfig = {"usemodules" : ['cpyext', 'thread', 'struct', 'array',
                                    'itertools', 'time', 'binascii', 'mmap',
                                    '_cffi_backend',
-                                   ])
+                                   ],
+                   "objspace.disable_entrypoints_in_cffi": True}
 
     @classmethod
     def preload_builtins(cls, space):


More information about the pypy-commit mailing list