Add a test case for exception pickling. args is never NULL.
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 076d84d..b4a766e 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -270,6 +270,8 @@
'winerror' : 1 }))
except NameError: pass
+import pickle, random
+
for args in exceptionList:
expected = args[-1]
try:
@@ -283,3 +285,14 @@
( repr(e), checkArgName,
repr(expected[checkArgName]),
repr(getattr(e, checkArgName)) ))
+
+ # test for pickling support
+ new = pickle.loads(pickle.dumps(e, random.randint(0, 2)))
+ for checkArgName in expected.keys():
+ if repr(getattr(e, checkArgName)) != repr(expected[checkArgName]):
+ raise TestFailed('Checking unpickled exception arguments, '
+ 'exception '
+ '"%s", attribute "%s" expected %s got %s.' %
+ ( repr(e), checkArgName,
+ repr(expected[checkArgName]),
+ repr(getattr(e, checkArgName)) ))