[pypy-commit] pypy gc-del: haaaack to stop complaining at interpreter exit

arigo noreply at buildbot.pypy.org
Fri Apr 26 15:07:21 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: gc-del
Changeset: r63642:9aba857627db
Date: 2013-04-26 15:04 +0200
http://bitbucket.org/pypy/pypy/changeset/9aba857627db/

Log:	haaaack to stop complaining at interpreter exit

diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py
--- a/rpython/rlib/rgc.py
+++ b/rpython/rlib/rgc.py
@@ -277,8 +277,14 @@
 _finalizer_lock = [None]
 
 class _UntranslatedFinalizingObject(object):
+    import sys
     call_finalizer = None
     def __del__(self):
+        # haaaaaaaaaaaaaaack
+        try:
+            self.sys._getframe(1)
+        except ValueError:     # 'call stack is not deep enough'
+            return  # ignore, very likely called when shutting down
         g = object.__new__(self.original_class)
         g.__dict__ = self.dict
         _finalizer_queue.append((g, self.func))


More information about the pypy-commit mailing list