[pypy-commit] pypy default: Disable autoflushing if we are translated without weakref support.

arigo noreply at buildbot.pypy.org
Mon Apr 16 18:40:00 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r54439:922cce43ab51
Date: 2012-04-16 18:37 +0200
http://bitbucket.org/pypy/pypy/changeset/922cce43ab51/

Log:	Disable autoflushing if we are translated without weakref support.

diff --git a/pypy/module/_io/interp_iobase.py b/pypy/module/_io/interp_iobase.py
--- a/pypy/module/_io/interp_iobase.py
+++ b/pypy/module/_io/interp_iobase.py
@@ -341,9 +341,13 @@
 
     def add(self, w_iobase):
         assert w_iobase.streamholder is None
-        holder = StreamHolder(w_iobase)
-        w_iobase.streamholder = holder
-        self.streams[holder] = None
+        if rweakref.has_weakref_support():
+            holder = StreamHolder(w_iobase)
+            w_iobase.streamholder = holder
+            self.streams[holder] = None
+        #else:
+        #   no support for weakrefs, so ignore and we
+        #   will not get autoflushing
 
     def remove(self, w_iobase):
         holder = w_iobase.streamholder


More information about the pypy-commit mailing list