diff -r c96d5729a485 Lib/subprocess.py --- a/Lib/subprocess.py Sat Mar 17 13:34:13 2012 +0100 +++ b/Lib/subprocess.py Tue Apr 03 23:08:58 2012 +0200 @@ -361,6 +361,7 @@ check_output() will also store the output in the output attribute. """ def __init__(self, returncode, cmd, output=None): + self.args = returncode, cmd, output self.returncode = returncode self.cmd = cmd self.output = output diff -r c96d5729a485 Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py Sat Mar 17 13:34:13 2012 +0100 +++ b/Lib/test/test_subprocess.py Tue Apr 03 23:08:58 2012 +0200 @@ -14,6 +14,7 @@ import select import shutil import gc +import pickle try: import resource @@ -815,6 +816,11 @@ # communicate() will be interrupted by SIGUSR1 process.communicate() + def test_picklable_exception(self): + e = subprocess.CalledProcessError(1, 'ls') + e2 = pickle.loads(pickle.dumps(e)) + self.assertEqual(e.args, e2.args) + # context manager class _SuppressCoreFiles(object):