bz2.BZ2File doesn't support name?

I was surprised recently to discover that BZ2File (at least in 3.7) doesn't have a name attribute. Is there some fundamental reason name couldn't be supported, or is it just a bug that it wasn't implemented?

I think one of the issues is that BZ2File accepts the filename as a name or as a file-like object! I don't see why it couldn't be enhanced to provide the filename though (by pulling it from the fp). Meanwhile, the ugly way to get the filename from a BZ2File object: pbryan@dynamo:~$ python3 Python 3.9.3 (default, Apr 8 2021, 23:35:02) [GCC 10.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import bz2 f = bz2.BZ2File("test.bz2") f._fp.name 'test.bz2'
Paul On Tue, 2021-04-27 at 04:04 +0000, roy@panix.com wrote:
I was surprised recently to discover that BZ2File (at least in 3.7) doesn't have a name attribute. Is there some fundamental reason name couldn't be supported, or is it just a bug that it wasn't implemented? _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/N3Q7AN5I... Code of Conduct: http://python.org/psf/codeofconduct/

There is an open bug report https://bugs.python.org/issue24258 I guess it was overlooked. It could be a good task for someone interested. Please add me as a reviewer if you submit a patch, I can help review and move it forward. On Mon, Apr 26, 2021 at 9:22 PM <roy@panix.com> wrote:
I was surprised recently to discover that BZ2File (at least in 3.7) doesn't have a name attribute. Is there some fundamental reason name couldn't be supported, or is it just a bug that it wasn't implemented? _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/N3Q7AN5I... Code of Conduct: http://python.org/psf/codeofconduct/

I just added the .name property to bz2.Bzip2File and added a test to verify it. -- H On Mon, 26 Apr 2021 at 21:40, Senthil Kumaran <senthil@python.org> wrote:
There is an open bug report https://bugs.python.org/issue24258
I guess it was overlooked. It could be a good task for someone interested. Please add me as a reviewer if you submit a patch, I can help review and move it forward.
On Mon, Apr 26, 2021 at 9:22 PM <roy@panix.com> wrote:
I was surprised recently to discover that BZ2File (at least in 3.7) doesn't have a name attribute. Is there some fundamental reason name couldn't be supported, or is it just a bug that it wasn't implemented? _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/N3Q7AN5I... Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/NCGH6EYR... Code of Conduct: http://python.org/psf/codeofconduct/
-- OpenPGP: https://hasan.d8u.us/openpgp.asc If you wish to request my time, please do so using *bit.ly/hd1AppointmentRequest <http://bit.ly/hd1AppointmentRequest>*. Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest <http://bit.ly/hd1AppointmentRequest>*. <https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1>Sent from my mobile device Envoye de mon portable

I am new and I am just lurking here, so please pardon me if I say or do anything out of place. I saw your patch Mr. Diwan and I want to say that instead of making `filename` attribute, it would be better to change it to `name`, just to adhere to standards. And changing the name method to something else or even removing it.

Hello Hasan, Thank you. Please submit your patch as a PR in Github. https://devguide.python.org/pullrequest/ Also, why did you have a self.filename and (getter?) as name. You could set the attribute as name. Thank you, Senthil On Tue, Apr 27, 2021 at 12:32 AM Hasan Diwan <hasan.diwan@gmail.com> wrote:
I just added the .name property to bz2.Bzip2File and added a test to verify it. -- H
On Mon, 26 Apr 2021 at 21:40, Senthil Kumaran <senthil@python.org> wrote:
There is an open bug report https://bugs.python.org/issue24258
I guess it was overlooked. It could be a good task for someone interested. Please add me as a reviewer if you submit a patch, I can help review and move it forward.
On Mon, Apr 26, 2021 at 9:22 PM <roy@panix.com> wrote:
I was surprised recently to discover that BZ2File (at least in 3.7) doesn't have a name attribute. Is there some fundamental reason name couldn't be supported, or is it just a bug that it wasn't implemented? _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/N3Q7AN5I... Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/NCGH6EYR... Code of Conduct: http://python.org/psf/codeofconduct/
-- OpenPGP: https://hasan.d8u.us/openpgp.asc If you wish to request my time, please do so using *bit.ly/hd1AppointmentRequest <http://bit.ly/hd1AppointmentRequest>*. Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest <http://bit.ly/hd1AppointmentRequest>*.
<https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1>Sent from my mobile device Envoye de mon portable _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/B3CCQRW7... Code of Conduct: http://python.org/psf/codeofconduct/

[response inline] On Tue, 27 Apr 2021 at 04:55, Senthil Kumaran <senthil@python.org> wrote:
why did you have a self.filename and (getter?) as name. You could set the attribute as name.
I wasn't aware that this was an option. -- H -- OpenPGP: https://hasan.d8u.us/openpgp.asc If you wish to request my time, please do so using *bit.ly/hd1AppointmentRequest <http://bit.ly/hd1AppointmentRequest>*. Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest <http://bit.ly/hd1AppointmentRequest>*. <https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1>Sent from my mobile device Envoye de mon portable
participants (5)
-
Hasan Diwan
-
Paul Bryan
-
Rik
-
roy@panix.com
-
Senthil Kumaran