@@ -413,7 +413,7 @@ API Functions
413413 than a variable number of arguments.
414414
415415
416- .. c :function :: int PyArg_ParseTupleAndKeywords (PyObject *args, PyObject *kw, const char *format, char *keywords[] , ...)
416+ .. c :function :: int PyArg_ParseTupleAndKeywords (PyObject *args, PyObject *kw, const char *format, char * const * keywords, ...)
417417
418418 Parse the parameters of a function that takes both positional and keyword
419419 parameters into local variables.
@@ -424,15 +424,24 @@ API Functions
424424 Returns true on success; on failure, it returns false and raises the
425425 appropriate exception.
426426
427+ .. note ::
428+
429+ The *keywords * parameter declaration is :c:expr: `char * const * ` in C and
430+ :c:expr: `const char * const * ` in C++.
431+ This can be overridden with the :c:macro: `PY_CXX_CONST ` macro.
432+
427433 .. versionchanged :: 3.6
428434 Added support for :ref: `positional-only parameters
429435 <positional-only_parameter>`.
430436
431437 .. versionchanged :: 3.13
438+ The *keywords * parameter has now type :c:expr: `char * const * ` in C and
439+ :c:expr: `const char * const * ` in C++, instead of :c:expr: `char ** `.
432440 Added support for non-ASCII keyword parameter names.
433441
434442
435- .. c :function :: int PyArg_VaParseTupleAndKeywords (PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs)
443+
444+ .. c :function :: int PyArg_VaParseTupleAndKeywords (PyObject *args, PyObject *kw, const char *format, char * const *keywords, va_list vargs)
436445
437446 Identical to :c:func: `PyArg_ParseTupleAndKeywords `, except that it accepts a
438447 va_list rather than a variable number of arguments.
@@ -505,6 +514,19 @@ API Functions
505514
506515 PyArg_ParseTuple(args, "O|O:ref", &object, &callback)
507516
517+ .. c :macro :: PY_CXX_CONST
518+
519+ The value to be inserted, if any, before :c:expr: `char * const * `
520+ in the *keywords * parameter declaration of
521+ :c:func: `PyArg_ParseTupleAndKeywords ` and
522+ :c:func: `PyArg_VaParseTupleAndKeywords `.
523+ Default empty for C and ``const `` for C++
524+ (:c:expr: `const char * const * `).
525+ To override , define it to the desired value before including
526+ :file:`Python.h`.
527+
528+ .. versionadded:: 3.13
529+
508530
509531---------------
510532Building values
0 commit comments