[pypy-svn] r74295 - pypy/branch/py-packagecontext/pypy/module/cpyext/test
afa at codespeak.net
afa at codespeak.net
Fri Apr 30 18:26:55 CEST 2010
Author: afa
Date: Fri Apr 30 18:26:54 2010
New Revision: 74295
Modified:
pypy/branch/py-packagecontext/pypy/module/cpyext/test/date.c
pypy/branch/py-packagecontext/pypy/module/cpyext/test/test_cpyext.py
Log:
Fix the refleaks in the test:
- PyImport_ImportModule returns a new reference which must be released,
- on Windows, "import os" allocates some extra memory ("CryptProvider"),
so add a first import in setup_class.
Modified: pypy/branch/py-packagecontext/pypy/module/cpyext/test/date.c
==============================================================================
--- pypy/branch/py-packagecontext/pypy/module/cpyext/test/date.c (original)
+++ pypy/branch/py-packagecontext/pypy/module/cpyext/test/date.c Fri Apr 30 18:26:54 2010
@@ -6,6 +6,8 @@
void initdate(void)
{
+ PyObject *module;
Py_InitModule("date", date_functions);
- PyImport_ImportModule("apple.banana");
+ module = PyImport_ImportModule("apple.banana");
+ Py_DECREF(module);
}
Modified: pypy/branch/py-packagecontext/pypy/module/cpyext/test/test_cpyext.py
==============================================================================
--- pypy/branch/py-packagecontext/pypy/module/cpyext/test/test_cpyext.py (original)
+++ pypy/branch/py-packagecontext/pypy/module/cpyext/test/test_cpyext.py Fri Apr 30 18:26:54 2010
@@ -133,6 +133,8 @@
def setup_class(cls):
cls.space = gettestobjspace(usemodules=['cpyext', 'thread'])
cls.space.getbuiltinmodule("cpyext")
+ from pypy.module.imp.importing import importhook
+ importhook(cls.space, "os") # warm up reference counts
def compile_module(self, name, **kwds):
state = self.space.fromcache(State)
@@ -360,7 +362,6 @@
def test_recursive_package_import(self):
- skip("not yet")
"""
If `cherry.date` is an extension module which imports `apple.banana`,
the latter is added to `sys.modules` for the `"apple.banana"` key.
More information about the Pypy-commit
mailing list