summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>2010-08-05 15:02:20 +0200
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>2010-08-05 15:02:20 +0200
commiteb863416cde2c7b7a7ab8f70b5bac4b4fc4d8aee (patch)
tree8d7819f2133cbc68f701c7deec9a00ed1cca35f7
parent293bd0e85326a22effb5f10d1489014ecc617e59 (diff)
downloadportage-eb863416cde2c7b7a7ab8f70b5bac4b4fc4d8aee.tar.gz
portage-eb863416cde2c7b7a7ab8f70b5bac4b4fc4d8aee.tar.bz2
portage-eb863416cde2c7b7a7ab8f70b5bac4b4fc4d8aee.zip
Bug #330937: Handle IOError raised by remaining calls to array.fromfile().
-rw-r--r--pym/_emerge/PipeReader.py3
-rw-r--r--pym/_emerge/SpawnProcess.py3
-rw-r--r--pym/portage/package/ebuild/doebuild.py3
-rw-r--r--pym/portage/tests/ebuild/test_array_fromfile_eof.py3
-rw-r--r--pym/portage/util/_pty.py6
5 files changed, 10 insertions, 8 deletions
diff --git a/pym/_emerge/PipeReader.py b/pym/_emerge/PipeReader.py
index be958bcb2..2c3495c37 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 bacbc2f30..490b111f7 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 b9cbc3e0e..c8ec3fc23 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 3f2a6c7c5..c32a15cb0 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 7fba0e2ba..a4910ec70 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: