bpo-38922: Raise code.__new__ audit event when code object replace() is called (GH-17394)
(cherry picked from commit c7c01ab1e5
)
Co-authored-by: Steve Dower <steve.dower@python.org>
This commit is contained in:
parent
86d9933cc6
commit
191f94cca6
|
@ -0,0 +1,2 @@
|
|||
Calling ``replace`` on a code object now raises the ``code.__new__`` audit
|
||||
event.
|
|
@ -641,6 +641,13 @@ code_replace_impl(PyCodeObject *self, int co_argcount,
|
|||
|
||||
#undef CHECK_INT_ARG
|
||||
|
||||
if (PySys_Audit("code.__new__", "OOOiiiiii",
|
||||
co_code, co_filename, co_name, co_argcount,
|
||||
co_posonlyargcount, co_kwonlyargcount, co_nlocals,
|
||||
co_stacksize, co_flags) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (PyObject *)PyCode_NewWithPosOnlyArgs(
|
||||
co_argcount, co_posonlyargcount, co_kwonlyargcount, co_nlocals,
|
||||
co_stacksize, co_flags, (PyObject*)co_code, co_consts, co_names,
|
||||
|
|
Loading…
Reference in New Issue