[pypy-svn] r62988 - pypy/trunk/pypy/translator/c
fijal at codespeak.net
fijal at codespeak.net
Tue Mar 17 10:23:58 CET 2009
Author: fijal
Date: Tue Mar 17 10:23:57 2009
New Revision: 62988
Modified:
pypy/trunk/pypy/translator/c/genc.py
Log:
(arigo, fijal)
Fix the segfault by keeping alive the whole ModuleWithCleanup by Wrapper
Modified: pypy/trunk/pypy/translator/c/genc.py
==============================================================================
--- pypy/trunk/pypy/translator/c/genc.py (original)
+++ pypy/trunk/pypy/translator/c/genc.py Tue Mar 17 10:23:57 2009
@@ -265,12 +265,13 @@
def __getattr__(self, name):
mod = self.__dict__['mod']
obj = getattr(mod, name)
+ parentself = self
if callable(obj) and getattr(obj, '__module__', None) == mod.__name__:
# The module must be kept alive with the function.
# This wrapper avoids creating a cycle.
class Wrapper:
def __init__(self, obj):
- self.mod = mod
+ self.myself = parentself
self.func = obj
def __call__(self, *args, **kwargs):
return self.func(*args, **kwargs)
More information about the Pypy-commit
mailing list