Skip to content

Commit 20ac399

Browse files
committed
fix review idea
Signed-off-by: Manjusaka <me@manjusaka.me>
1 parent 4e7c384 commit 20ac399

5 files changed

Lines changed: 10 additions & 9 deletions

File tree

Doc/library/sys.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,16 +1933,16 @@ always available. Unless explicitly noted otherwise, all variables are read-only
19331933
interpreter is pre-release (alpha, beta, or release candidate) then the
19341934
local and remote interpreters must be the same exact version.
19351935

1936-
.. audit-event:: remote_exec pid script_path
1936+
.. audit-event:: sys.remote_exec pid script_path
19371937

19381938
When the code is executed in the remote process, an :ref:`auditing event <auditing>`
1939-
``remote_exec`` is raised with the *pid* and the path to the script file.
1939+
``sys.remote_exec`` is raised with the *pid* and the path to the script file.
19401940

1941-
.. audit-event:: remote_debugger_script script_path
1941+
.. audit-event:: cpython.remote_debugger_script script_path
19421942

19431943
When the script is executed in the remote process, an
19441944
:ref:`auditing event <auditing>`
1945-
``sys.remote_debugger_script`` is raised
1945+
``cpython.remote_debugger_script`` is raised
19461946
with the path in the remote process.
19471947

19481948
.. availability:: Unix, Windows.

Lib/test/audit-tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ def test_sys_remote_exec():
650650
event_pid = -1
651651
event_script_path = ""
652652
def hook(event, args):
653-
if event != "remote_exec": return
653+
if event != "sys.remote_exec": return
654654
nonlocal event_pid
655655
event_pid = args[0]
656656
nonlocal event_script_path

Lib/test/test_sys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2102,7 +2102,7 @@ def audit_hook(event, arg):
21022102
returncode, stdout, stderr = self._run_remote_exec_test(script, prologue=prologue)
21032103
self.assertEqual(returncode, 0)
21042104
self.assertIn(b"Remote script executed successfully!", stdout)
2105-
self.assertIn(b"Audit event: remote_debugger_script, arg: ", stdout)
2105+
self.assertIn(b"Audit event: cpython.remote_debugger_script, arg: ", stdout)
21062106
self.assertEqual(stderr, b"")
21072107

21082108
def test_remote_exec_with_exception(self):

Python/ceval_gil.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ static inline int run_remote_debugger_source(PyObject *source)
12201220
// that would be an easy target for a ROP gadget.
12211221
static inline void run_remote_debugger_script(PyObject *path)
12221222
{
1223-
if (0 != PySys_Audit("remote_debugger_script", "O", path)) {
1223+
if (0 != PySys_Audit("cpython.remote_debugger_script", "O", path)) {
12241224
PyErr_FormatUnraisable(
12251225
"Audit hook failed for remote debugger script %U", path);
12261226
return;

Python/sysmodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,13 +2485,14 @@ sys_remote_exec_impl(PyObject *module, int pid, PyObject *script)
24852485
PyObject *path;
24862486
const char *debugger_script_path;
24872487

2488-
if (PySys_Audit("remote_exec", "iO", pid, script) < 0) {
2488+
if (PyUnicode_FSConverter(script, &path) == 0) {
24892489
return NULL;
24902490
}
24912491

2492-
if (PyUnicode_FSConverter(script, &path) == 0) {
2492+
if (PySys_Audit("sys.remote_exec", "iO", pid, script) < 0) {
24932493
return NULL;
24942494
}
2495+
24952496
debugger_script_path = PyBytes_AS_STRING(path);
24962497
#ifdef MS_WINDOWS
24972498
PyObject *unicode_path;

0 commit comments

Comments
 (0)