Skip to content

Commit d0f1afd

Browse files
authored
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 85eb8c1.
1 parent ed8217b commit d0f1afd

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Doc/c-api/arg.rst

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

0 commit comments

Comments
 (0)