summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorWarren Weckesser <warren.weckesser@gmail.com>2019-09-04 01:25:40 -0400
committerWarren Weckesser <warren.weckesser@gmail.com>2019-09-04 01:58:22 -0400
commit3238a0d7d003fb869ca106b18365162a78a7d4e0 (patch)
treed760c50f0c5a4536620f510a5d9f8de3ee30bded /numpy
parente3f4c536a0014789dbd0321926b4f62c39d73719 (diff)
downloadnumpy-3238a0d7d003fb869ca106b18365162a78a7d4e0.tar.gz
BUG: Fix format statement associated with AttributeError.
Before this fix, a reference such as `numpy.wxyz` produced an incorrect error message because of the invalid format specifiers in the error message string: >>> import numpy >>> numpy.wxyz Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/.../numpy/__init__.py", line 206, in __getattr__ "module %s has no attribute $s".format(__name__, attr)) AttributeError: module %s has no attribute $s After the fix: >>> import numpy >>> numpy.wxyz Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/.../numpy/__init__.py", line 206, in __getattr__ "{!r}".format(__name__, attr)) AttributeError: module 'numpy' has no attribute 'wxyz'
Diffstat (limited to 'numpy')
-rw-r--r--numpy/__init__.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py
index ae297597e..07d67945c 100644
--- a/numpy/__init__.py
+++ b/numpy/__init__.py
@@ -202,9 +202,8 @@ else:
from .testing import Tester
return Tester
else:
- raise AttributeError(
- "module %s has no attribute $s".format(__name__, attr))
-
+ raise AttributeError("module {!r} has no attribute "
+ "{!r}".format(__name__, attr))
def __dir__():
return __all__ + ['Tester', 'testing']