Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-46522: fix concurrent.futures and io AttributeError messages #30887

Merged

Conversation

graingert
Copy link
Contributor

@graingert graingert commented Jan 25, 2022

@graingert
Copy link
Contributor Author

graingert commented Jan 25, 2022

other examples of module dunder AttributeError:

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

raise AttributeError(f'module {__name__!r} has no attribute {name!r}')

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

this one doesn't use {name!r} but '{name}':

raise AttributeError(f"module 'sqlite3' has no attribute '{name}'")

interestingly, this is actually the correct form:

>>> getattr(types.ModuleType("module with ' quote"), "attribute with ' quote")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'module with ' quote' has no attribute 'attribute with ' quote'
>>> 

so they should all be:

AttributeError(f"module '{__name__}' has no attribute '{name}'")

@graingert graingert changed the title fix concurrent.futures AttributeError message bpo-46522 fix concurrent.futures AttributeError message Jan 25, 2022
@graingert graingert changed the title bpo-46522 fix concurrent.futures AttributeError message bpo-46522 fix concurrent.futures and io AttributeError messages Jan 25, 2022
Copy link
Contributor

@MaxwellDupre MaxwellDupre left a comment

Ran all tests and got:
test_ioctl skipped -- Unable to open /dev/tty
But I note that there's a bug for this: Issue39813

Also unrelated: test_ossaudiodev failed

@asvetlov
Copy link
Contributor

asvetlov commented Feb 22, 2022

The error message text is changed. While the text is not a part of stable API and can be wildly changed, we usually don't do it in bugfix releases without a strong reason.
That's why I don't want to backport the PR.

@bedevere-bot
Copy link

bedevere-bot commented Feb 22, 2022

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@graingert graingert requested a review from asvetlov Feb 22, 2022
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
@graingert
Copy link
Contributor Author

graingert commented Feb 22, 2022

I have made the requested changes; please review again

@bedevere-bot
Copy link

bedevere-bot commented Feb 22, 2022

Thanks for making the requested changes!

@asvetlov: please review the changes made to this pull request.

@asvetlov asvetlov changed the title bpo-46522 fix concurrent.futures and io AttributeError messages bpo-46522: fix concurrent.futures and io AttributeError messages Feb 23, 2022
@asvetlov asvetlov merged commit 9b12b1b into python:main Feb 23, 2022
12 checks passed
@asvetlov
Copy link
Contributor

asvetlov commented Feb 23, 2022

thanks!

@graingert graingert deleted the fix-concurrent-futures-attribute-error branch Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants