This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: add file name to py3k IO objects repr()
Type: enhancement Stage: test needed
Components: IO, Library (Lib) Versions: Python 3.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, pitrou, r.david.murray
Priority: release blocker Keywords: patch

Created on 2009-04-15 10:45 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue5761.patch pitrou, 2009-05-23 17:58
issue5761-2.patch pitrou, 2009-05-23 18:48
Messages (9)
msg85989 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-04-15 10:45
>>> f = open("py3k/__svn__/LICENSE")
>>> f
<TextIOWrapper encoding=UTF-8>
>>> f.buffer
<_io.BufferedReader object at 0x7f4b67569f68>
>>> f.buffer.raw
io.FileIO(3, 'rb')
>>> f.name
'py3k/__svn__/LICENSE'

It would probably be nice if f.name were reused for f's repr().
msg86000 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-04-15 21:15
What should we do about filenames of bytes?
msg86237 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-04-21 15:23
Benjamin, do you think it can still be added after beta1?
(I ask that in case noone does it before)
msg86253 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-04-21 18:14
2009/4/21 Antoine Pitrou <report@bugs.python.org>:
>
> Antoine Pitrou <pitrou@free.fr> added the comment:
>
> Benjamin, do you think it can still be added after beta1?
> (I ask that in case noone does it before)

Yes, I think that would be ok.
msg88222 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-05-23 03:21
Antoine, by "reused for f's repr" do you mean adding 'name=xxxx' into
the existing repr (probably before the encoding)?

Benjamin, by "bytes" do you mean BytesIO objects?  Would it be
acceptible to give them a 'name' attribute set to 'None'?
msg88223 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-05-23 04:57
> Antoine, by "reused for f's repr" do you mean adding 'name=xxxx' into
> the existing repr (probably before the encoding)?

Exactly.
msg88245 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-05-23 17:58
Here is a patch.
msg88247 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-05-23 18:48
New patch following Benjamin's comments.
msg88250 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-05-23 19:04
Committed in r72870.
History
Date User Action Args
2022-04-11 14:56:47adminsetgithub: 50011
2009-05-23 19:04:21pitrousetstatus: open -> closed
resolution: fixed
messages: + msg88250
2009-05-23 18:48:56pitrousetfiles: + issue5761-2.patch

messages: + msg88247
2009-05-23 17:58:36pitrousetfiles: + issue5761.patch
keywords: + patch
messages: + msg88245
2009-05-23 04:57:08pitrousetmessages: + msg88223
2009-05-23 03:21:14r.david.murraysetnosy: + r.david.murray
messages: + msg88222
2009-05-14 21:53:00pitrousetcomponents: + IO
2009-05-14 21:52:56pitrousetpriority: normal -> release blocker
2009-04-21 18:14:18benjamin.petersonsetmessages: + msg86253
2009-04-21 15:23:49pitrousetmessages: + msg86237
2009-04-15 21:15:40benjamin.petersonsetmessages: + msg86000
2009-04-15 10:45:46pitroucreate