summaryrefslogtreecommitdiffstats
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-11-27 00:46:32 (GMT)
committerGitHub <noreply@github.com>2019-11-27 00:46:32 (GMT)
commit191f94cca6f8cf59535e7459c1113e4a1cdfe201 (patch)
tree66ba7e5c3c875eaeeb45e48372ada9ba90b1f9d8 /Objects/codeobject.c
parent86d9933cc627c4232f9702ca0766713714ebbc53 (diff)
downloadcpython-191f94cca6f8cf59535e7459c1113e4a1cdfe201.zip
cpython-191f94cca6f8cf59535e7459c1113e4a1cdfe201.tar.gz
cpython-191f94cca6f8cf59535e7459c1113e4a1cdfe201.tar.bz2
bpo-38922: Raise code.__new__ audit event when code object replace() is called (GH-17394)
(cherry picked from commit c7c01ab1e5415b772c68e15f1aba51e520010830) Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 39bf6fc..f0b62ec 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -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,