GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — bpo-47217: add name attribute to bz2 fileobject by ellaellela · Pull Request #32311 · python/cpython Conversation
|
| self._pos = 0 | ||
|
|
||
| if not isinstance(filename, (str, bytes)): | ||
| self.name = '' |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could this be some recognizable sentinel (<stream> or something better) rather than empty string?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This seemed the easiest way of doing it without complicating the logic and the tests. Also, I couldn't find a uniform way of dealing with a lack of "name" for BytesIO() objects in other libraries, so I did not want to introduce anything "new and specific".
Do you have an example (or an idea) of a sentinel use that would fit here? In that case, we could do a similar change for gzip, bz2, lzma, ... libraries to have a bit more standardized way of dealing with this situation when we have BytesIO() objects.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ran 98 tests in 11.650s
OK
Looks ok.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thank you for your PR @ellaellela, but this is a part of more complex issue #115961. It is better to solve it all in one place. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.