summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/_pyio.py2
-rw-r--r--Lib/concurrent/futures/__init__.py2
-rw-r--r--Lib/io.py2
-rw-r--r--Misc/NEWS.d/next/Library/2022-01-25-15-31-04.bpo-46522.tYAlX4.rst1
4 files changed, 4 insertions, 3 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index d711974..8f20c5e 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -312,7 +312,7 @@ def __getattr__(name):
global OpenWrapper
OpenWrapper = open
return OpenWrapper
- raise AttributeError(name)
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
# In normal operation, both `UnsupportedOperation`s should be bound to the
diff --git a/Lib/concurrent/futures/__init__.py b/Lib/concurrent/futures/__init__.py
index d746aea..292e886 100644
--- a/Lib/concurrent/futures/__init__.py
+++ b/Lib/concurrent/futures/__init__.py
@@ -50,4 +50,4 @@ def __getattr__(name):
ThreadPoolExecutor = te
return te
- raise AttributeError(f"module {__name__} has no attribute {name}")
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
diff --git a/Lib/io.py b/Lib/io.py
index 2a6140c..a205e00 100644
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -70,7 +70,7 @@ def __getattr__(name):
global OpenWrapper
OpenWrapper = open
return OpenWrapper
- raise AttributeError(name)
+ raise AttributeError("module {__name__!r} has no attribute {name!r}")
# Pretend this exception was created here.
diff --git a/Misc/NEWS.d/next/Library/2022-01-25-15-31-04.bpo-46522.tYAlX4.rst b/Misc/NEWS.d/next/Library/2022-01-25-15-31-04.bpo-46522.tYAlX4.rst
new file mode 100644
index 0000000..999863a
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-01-25-15-31-04.bpo-46522.tYAlX4.rst
@@ -0,0 +1 @@
+Make various module ``__getattr__`` AttributeErrors more closely match a typical AttributeError