Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Lib/test/test_sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '''
Expand Down
2 changes: 1 addition & 1 deletion Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2485,7 +2485,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);
Expand Down
Loading