Skip to content

Commit

Permalink
bpo-46522: fix concurrent.futures and io AttributeError messages (pyt…
Browse files Browse the repository at this point in the history
…honGH-30887)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
  • Loading branch information
3 people committed Feb 23, 2022
1 parent 1f45536 commit 9b12b1b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Lib/_pyio.py
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Lib/concurrent/futures/__init__.py
Expand Up @@ -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}")
2 changes: 1 addition & 1 deletion Lib/io.py
Expand Up @@ -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.
Expand Down
@@ -0,0 +1 @@
Make various module ``__getattr__`` AttributeErrors more closely match a typical AttributeError

0 comments on commit 9b12b1b

Please sign in to comment.