bpo-33173: Return Underlying fileobj's Seekability in GzipFile.seekable#6303
bpo-33173: Return Underlying fileobj's Seekability in GzipFile.seekable#6303waltaskew wants to merge 1 commit intopython:masterfrom
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
c19e1d4 to
68b117f
Compare
| # See if we can use the seek and tell methods to seek | ||
| # to the current location. | ||
| try: | ||
| self.fileobj.seek(self.fileobj.tell()) |
There was a problem hiding this comment.
Why not seek(0, SEEK_CUR)? (typical implementation of tell)
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Would be nice to add tests.
| try: | ||
| self.fileobj.seek(self.fileobj.tell()) | ||
| return True | ||
| except (AttributeError, OSError, IOError): |
There was a problem hiding this comment.
IOError is an alias of OSError in Python 3.
68b117f to
eaa6e30
Compare
|
Sorry, had nearly forgotten about this! I simplified this pull request to mimic that behaviour and added a test. Also, I have signed the CLA, just hadn't before make this pull request. |
|
@waltaskew it looks like there was a hiccup with your CLA and it isn't recorded as such on bugs.python.org. Could you email contributors@python.org and try to track down what's happened? |
|
@waltaskew, I'm going to close this pending the CLA. Once you get it sorted per @brettcannon's request, feel free to re-open this pull request. |
Does something along these lines seem reasonable?
I ran into an issue where the seekable() method was returning true despite the underlying fileobj not being seekable, which lead to errors when a consumer of the GzipFile used the results of the seekable() method as evidence it was safe to call seek.
https://bugs.python.org/issue33173