diff options
author | 2010-08-05 15:02:20 +0200 | |
---|---|---|
committer | 2010-08-05 15:02:20 +0200 | |
commit | eb863416cde2c7b7a7ab8f70b5bac4b4fc4d8aee (patch) | |
tree | 8d7819f2133cbc68f701c7deec9a00ed1cca35f7 /pym | |
parent | Simplify passing of the backtracking parameters from one graph (diff) | |
download | portage-multirepo-eb863416cde2c7b7a7ab8f70b5bac4b4fc4d8aee.tar.gz portage-multirepo-eb863416cde2c7b7a7ab8f70b5bac4b4fc4d8aee.tar.bz2 portage-multirepo-eb863416cde2c7b7a7ab8f70b5bac4b4fc4d8aee.zip |
Bug #330937: Handle IOError raised by remaining calls to array.fromfile().
Diffstat (limited to 'pym')
-rw-r--r-- | pym/_emerge/PipeReader.py | 3 | ||||
-rw-r--r-- | pym/_emerge/SpawnProcess.py | 3 | ||||
-rw-r--r-- | pym/portage/package/ebuild/doebuild.py | 3 | ||||
-rw-r--r-- | pym/portage/tests/ebuild/test_array_fromfile_eof.py | 3 | ||||
-rw-r--r-- | pym/portage/util/_pty.py | 6 |
5 files changed, 10 insertions, 8 deletions
diff --git a/pym/_emerge/PipeReader.py b/pym/_emerge/PipeReader.py index be958bcb..2c3495c3 100644 --- a/pym/_emerge/PipeReader.py +++ b/pym/_emerge/PipeReader.py @@ -71,7 +71,8 @@ class PipeReader(AbstractPollTask): buf = array.array('B') try: buf.fromfile(f, self._bufsize) - except EOFError: + # EOFError was raised in Python <2.6.6 and <2.7.1. + except (EOFError, IOError): pass if buf: diff --git a/pym/_emerge/SpawnProcess.py b/pym/_emerge/SpawnProcess.py index bacbc2f3..490b111f 100644 --- a/pym/_emerge/SpawnProcess.py +++ b/pym/_emerge/SpawnProcess.py @@ -210,7 +210,8 @@ class SpawnProcess(SubProcess): buf = array.array('B') try: buf.fromfile(self._files.process, self._bufsize) - except EOFError: + # EOFError was raised in Python <2.6.6 and <2.7.1. + except (EOFError, IOError): pass if buf: diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index b9cbc3e0..c8ec3fc2 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -1268,7 +1268,8 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero buf = array.array('B') try: buf.fromfile(f, buffsize) - except EOFError: + # EOFError was raised in Python <2.6.6 and <2.7.1. + except (EOFError, IOError): pass if not buf: eof = True diff --git a/pym/portage/tests/ebuild/test_array_fromfile_eof.py b/pym/portage/tests/ebuild/test_array_fromfile_eof.py index 3f2a6c7c..c32a15cb 100644 --- a/pym/portage/tests/ebuild/test_array_fromfile_eof.py +++ b/pym/portage/tests/ebuild/test_array_fromfile_eof.py @@ -28,7 +28,8 @@ class ArrayFromfileEofTestCase(TestCase): a = array.array('B') try: a.fromfile(f, len(input_bytes) + 1) - except EOFError: + # EOFError was raised in Python <2.6.6 and <2.7.1. + except (EOFError, IOError): # python-3.0 lost data here eof = True diff --git a/pym/portage/util/_pty.py b/pym/portage/util/_pty.py index 7fba0e2b..a4910ec7 100644 --- a/pym/portage/util/_pty.py +++ b/pym/portage/util/_pty.py @@ -95,10 +95,8 @@ def _test_pty_eof(): buf = array.array('B') try: buf.fromfile(master_file, 1024) - except EOFError: - eof = True - except IOError: - # This is where data loss occurs. + # EOFError was raised in Python <2.6.6 and <2.7.1. + except (EOFError, IOError): eof = True if not buf: |