Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/_pyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Member

@bitdancer bitdancer Mar 25, 2017

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.

Copy link
Contributor Author

@DimitrisJim DimitrisJim Mar 25, 2017

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?

Copy link
Member

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.

self.raw.flush()

def close(self):
Expand Down Expand Up @@ -1214,7 +1214,7 @@ def flush(self):

def _flush_unlocked(self):
if self.closed:
raise ValueError("flush of closed file")
raise ValueError("flush on closed file")
while self._write_buf:
try:
n = self.raw.write(self._write_buf)
Expand Down
2 changes: 1 addition & 1 deletion Lib/asyncio/windows_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def handle(self):

def fileno(self):
if self._handle is None:
raise ValueError("I/O operatioon on closed pipe")
raise ValueError("I/O operation on closed pipe")
return self._handle

def close(self, *, CloseHandle=_winapi.CloseHandle):
Expand Down