[Numpy-svn] r3524 - trunk/numpy/lib

numpy-svn at scipy.org numpy-svn at scipy.org
Tue Jan 30 15:47:08 CST 2007


Author: oliphant
Date: 2007-01-30 15:47:05 -0600 (Tue, 30 Jan 2007)
New Revision: 3524

Modified:
   trunk/numpy/lib/polynomial.py
Log:
Fix ticket #439 --- poly1d objects can now be pickled because an AttributeError is raised instead of the old KeyError when __getstate__ is accessed.

Modified: trunk/numpy/lib/polynomial.py
===================================================================
--- trunk/numpy/lib/polynomial.py	2007-01-30 19:18:06 UTC (rev 3523)
+++ trunk/numpy/lib/polynomial.py	2007-01-30 21:47:05 UTC (rev 3524)
@@ -614,7 +614,10 @@
         elif key in ['o']:
             return self.order
         else:
-            return self.__dict__[key]
+            try:
+                return self.__dict__[key]
+            except KeyError:
+                raise AttributeError("'%s' has no attribute '%s'" % (self.__class__, key))
 
     def __getitem__(self, val):
         ind = self.order - val



More information about the Numpy-svn mailing list