diff options
author | Travis Oliphant <oliphant@enthought.com> | 2007-01-30 21:47:05 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2007-01-30 21:47:05 +0000 |
commit | 2ba9faa99b7f80a26fa6378f6797fca85f325e95 (patch) | |
tree | 6a9e20b5b79ae89575a91d6b3ca734fe9fc4db7e /numpy/lib/polynomial.py | |
parent | 8fcedfd0a2a99ac8270d417662ff0d98a266bcc8 (diff) | |
download | numpy-2ba9faa99b7f80a26fa6378f6797fca85f325e95.tar.gz |
Fix ticket #439 --- poly1d objects can now be pickled because an AttributeError is raised instead of the old KeyError when __getstate__ is accessed.
Diffstat (limited to 'numpy/lib/polynomial.py')
-rw-r--r-- | numpy/lib/polynomial.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py index 7026aeb67..ca61e34a3 100644 --- a/numpy/lib/polynomial.py +++ b/numpy/lib/polynomial.py @@ -614,7 +614,10 @@ class poly1d(object): 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 |