Ray.Allen <ysj....@gmail.com> added the comment:

This is because when an subprocess.CalledProcessError is raised, the 
CalledProcessError instance is picked through a socket and then read by 
"parent" process, but in fact CalledProcessError instances cannot be picked 
correctly. Because CalledProcessError extends PyExc_BaseException, which 
defines a __reduce__ method, that special method cause the pickle load to call 
the exception type's __init__ method with packed self.args as arguments. So if 
a subclass of "Exception" needs to behave correctly in pickling, it should make 
self.args meats its __init__ method's function signature. That is, ensure the 
calling to:
          self.__init__(*self.args)
has no problem. 

But CalledProcessError doesn't meat this requirement. Here is a patch fixing 
the CalledProcessError.__init__ to call its base class's __init__ to store its 
arguments in self.args, which can fix this bug.

----------
keywords: +patch
Added file: http://bugs.python.org/file18309/issue9400.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9400>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to