]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39008: Require Py_ssize_t for PySys_Audit formats rather than raise a deprecation...
authorSteve Dower <steve.dower@python.org>
Mon, 9 Dec 2019 19:05:39 +0000 (11:05 -0800)
committerGitHub <noreply@github.com>
Mon, 9 Dec 2019 19:05:39 +0000 (11:05 -0800)
Doc/c-api/sys.rst
Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst [new file with mode: 0644]
Python/sysmodule.c

index eccb8a67e82a5dfcf096399b82bf77e36afa1180..c851ff66487d5c8d2bad4102f7efb3e171c5c1d3 100644 (file)
@@ -320,10 +320,18 @@ accessible to C code.  They all work with the current interpreter thread's
    arguments to this function will be consumed, using it may cause reference
    leaks.)
 
+   Note that ``#`` format characters should always be treated as
+   ``Py_ssize_t``, regardless of whether ``PY_SSIZE_T_CLEAN`` was defined.
+
    :func:`sys.audit` performs the same function from Python code.
 
    .. versionadded:: 3.8
 
+   .. versionchanged:: 3.8.2
+
+      Require ``Py_ssize_t`` for ``#`` format characters. Previously, an
+      unavoidable deprecation warning was raised.
+
 
 .. c:function:: int PySys_AddAuditHook(Py_AuditHookFunction hook, void *userData)
 
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst
new file mode 100644 (file)
index 0000000..35237ce
--- /dev/null
@@ -0,0 +1,3 @@
+:c:func:`PySys_Audit` now requires ``Py_ssize_t`` to be used for size
+arguments in the format string, regardless of whethen ``PY_SSIZE_T_CLEAN``
+was defined at include time.
index b6bdf51bce333fd94e634ef937592a71333ecae1..9f866a2a3d2fa09ab6d906d2ba061d4bb6db81d6 100644 (file)
@@ -181,7 +181,7 @@ PySys_Audit(const char *event, const char *argFormat, ...)
     if (argFormat && argFormat[0]) {
         va_list args;
         va_start(args, argFormat);
-        eventArgs = Py_VaBuildValue(argFormat, args);
+        eventArgs = _Py_VaBuildValue_SizeT(argFormat, args);
         va_end(args);
         if (eventArgs && !PyTuple_Check(eventArgs)) {
             PyObject *argTuple = PyTuple_Pack(1, eventArgs);