summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/EbuildIpcDaemon.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/_emerge/EbuildIpcDaemon.py')
-rw-r--r--pym/_emerge/EbuildIpcDaemon.py21
1 files changed, 4 insertions, 17 deletions
diff --git a/pym/_emerge/EbuildIpcDaemon.py b/pym/_emerge/EbuildIpcDaemon.py
index 93333a6b1..f6bfecfbe 100644
--- a/pym/_emerge/EbuildIpcDaemon.py
+++ b/pym/_emerge/EbuildIpcDaemon.py
@@ -29,26 +29,13 @@ class EbuildIpcDaemon(FifoIpcDaemon):
__slots__ = ('commands',)
def _input_handler(self, fd, event):
+ # Read the whole pickle in a single atomic read() call.
+ buf = self._read_buf(self._files.pipe_in, event)
- if event & PollConstants.POLLIN:
-
- # Read the whole pickle in a single read() call since
- # this stream is in non-blocking mode and pickle.load()
- # has been known to raise the following exception when
- # reading from a non-blocking stream:
- #
- # File "/usr/lib64/python2.6/pickle.py", line 1370, in load
- # return Unpickler(file).load()
- # File "/usr/lib64/python2.6/pickle.py", line 858, in load
- # dispatch[key](self)
- # File "/usr/lib64/python2.6/pickle.py", line 1195, in load_setitem
- # value = stack.pop()
- # IndexError: pop from empty list
-
- pickle_str = self._files.pipe_in.read()
+ if buf:
try:
- obj = pickle.loads(pickle_str)
+ obj = pickle.loads(buf.tostring())
except (EnvironmentError, EOFError, ValueError,
pickle.UnpicklingError):
pass