[pypy-svn] r77009 - in pypy/branch/gc-module/pypy: module/gc rpython/memory/gc

arigo at codespeak.net arigo at codespeak.net
Sat Sep 11 10:38:50 CEST 2010


Author: arigo
Date: Sat Sep 11 10:38:47 2010
New Revision: 77009

Modified:
   pypy/branch/gc-module/pypy/module/gc/referents.py
   pypy/branch/gc-module/pypy/rpython/memory/gc/inspect.py
Log:
Catch the RPython-level OSError.
Add a marker between the roots and the rest of the dump.


Modified: pypy/branch/gc-module/pypy/module/gc/referents.py
==============================================================================
--- pypy/branch/gc-module/pypy/module/gc/referents.py	(original)
+++ pypy/branch/gc-module/pypy/module/gc/referents.py	Sat Sep 11 10:38:47 2010
@@ -2,6 +2,7 @@
 from pypy.interpreter.baseobjspace import W_Root, Wrappable
 from pypy.interpreter.typedef import TypeDef
 from pypy.interpreter.gateway import ObjSpace
+from pypy.interpreter.error import wrap_oserror
 from pypy.rlib.objectmodel import we_are_translated
 
 
@@ -158,5 +159,8 @@
     are as get_rpy_type_index() and get_rpy_memory_usage() would return,
     and [addr1]..[addrn] are addresses of other objects that this object
     points to."""
-    rgc.dump_rpy_heap(fd)
+    try:
+        rgc.dump_rpy_heap(fd)
+    except OSError, e:
+        raise wrap_oserror(space, e)
 dump_rpy_heap.unwrap_spec = [ObjSpace, int]

Modified: pypy/branch/gc-module/pypy/rpython/memory/gc/inspect.py
==============================================================================
--- pypy/branch/gc-module/pypy/rpython/memory/gc/inspect.py	(original)
+++ pypy/branch/gc-module/pypy/rpython/memory/gc/inspect.py	Sat Sep 11 10:38:47 2010
@@ -172,6 +172,11 @@
             _hd_add_root,
             _hd_add_root)
         self.gc._heap_dumper = None
+        # a marker to mean "end of the roots"
+        self.write(0)
+        self.write(0)
+        self.write(0)
+        self.write(-1)
 
     def walk(self):
         while self.pending.non_empty():



More information about the Pypy-commit mailing list