summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-11-18 19:53:34 (GMT)
committerGitHub <noreply@github.com>2019-11-18 19:53:34 (GMT)
commit47db7439dd858c3634212c71137eb130f811bda4 (patch)
tree7ba52bdc8bbf388817ff19d3513d603a2c6632e8 /Lib
parentcbbf1098f383e575d93841e555329eb66283c2f1 (diff)
downloadcpython-47db7439dd858c3634212c71137eb130f811bda4.zip
cpython-47db7439dd858c3634212c71137eb130f811bda4.tar.gz
cpython-47db7439dd858c3634212c71137eb130f811bda4.tar.bz2
bpo-38622: Add missing audit events for ctypes module (GH-17158)
(cherry picked from commit 00923c63995e34cdc25d699478f113de99a69df9) Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/__init__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
index 128155d..8f09911 100644
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -52,11 +52,13 @@ def create_string_buffer(init, size=None):
if isinstance(init, bytes):
if size is None:
size = len(init)+1
+ _sys.audit("ctypes.create_string_buffer", init, size)
buftype = c_char * size
buf = buftype()
buf.value = init
return buf
elif isinstance(init, int):
+ _sys.audit("ctypes.create_string_buffer", None, init)
buftype = c_char * init
buf = buftype()
return buf
@@ -283,11 +285,13 @@ def create_unicode_buffer(init, size=None):
# 32-bit wchar_t (1 wchar_t per Unicode character). +1 for
# trailing NUL character.
size = len(init) + 1
+ _sys.audit("ctypes.create_unicode_buffer", init, size)
buftype = c_wchar * size
buf = buftype()
buf.value = init
return buf
elif isinstance(init, int):
+ _sys.audit("ctypes.create_unicode_buffer", None, init)
buftype = c_wchar * init
buf = buftype()
return buf