Message112329
| Author |
ysj.ray |
| Recipients |
jnoller, nikratio, ysj.ray |
| Date |
2010年08月01日.14:04:25 |
| SpamBayes Score |
1.2058998e-05 |
| Marked as misclassified |
No |
| Message-id |
<1280671475.54.0.234252371984.issue9400@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2010年08月01日 14:04:35 | ysj.ray | set | recipients:
+ ysj.ray, jnoller, nikratio |
| 2010年08月01日 14:04:35 | ysj.ray | set | messageid: <1280671475.54.0.234252371984.issue9400@psf.upfronthosting.co.za> |
| 2010年08月01日 14:04:27 | ysj.ray | link | issue9400 messages |
| 2010年08月01日 14:04:26 | ysj.ray | create |
|