diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2014-11-30 12:20:48 -0500 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2014-11-30 12:20:48 -0500 |
commit | f7eb37f16d7abff1d11987dced498ce923088001 (patch) | |
tree | 5dd5ed4110f19da61f82479fcc480cb8e3675529 /numpy/lib/_iotools.py | |
parent | 665e52e8460cfb2e75e91bd70a60c813033fd8ed (diff) | |
parent | b82388e32ab4c717fd952fa4b8b0ece5512c9972 (diff) | |
download | numpy-f7eb37f16d7abff1d11987dced498ce923088001.tar.gz |
Merge pull request #5324 from Garrett-R/fix_bug_2917
BUG: Fixes #2917: numpy.lib._iotools.StringConverter.upgrade return
Diffstat (limited to 'numpy/lib/_iotools.py')
-rw-r--r-- | numpy/lib/_iotools.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py index 9108b2e4c..f2adcda10 100644 --- a/numpy/lib/_iotools.py +++ b/numpy/lib/_iotools.py @@ -27,6 +27,7 @@ else: _bytes_to_complex = complex _bytes_to_name = str + def _is_string_like(obj): """ Check whether obj behaves like a string. @@ -37,6 +38,7 @@ def _is_string_like(obj): return False return True + def _is_bytes_like(obj): """ Check whether obj behaves like a bytes object. @@ -445,6 +447,7 @@ class ConverterError(Exception): """ pass + class ConverterLockError(ConverterError): """ Exception raised when an attempt is made to upgrade a locked converter. @@ -452,6 +455,7 @@ class ConverterLockError(ConverterError): """ pass + class ConversionWarning(UserWarning): """ Warning issued when a string converter has a problem. @@ -708,7 +712,7 @@ class StringConverter(object): """ self._checked = True try: - self._strict_call(value) + return self._strict_call(value) except ValueError: # Raise an exception if we locked the converter... if self._locked: @@ -728,7 +732,7 @@ class StringConverter(object): self.default = self._initial_default else: self.default = default - self.upgrade(value) + return self.upgrade(value) def iterupgrade(self, value): self._checked = True |