Commits

Maciej Fijalkowski committed 40fa4f3

Don't add BytesIO to autoflusher

  • Participants
  • Parent commits a920e89

Comments (0)

Files changed (2)

File pypy/module/_io/interp_bytesio.py

 
 class W_BytesIO(RStringIO, W_BufferedIOBase):
     def __init__(self, space):
-        W_BufferedIOBase.__init__(self, space)
+        W_BufferedIOBase.__init__(self, space, add_to_autoflusher=False)
         self.init()
 
     def descr_init(self, space, w_initial_bytes=None):

File pypy/module/_io/interp_iobase.py

 
 
 class W_IOBase(W_Root):
-    def __init__(self, space):
+    def __init__(self, space, add_to_autoflusher=True):
         # XXX: IOBase thinks it has to maintain its own internal state in
         # `__IOBase_closed` and call flush() by itself, but it is redundant
         # with whatever behaviour a non-trivial derived class will implement.
         self.space = space
         self.w_dict = space.newdict()
         self.__IOBase_closed = False
-        self.streamholder = None # needed by AutoFlusher
-        get_autoflusher(space).add(self)
+        if add_to_autoflusher:
+            self.streamholder = None # needed by AutoFlusher
+            get_autoflusher(space).add(self)
 
     def getdict(self, space):
         return self.w_dict