Skip to content

Commit 5223fed

Browse files
committed
Add assertions to sys_audit()
1 parent b64e3ca commit 5223fed

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Python/sysmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ sys_audit(PyObject *self, PyObject *const *args, Py_ssize_t argc)
533533
}
534534

535535
if (!should_audit(tstate->interp)) {
536+
// Validate first argument using assertions, only impact peformance
537+
// of Python built in debug mode.
538+
assert(args[0] != NULL);
539+
assert(PyUnicode_Check(args[0]));
536540
Py_RETURN_NONE;
537541
}
538542

0 commit comments

Comments
 (0)