New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyFile_FromFd() doesn't set the file name #49012
Comments
PyFile_FromFd() never changes the name of new created file object: $ ./python -c "import sys; print(sys.stdout.buffer.name,
sys.stdout.name)"
0 0 Expected result: <stdout> <stdout>. --- Binary mode:
If text mode, the file object is a TextIOWrapper and file.raw is a I'm not sure of the classes/types. Note: PyFile_FromFd() shouldn't use PyErr_Clear() if changing the name |
In my last patch to fix the issue bpo-4705, I replaced PyFile_FromFd() by PyFile_FromFd() is also used in:
Example with imp: >>> file, filename, extra = imp.find_module("os")
>>> file
<io.TextIOWrapper object at 0xb7b6ea6c>
>>> file.name
4
>>> filename
'/home/SHARE/SVN/py3k/Lib/os.py' |
The standard I/O: sys.stdin, sys.stdout and sys.stderr. |
In py3k, standard streams' names are now correct (since the io-c Python 3.1a1+ (py3k:70589M, Mar 25 2009, 01:01:13)
>>> import sys
>>> sys.stdin.name, sys.stdout.name, sys.stderr.name
('<stdin>', '<stdout>', '<stderr>') The last problem occurs with imp.find_module(). But imp.find_module() |
r83973 ignores the name argument of PyFile_FromFd() because it was already ignored (it did always produce an error). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: