From: Zac Medico Date: Fri, 13 Aug 2010 06:58:22 +0000 (-0700) Subject: Call pickle.load() directly on the input pipe, and handle exceptions. X-Git-Tag: v2.2_rc68~248 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e652a10a1e877e3411d93f45a40c3c25d911876f;p=portage.git Call pickle.load() directly on the input pipe, and handle exceptions. --- 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)