-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
bpo-29904: Fix small exception typos in Lib #818
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
Conversation
@DimitrisJim, thanks for your PR! By analyzing the history of the files in this pull request, we identified @freddrake, @ambv and @benjaminp to be potential reviewers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would approve typo fixes, but the commit contains changes that can't be considered as typos.
Lib/asynchat.py
Outdated
@@ -191,8 +191,8 @@ def handle_close(self): | |||
|
|||
def push(self, data): | |||
if not isinstance(data, (bytes, bytearray, memoryview)): | |||
raise TypeError('data argument must be byte-ish (%r)', | |||
type(data)) | |||
raise TypeError('data argument must be a bytes-like object, not %r' % |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a typo. Open a new PR for this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!
Lib/configparser.py
Outdated
@@ -300,10 +300,10 @@ def __init__(self, source=None, filename=None): | |||
# Exactly one of `source'/`filename' arguments has to be given. | |||
# `filename' kept for compatibility. | |||
if filename and source: | |||
raise ValueError("Cannot specify both `filename' and `source'. " | |||
"Use `source'.") | |||
raise ValueError("Cannot specify both 'filename' and 'source'. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a typo. This is just a quoting style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like a really odd quotation style, though, it isn't used elsewhere in configparser.py
and that's why I considered it a 'typo'. Should I remove it nonetheless?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used in other modules. Yes, remove this change.
Lib/http/cookiejar.py
Outdated
@@ -1766,7 +1766,7 @@ def __init__(self, filename=None, delayload=False, policy=None): | |||
try: | |||
filename+"" | |||
except: | |||
raise ValueError("filename must be string-like") | |||
raise ValueError("filename must be of type str") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a typo. And proposed wording is not correct.
I addressed the issues you raised @serhiy-storchaka, thanks! Will now create a PR for the other issue. |
@@ -766,7 +766,7 @@ def truncate(self, pos=None): | |||
|
|||
def flush(self): | |||
if self.closed: | |||
raise ValueError("flush of closed file") | |||
raise ValueError("flush on closed file") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a typo, it is a wording choice. I don't see the point in changing it, and in fact as a native English speaker I think 'of' reads better here. To use 'on' you'd want to say "flush called on closed file object", which is wordier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered this a typo mainly due to the wording used on other methods such as tell
, truncate
, seek
(and some other ones). I might not see it but, is there anything special about flush
(that doesn't apply to the other methods) that warrants the use of of
instead of on
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. That's a good point. 'seek on' sounds right, as does 'tell on'. 'truncate on' doesn't. but to make it "right" I'd want it to be 'truncation of', which would lose the method name.
So, upon consideration consistency is better than "better English" in this case. Keep the change.
The code coverage failure is obviously unrelated. |
No description provided.