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
bpo-32381: Add _PyRun_AnyFileObject() #23723
Conversation
pymain_run_file() no longer encodes the filename: pass the filename as an object to the new _PyRun_AnyFileObject() function. Add new private functions: * _PyRun_AnyFileObject() * _PyRun_InteractiveLoopObject() * _Py_FdIsInteractive()
|
test_ttk_guionly failed on Ubuntu. I re-run the jobs. |
| @@ -313,17 +313,8 @@ pymain_run_file(const PyConfig *config, PyCompilerFlags *cf) | |||
| } | |||
| FILE *fp = _Py_wfopen(filename, L"rb"); | |||
| if (fp == NULL) { | |||
| char *cfilename_buffer; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this part removed? Because on Solaris (or any other platform where wchar_t values don't correspond to Unicode values) it no longer works. I found this when test_nonexisting_script (test.test_cmd_line_script.CmdLineTest) started failing with this:
...
File "/builds/jkulik/buildbot-sources/components/python/pythonmaster/Python-3.10.0-a82f63f/Lib/subprocess.py", line 1018, in _translate_newlines
data = data.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe6 in position 202: invalid continuation byte
But maybe I am missing something and the problem is somewhere else, that's why I'm asking.
Oracle Solaris and wchar_t: https://docs.oracle.com/cd/E36784_01/html/E39536/gmwkm.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. I knew that someone will complain about that :-) I removed the code since it was ugly code that I wrote years ago. The correct fix is to rely on Python sys.stderr, not use C stderr. I wrote PR #23778 for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I tried test_nonexisting_script with your new PR #23778 and it works again.
pymain_run_file() no longer encodes the filename: pass the filename as an object to the new _PyRun_AnyFileObject() function. Add new private functions: * _PyRun_AnyFileObject() * _PyRun_InteractiveLoopObject() * _Py_FdIsInteractive()
pymain_run_file() no longer encodes the filename: pass the filename
as an object to the new _PyRun_AnyFileObject() function.
Add new private functions:
https://bugs.python.org/issue32381