Browse Source

Use file object's .closed instead of _istream_open

Matthew Wang 10 years ago
parent
commit
e83642c799
1 changed files with 1 additions and 3 deletions
  1. 1
    3
      cdiff.py

+ 1
- 3
cdiff.py View File

@@ -234,7 +234,6 @@ class PatchStreamForwarder(object):
234 234
         self._istream = istream
235 235
         self._translator = translator
236 236
 
237
-        self._istream_open = True
238 237
         self._set_non_block(self._translator.stdin)
239 238
         self._set_non_block(self._translator.stdout)
240 239
 
@@ -253,7 +252,6 @@ class PatchStreamForwarder(object):
253 252
                 break       # EAGAIN
254 253
         else:
255 254
             self._translator.stdin.close()
256
-            self._istream_open = False
257 255
 
258 256
     def __iter__(self):
259 257
         while True:
@@ -263,7 +261,7 @@ class PatchStreamForwarder(object):
263 261
                     return
264 262
                 yield line
265 263
             except IOError:
266
-                if self._istream_open:
264
+                if not self._translator.stdin.closed:
267 265
                     self._forward_until_block()
268 266
                 continue    # EAGAIN
269 267