FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-47217: add name attribute to bz2 fileobject by ellaellela · Pull Request #32311 · python/cpython · GitHub

/ cpython Public

bpo-47217: add name attribute to bz2 fileobject - #32311

Closed
ellaellela wants to merge 2 commits into
python:mainfrom
ellaellela:add-name-bzip2
Closed

bpo-47217: add name attribute to bz2 fileobject#32311
ellaellela wants to merge 2 commits into
python:mainfrom
ellaellela:add-name-bzip2

Conversation

ellaellela commented Apr 4, 2022
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

Comment thread Lib/bz2.py
self._pos = 0

if not isinstance(filename, (str, bytes)):
self.name = ''

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Could this be some recognizable sentinel (<stream> or something better) rather than empty string?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

MaxwellDupre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ran 98 tests in 11.650s
OK
Looks ok.

Copy link
Copy Markdown
Member

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.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL