Skip to content

bpo-35950: Raise UnsupportedOperation in BufferedReader.truncate() #18586

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

Merged

Conversation

berkerpeksag
Copy link
Member

@berkerpeksag berkerpeksag commented Feb 21, 2020

The truncate() method of io.BufferedReader() should raise
UnsupportedOperation when it is called on a read-only
io.BufferedReader() instance.

https://bugs.python.org/issue35950

Automerge-Triggered-By: @methane

if (!self->writable) {
LEAVE_BUFFERED(self)
return bufferediobase_unsupported("truncate");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this code block before If (!ENTER_BUFFERED(self))?

The truncate() method of io.BufferedReader() should raise
UnsupportedOperation when it is called on a read-only
io.BufferedReader() instance.
@berkerpeksag berkerpeksag force-pushed the bpo-35950-truncate-read-only-v2 branch from 07ea7d9 to 5e4f7f6 Compare February 21, 2020 17:36
@miss-islington
Copy link
Contributor

@berkerpeksag: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit fd5116c into python:master Feb 21, 2020
@berkerpeksag berkerpeksag deleted the bpo-35950-truncate-read-only-v2 branch February 21, 2020 18:00
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.

5 participants