Nick Coghlan added the comment:

Switching this to a docs bugs, since 
http://docs.python.org/3/library/functions.html#open doesn't mention this 
behaviour at all, and http://docs.python.org/3/library/io.html#io.FileIO.name 
only notes the fact it may be a file descriptor without mentioning the 
str/bytes discrepancy.

So, at a bare minimum, we need to clearly describe this behaviour in the docs. 
We may also want to explicitly point out that using os.fsdecode(name) before 
passing it to open() will ensure that the name attribute is set to a string 
rather than a bytes object.

----------
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
title: File "name" attribute should always be a text string -> State clearly 
that open() 'file' param is "name" attr of the result
versions: +Python 3.3, Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18534>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to