From e652a10a1e877e3411d93f45a40c3c25d911876f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 12 Aug 2010 23:58:22 -0700 Subject: [PATCH] Call pickle.load() directly on the input pipe, and handle exceptions. --- pym/_emerge/EbuildIpcDaemon.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pym/_emerge/EbuildIpcDaemon.py b/pym/_emerge/EbuildIpcDaemon.py index 0715dc1f0..5f3d2ed01 100644 --- a/pym/_emerge/EbuildIpcDaemon.py +++ b/pym/_emerge/EbuildIpcDaemon.py @@ -1,7 +1,6 @@ # Copyright 2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -import array import errno import pickle from portage import os @@ -31,14 +30,12 @@ class EbuildIpcDaemon(FifoIpcDaemon): if event & PollConstants.POLLIN: - buf = array.array('B') try: - buf.fromfile(self._files.pipe_in, self._bufsize) - except (EOFError, IOError): + obj = pickle.load(self._files.pipe_in) + except (EnvironmentError, EOFError, ValueError, + pickle.UnpicklingError): pass - - if buf: - obj = pickle.loads(buf.tostring()) + else: cmd_key = obj[0] cmd_handler = self.commands[cmd_key] reply = cmd_handler(obj) -- 2.26.2