[issue24258] BZ2File objects do not have name attribute
Roy Smith
report at bugs.python.org
Tue Apr 27 09:05:23 EDT 2021
Roy Smith <roy at panix.com> added the comment:
The https://bitbucket.org/cliff/cpython#python24258 URL 404's
Looking at the attached bz2.py diff, I would change:
if isinstance(filename, (str, bytes, os.PathLike)):
self._fp = _builtin_open(filename, mode)
+ self.filename = filename
self._closefp = True
self._mode = mode_code
to special-case os.PathLike and do:
self.filename = str(filename)
I would expect BZ2File.name to be a string. Returning a PathLike means lots of legitimate string methods will not work on it. Also, it should be "name" as an attribute, not "name()" as a method, to match other existing interfaces.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue24258>
_______________________________________
More information about the Python-bugs-list
mailing list