浏览代码

Remove explicit flush calls since line_buffering is enabled.

Jonas Borgström 11 年之前
父节点
当前提交
3193af5482
共有 3 个文件被更改,包括 2 次插入4 次删除
  1. 0 1
      attic/archive.py
  2. 2 2
      attic/archiver.py
  3. 0 1
      attic/repository.py

+ 0 - 1
attic/archive.py

@@ -497,7 +497,6 @@ class ArchiveChecker:
         if error:
         if error:
             self.error_found = True
             self.error_found = True
         print(msg, file=sys.stderr if error else sys.stdout)
         print(msg, file=sys.stderr if error else sys.stdout)
-        sys.stderr.flush()
 
 
     def identify_key(self, repository):
     def identify_key(self, repository):
         cdata = repository.get(next(self.chunks.iteritems())[0])
         cdata = repository.get(next(self.chunks.iteritems())[0])

+ 2 - 2
attic/archiver.py

@@ -611,8 +611,8 @@ Type "Yes I am sure" if you understand this and want to continue.\n""")
 def main():
 def main():
     # Make sure stdout and stderr have errors='replace') to avoid unicode
     # Make sure stdout and stderr have errors='replace') to avoid unicode
     # issues when print()-ing unicode file names
     # issues when print()-ing unicode file names
-    sys.stdout = io.TextIOWrapper(sys.stdout.buffer, sys.stdout.encoding, 'replace', line_buffering=sys.stdout.line_buffering)
-    sys.stderr = io.TextIOWrapper(sys.stderr.buffer, sys.stderr.encoding, 'replace', line_buffering=sys.stderr.line_buffering)
+    sys.stdout = io.TextIOWrapper(sys.stdout.buffer, sys.stdout.encoding, 'replace', line_buffering=True)
+    sys.stderr = io.TextIOWrapper(sys.stderr.buffer, sys.stderr.encoding, 'replace', line_buffering=True)
     archiver = Archiver()
     archiver = Archiver()
     try:
     try:
         exit_code = archiver.run(sys.argv[1:])
         exit_code = archiver.run(sys.argv[1:])

+ 0 - 1
attic/repository.py

@@ -244,7 +244,6 @@ class Repository(object):
             nonlocal error_found
             nonlocal error_found
             error_found = True
             error_found = True
             print(msg, file=sys.stderr)
             print(msg, file=sys.stderr)
-            sys.stderr.flush()
 
 
         assert not self._active_txn
         assert not self._active_txn
         try:
         try: