[issue24258] BZ2File objects do not have name attribute

2021-04-27 Thread Roy Smith


Roy Smith  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24258] BZ2File objects do not have name attribute

2021-04-27 Thread Steve Stagg


Steve Stagg  added the comment:

Please may you add a test that uses "io.BytesIO()" as the filename argument.  
BytesIO() objects do not have a 'name' attribute

--
nosy: +stestagg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24258] BZ2File objects do not have name attribute

2021-04-27 Thread Hasan Diwan


Hasan Diwan  added the comment:

Patch adds a bz2.BZ2File.name property corresponding to the filename passed in.

--
keywords: +patch
nosy: +Hasan Diwan
versions: +Python 3.10, Python 3.11, Python 3.8, Python 3.9 -Python 3.6
Added file: https://bugs.python.org/file49991/bz2.name.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24258] BZ2File objects do not have name attribute

2021-04-27 Thread Shatabarto Bhattacharya


Change by Shatabarto Bhattacharya :


--
nosy: +hrik2001

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24258] BZ2File objects do not have name attribute

2021-04-26 Thread Roy Smith


Change by Roy Smith :


--
nosy: +roysmith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24258] BZ2File objects do not have name attribute

2015-06-01 Thread Cliff Dyer

Cliff Dyer added the comment:

I've got a fix for this now.  In working on it, I've discovered that not all 
file-like objects have a .name attribute.  io.BytesIO (which is used all over 
the test suite) does not.  I've written a patch that always creates a .name 
attribute on BZ2File, but sets it to None if the associated file-like object 
has no .name.

See the linked branch

--
hgrepos: +311

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24258
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24258] BZ2File objects do not have name attribute

2015-06-01 Thread Cliff Dyer

Cliff Dyer added the comment:

It's probably too late for this to get into 3.5, since we're already in betas.  
Pushing back to 3.6.

--
versions: +Python 3.6 -Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24258
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




[issue24258] BZ2File objects do not have name attribute

2015-05-26 Thread Cliff Dyer

Cliff Dyer added the comment:

I'd be happy to take a look at this one, if no one else is working on it.

--
nosy: +jcd

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24258
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24258] BZ2File objects do not have name attribute

2015-05-21 Thread Jozef Sivek

New submission from Jozef Sivek:

Unlike GzipFile the BZ2File does not have defined name attribute. The reading 
of this attribute results in: AttributeError: 'BZ2File' object has no 
attribute 'name'.

This is truly missing feature and wrong behaviour, compare:
https://hg.python.org/releasing/3.4.3/file/933c3041d548/Lib/gzip.py
and 
https://hg.python.org/releasing/3.4.3/file/933c3041d548/Lib/bz2.py

In addition to that the BZ2File did have name attribute in python 2.7.* .

In attachment there is tar ball with example files, expected results in python 
3 and results in python 2.

--
components: Library (Lib)
files: bz2file.tar
messages: 243743
nosy: jojko.sivek
priority: normal
severity: normal
status: open
title: BZ2File objects do not have name attribute
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file39452/bz2file.tar

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24258
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24258] BZ2File objects do not have name attribute

2015-05-21 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +nadeem.vawda

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24258
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com