gh-105373: Remove PyArg_Parse() deprecation (#105394)

There is no plan to deprecate PyArg_Parse().

The deprecation was added as a comment in the C API documentation in
2007 by commit 85eb8c103c.
This commit is contained in:
Victor Stinner 2023-06-13 13:49:36 +02:00 committed by GitHub
parent ed8217b493
commit d0f1afd942
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -439,16 +439,24 @@ API Functions
.. versionadded:: 3.2 .. versionadded:: 3.2
.. XXX deprecated, will be removed
.. c:function:: int PyArg_Parse(PyObject *args, const char *format, ...) .. c:function:: int PyArg_Parse(PyObject *args, const char *format, ...)
Function used to deconstruct the argument lists of "old-style" functions --- Parse the parameter of a function that takes a single positional parameter
these are functions which use the :const:`METH_OLDARGS` parameter parsing into a local variable. Returns true on success; on failure, it returns
method, which has been removed in Python 3. This is not recommended for use false and raises the appropriate exception.
in parameter parsing in new code, and most code in the standard interpreter
has been modified to no longer use this for that purpose. It does remain a Example::
convenient way to decompose other tuples, however, and may continue to be
used for that purpose. // Function using METH_O calling convention
static PyObject*
my_function(PyObject *module, PyObject *arg)
{
int value;
if (!PyArg_Parse(arg, "i:my_function", &value)) {
return NULL;
}
// ... use value ...
}
.. c:function:: int PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, ...) .. c:function:: int PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, ...)