mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
[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 009e7b3698
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
1ba5e65b76
commit
eaee2ae033
2 changed files with 8 additions and 1 deletions
|
@ -2176,6 +2176,13 @@ raise Exception("Remote script exception")
|
||||||
with self.assertRaises(OSError):
|
with self.assertRaises(OSError):
|
||||||
sys.remote_exec(99999, "print('should not run')")
|
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):
|
def test_remote_exec_syntax_error(self):
|
||||||
"""Test remote exec with syntax error in script"""
|
"""Test remote exec with syntax error in script"""
|
||||||
script = '''
|
script = '''
|
||||||
|
|
|
@ -2484,7 +2484,7 @@ sys_remote_exec_impl(PyObject *module, int pid, PyObject *script)
|
||||||
PyObject *path;
|
PyObject *path;
|
||||||
const char *debugger_script_path;
|
const char *debugger_script_path;
|
||||||
|
|
||||||
if (PyUnicode_FSConverter(script, &path) < 0) {
|
if (PyUnicode_FSConverter(script, &path) == 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
debugger_script_path = PyBytes_AS_STRING(path);
|
debugger_script_path = PyBytes_AS_STRING(path);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue