[pypy-commit] pypy inline-dict-ops: an obscure untested change about keeping alive ctypes structures by subarrays

fijal noreply at buildbot.pypy.org
Sun Jul 3 21:05:41 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: inline-dict-ops
Changeset: r45329:607f00164b89
Date: 2011-07-03 21:13 +0200
http://bitbucket.org/pypy/pypy/changeset/607f00164b89/

Log:	an obscure untested change about keeping alive ctypes structures by
	subarrays

diff --git a/pypy/rpython/lltypesystem/lltype.py b/pypy/rpython/lltypesystem/lltype.py
--- a/pypy/rpython/lltypesystem/lltype.py
+++ b/pypy/rpython/lltypesystem/lltype.py
@@ -1710,7 +1710,8 @@
         # Keep the parent array alive, we share the same allocation.
         # Don't do it if we are inside a GC object, though -- it's someone
         # else's job to keep the GC object alive
-        if typeOf(top_container(parent))._gckind == 'raw':
+        if (typeOf(top_container(parent))._gckind == 'raw' or
+            hasattr(top_container(parent)._storage, 'contents')):
             self._keepparent = parent
 
     def __str__(self):


More information about the pypy-commit mailing list