Skip to content

Commit 9b12b1b

Browse files
graingertblurb-it[bot]asvetlov
authoredFeb 23, 2022
bpo-46522: fix concurrent.futures and io AttributeError messages (GH-30887)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
1 parent 1f45536 commit 9b12b1b

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed
 

‎Lib/_pyio.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def __getattr__(name):
312312
global OpenWrapper
313313
OpenWrapper = open
314314
return OpenWrapper
315-
raise AttributeError(name)
315+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
316316

317317

318318
# In normal operation, both `UnsupportedOperation`s should be bound to the

‎Lib/concurrent/futures/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ def __getattr__(name):
5050
ThreadPoolExecutor = te
5151
return te
5252

53-
raise AttributeError(f"module {__name__} has no attribute {name}")
53+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

‎Lib/io.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def __getattr__(name):
7070
global OpenWrapper
7171
OpenWrapper = open
7272
return OpenWrapper
73-
raise AttributeError(name)
73+
raise AttributeError("module {__name__!r} has no attribute {name!r}")
7474

7575

7676
# Pretend this exception was created here.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make various module ``__getattr__`` AttributeErrors more closely match a typical AttributeError

0 commit comments

Comments
 (0)