[docs] [issue18534] State clearly that open() 'file' param is "name" attr of the result
Guido van Rossum
report at bugs.python.org
Tue Oct 31 23:14:33 EDT 2017
Guido van Rossum <guido at python.org> added the comment:
Agreed it's too subtle to change the behavior.
> 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.
Not sure. Are there cases where os.fsdecode() fails even if the binary syscall would succeed? (The docs claim that on Windows it uses 'strict'.)
If it doesn't, maybe we can add a new attribute that gives the name as Text? It could be '' if name is an int.
status: pending -> open
Python tracker <report at bugs.python.org>
More information about the docs