-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-133886: Fix sys.remote_exec() for non-UTF-8 paths #133887
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
gh-133886: Fix sys.remote_exec() for non-UTF-8 paths #133887
Conversation
It now supports non-ASCII paths in non-UTF-8 locales and non-UTF-8 paths in UTF-8 locales.
45e4604
to
bd30460
Compare
run_remote_debugger_script(path); | ||
PyObject *path_obj = PyUnicode_DecodeFSDefault(path); | ||
if (path_obj == NULL) { | ||
PyErr_FormatUnraisable("Can't decode debugger script"); |
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.
Can we include the script path in this exception ?
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.
LGTM
Left a suggestion
'undecodable paths are not supported on macOS') | ||
def test_remote_exec_undecodable(self): | ||
script = 'print("Remote script executed successfully!")' | ||
script_path = os_helper.TESTFN_UNDECODABLE + b'_undecodable_remote.py' |
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 nice! I didn't know about this
Python/sysmodule.c
Outdated
} | ||
Py_DECREF(path); |
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.
Maybe we can have a goto label for the error at this stage. I don't mind either way so up to you
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…133887) It now supports non-ASCII paths in non-UTF-8 locales and non-UTF-8 paths in UTF-8 locales. (cherry picked from commit c09cec5) Co-authored-by: Serhiy Storchaka <[email protected]>
GH-133963 is a backport of this pull request to the 3.14 branch. |
Thank you for your review, @pablogsal. |
We could also use natural UTF-16 for paths on Windows, but this is more significant change. |
… (GH-133963) It now supports non-ASCII paths in non-UTF-8 locales and non-UTF-8 paths in UTF-8 locales. (cherry picked from commit c09cec5) Co-authored-by: Serhiy Storchaka <[email protected]>
It now supports non-ASCII paths in non-UTF-8 locales and non-UTF-8 paths in UTF-8 locales.