classification
Title: "raw" attribute of buffered IO objects is assignable
Type: behavior Stage: resolved
Components: IO, Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, benjamin.peterson, pitrou
Priority: normal Keywords: patch

Created on 2010-12-21 20:21 by pitrou, last changed 2010-12-21 21:27 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
io_roattrs.patch pitrou, 2010-12-21 20:35
Messages (6)
msg124451 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-12-21 20:21
This really looks backwards:

>>> f = open("LICENSE", "rb")
>>> f.name = "bar"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: attribute 'name' of '_io.BufferedReader' objects is not writable
>>> f.raw = None
__main__:1: ResourceWarning: unclosed file <_io.FileIO name='LICENSE' mode='rb'>
>>>
msg124452 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-12-21 20:35
Here is a patch.
msg124454 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-12-21 20:36
2010/12/21 Antoine Pitrou <report@bugs.python.org>:
>
> Antoine Pitrou <pitrou@free.fr> added the comment:
>
> Here is a patch.

I assume you can put test_readonly_attributes in CommonBufferTests?
msg124455 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-12-21 20:37
Le mardi 21 décembre 2010 à 20:36 +0000, Benjamin Peterson a écrit :
> Benjamin Peterson <benjamin@python.org> added the comment:
> 
> 2010/12/21 Antoine Pitrou <report@bugs.python.org>:
> >
> > Antoine Pitrou <pitrou@free.fr> added the comment:
> >
> > Here is a patch.
> 
> I assume you can put test_readonly_attributes in CommonBufferTests?

That's where it is :)
msg124456 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-12-21 20:39
Ah, I see. LGTM then.
msg124458 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-12-21 21:27
Thank you, committed in r87427 (3.2), r87428 (3.1) and r87429 (2.7).
History
Date User Action Args
2010-12-21 21:27:11pitrousetstatus: open -> closed

messages: + msg124458
resolution: fixed
stage: patch review -> resolved
2010-12-21 20:39:05benjamin.petersonsetmessages: + msg124456
2010-12-21 20:37:45pitrousetmessages: + msg124455
2010-12-21 20:36:27benjamin.petersonsetmessages: + msg124454
2010-12-21 20:35:13pitrousetfiles: + io_roattrs.patch

messages: + msg124452
keywords: + patch
stage: needs patch -> patch review
2010-12-21 20:21:55pitroucreate