mirror of https://github.com/python/cpython
bpo-38922: Raise code.__new__ audit event when code object replace() is called (GH-17394)
This commit is contained in:
parent
0b41a922f9
commit
c7c01ab1e5
|
@ -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
|
#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(
|
return (PyObject *)PyCode_NewWithPosOnlyArgs(
|
||||||
co_argcount, co_posonlyargcount, co_kwonlyargcount, co_nlocals,
|
co_argcount, co_posonlyargcount, co_kwonlyargcount, co_nlocals,
|
||||||
co_stacksize, co_flags, (PyObject*)co_code, co_consts, co_names,
|
co_stacksize, co_flags, (PyObject*)co_code, co_consts, co_names,
|
||||||
|
|
Loading…
Reference in New Issue