diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ctypes/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py index 128155dbf4..8f0991147d 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 |