[issue18534] State clearly that open() 'file' param is "name" attr of the result

Guido van Rossum <guido@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. ---------- nosy: +gvanrossum status: pending -> open _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue18534> _______________________________________
participants (1)
-
Guido van Rossum