https://github.com/python/cpython/commit/eaee2ae0333dde4f18bf849e4a90c8eebb7e2cb9 commit: eaee2ae0333dde4f18bf849e4a90c8eebb7e2cb9 branch: 3.14 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: vstinner <vstin...@python.org> date: 2025-05-17T22:50:00Z summary:
[3.14] gh-134064: Fix sys.remote_exec() error checking (GH-134067) (#134162) gh-134064: Fix sys.remote_exec() error checking (GH-134067) (cherry picked from commit 009e7b36981fd07f7cca1fdcfcf172ce1584fac7) Co-authored-by: Victor Stinner <vstin...@python.org> files: M Lib/test/test_sys.py M Python/sysmodule.c diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 8af2e3488b48d9..fb1c8492a64d38 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -2176,6 +2176,13 @@ def test_remote_exec_invalid_pid(self): with self.assertRaises(OSError): sys.remote_exec(99999, "print('should not run')") + def test_remote_exec_invalid_script(self): + """Test remote exec with invalid script type""" + with self.assertRaises(TypeError): + sys.remote_exec(0, None) + with self.assertRaises(TypeError): + sys.remote_exec(0, 123) + def test_remote_exec_syntax_error(self): """Test remote exec with syntax error in script""" script = ''' diff --git a/Python/sysmodule.c b/Python/sysmodule.c index b46c2ab7c4483d..8692caa238a64d 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -2484,7 +2484,7 @@ sys_remote_exec_impl(PyObject *module, int pid, PyObject *script) PyObject *path; const char *debugger_script_path; - if (PyUnicode_FSConverter(script, &path) < 0) { + if (PyUnicode_FSConverter(script, &path) == 0) { return NULL; } debugger_script_path = PyBytes_AS_STRING(path); _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com