Author: Antonio Cuni <anto.c...@gmail.com> Branch: Changeset: r53939:86cce9710b22 Date: 2012-03-23 11:48 +0100 http://bitbucket.org/pypy/pypy/changeset/86cce9710b22/
Log: bah :-( cpyext rely on some kind of global state which I could not sort out. As a consequence, if you try to instantiate two different objspaces in the same process, the second one explodes. The only way to make it working is to make sure that *all* gettestobjspace calls have they very same config: this way, there is a cache which reuses the already-built objspace, so we don't build a second one and things work. diff --git a/pypy/module/cpyext/test/conftest.py b/pypy/module/cpyext/test/conftest.py --- a/pypy/module/cpyext/test/conftest.py +++ b/pypy/module/cpyext/test/conftest.py @@ -10,7 +10,7 @@ return False def pytest_funcarg__space(request): - return gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi']) + return gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi', 'array']) def pytest_funcarg__api(request): return request.cls.api diff --git a/pypy/module/cpyext/test/test_api.py b/pypy/module/cpyext/test/test_api.py --- a/pypy/module/cpyext/test/test_api.py +++ b/pypy/module/cpyext/test/test_api.py @@ -19,7 +19,8 @@ class BaseApiTest(LeakCheckingTest): def setup_class(cls): - cls.space = space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi']) + cls.space = space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi', + 'array']) # warm up reference counts: # - the posix module allocates a HCRYPTPROV on Windows diff --git a/pypy/module/cpyext/test/test_arraymodule.py b/pypy/module/cpyext/test/test_arraymodule.py --- a/pypy/module/cpyext/test/test_arraymodule.py +++ b/pypy/module/cpyext/test/test_arraymodule.py @@ -6,7 +6,6 @@ class AppTestArrayModule(AppTestCpythonExtensionBase): enable_leak_checking = False - extra_modules = ['array'] def test_basic(self): module = self.import_module(name='array') 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 @@ -35,7 +35,7 @@ class AppTestApi: def setup_class(cls): - cls.space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi']) + cls.space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi', 'array']) from pypy.rlib.libffi import get_libc_name cls.w_libc = cls.space.wrap(get_libc_name()) @@ -165,11 +165,9 @@ return leaking class AppTestCpythonExtensionBase(LeakCheckingTest): - extra_modules = [] def setup_class(cls): - cls.space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi'] + - cls.extra_modules) + cls.space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi', 'array']) cls.space.getbuiltinmodule("cpyext") from pypy.module.imp.importing import importhook importhook(cls.space, "os") # warm up reference counts _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit