Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 03863d2

Browse files
Fixed documentation of functions with const char* arguments.
1 parent 5fa22fc commit 03863d2

File tree

10 files changed

+19
-19
lines changed

10 files changed

+19
-19
lines changed

Doc/c-api/conversion.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ The following functions provide locale-independent string to number conversions.
119119
.. versionadded:: 3.1
120120
121121
122-
.. c:function:: int PyOS_stricmp(char *s1, char *s2)
122+
.. c:function:: int PyOS_stricmp(const char *s1, const char *s2)
123123
124124
Case insensitive comparison of strings. The function works almost
125125
identically to :c:func:`strcmp` except that it ignores the case.
126126
127127
128-
.. c:function:: int PyOS_strnicmp(char *s1, char *s2, Py_ssize_t size)
128+
.. c:function:: int PyOS_strnicmp(const char *s1, const char *s2, Py_ssize_t size)
129129
130130
Case insensitive comparison of strings. The function works almost
131131
identically to :c:func:`strncmp` except that it ignores the case.

Doc/c-api/exceptions.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,15 +324,15 @@ in various ways. There is a separate error indicator for each thread.
324324
.. versionadded:: 3.4
325325
326326
327-
.. c:function:: void PyErr_SyntaxLocationEx(char *filename, int lineno, int col_offset)
327+
.. c:function:: void PyErr_SyntaxLocationEx(const char *filename, int lineno, int col_offset)
328328
329329
Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string
330330
decoded from the filesystem encoding (:func:`os.fsdecode`).
331331
332332
.. versionadded:: 3.2
333333
334334
335-
.. c:function:: void PyErr_SyntaxLocation(char *filename, int lineno)
335+
.. c:function:: void PyErr_SyntaxLocation(const char *filename, int lineno)
336336
337337
Like :c:func:`PyErr_SyntaxLocationEx`, but the col_offset parameter is
338338
omitted.
@@ -451,7 +451,7 @@ in various ways. There is a separate error indicator for each thread.
451451
only be called from the main thread.
452452
453453
454-
.. c:function:: PyObject* PyErr_NewException(char *name, PyObject *base, PyObject *dict)
454+
.. c:function:: PyObject* PyErr_NewException(const char *name, PyObject *base, PyObject *dict)
455455
456456
This utility function creates and returns a new exception class. The *name*
457457
argument must be the name of the new exception, a C string of the form
@@ -466,7 +466,7 @@ in various ways. There is a separate error indicator for each thread.
466466
argument can be used to specify a dictionary of class variables and methods.
467467
468468
469-
.. c:function:: PyObject* PyErr_NewExceptionWithDoc(char *name, char *doc, PyObject *base, PyObject *dict)
469+
.. c:function:: PyObject* PyErr_NewExceptionWithDoc(const char *name, const char *doc, PyObject *base, PyObject *dict)
470470
471471
Same as :c:func:`PyErr_NewException`, except that the new exception class can
472472
easily be given a docstring: If *doc* is non-*NULL*, it will be used as the

Doc/c-api/import.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Importing Modules
3939
behaviour isn't needed anymore.
4040
4141
42-
.. c:function:: PyObject* PyImport_ImportModuleEx(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)
42+
.. c:function:: PyObject* PyImport_ImportModuleEx(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)
4343
4444
.. index:: builtin: __import__
4545
@@ -70,7 +70,7 @@ Importing Modules
7070
.. versionadded:: 3.3
7171
7272
73-
.. c:function:: PyObject* PyImport_ImportModuleLevel(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level)
73+
.. c:function:: PyObject* PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level)
7474
7575
Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is an
7676
UTF-8 encoded string instead of a Unicode object.

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Process-wide parameters
8686
=======================
8787

8888

89-
.. c:function:: int Py_SetStandardStreamEncoding(char *encoding, char *errors)
89+
.. c:function:: int Py_SetStandardStreamEncoding(const char *encoding, const char *errors)
9090
9191
.. index::
9292
single: Py_Initialize()

Doc/c-api/mapping.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Mapping Protocol
3434
failure. This is equivalent to the Python statement ``del o[key]``.
3535
3636
37-
.. c:function:: int PyMapping_HasKeyString(PyObject *o, char *key)
37+
.. c:function:: int PyMapping_HasKeyString(PyObject *o, const char *key)
3838
3939
On success, return ``1`` if the mapping object has the key *key* and ``0``
4040
otherwise. This is equivalent to the Python expression ``key in o``.

Doc/c-api/marshal.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ written using these routines?
8888
:exc:`TypeError`) and returns *NULL*.
8989
9090
91-
.. c:function:: PyObject* PyMarshal_ReadObjectFromString(char *string, Py_ssize_t len)
91+
.. c:function:: PyObject* PyMarshal_ReadObjectFromString(const char *string, Py_ssize_t len)
9292
9393
Return a Python object from the data stream in a character buffer
9494
containing *len* bytes pointed to by *string*.

Doc/c-api/sys.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ These are utility functions that make functionality from the :mod:`sys` module
5656
accessible to C code. They all work with the current interpreter thread's
5757
:mod:`sys` module's dict, which is contained in the internal thread state structure.
5858

59-
.. c:function:: PyObject *PySys_GetObject(char *name)
59+
.. c:function:: PyObject *PySys_GetObject(const char *name)
6060
6161
Return the object *name* from the :mod:`sys` module or *NULL* if it does
6262
not exist, without setting an exception.
6363
64-
.. c:function:: int PySys_SetObject(char *name, PyObject *v)
64+
.. c:function:: int PySys_SetObject(const char *name, PyObject *v)
6565
6666
Set *name* in the :mod:`sys` module to *v* unless *v* is *NULL*, in which
6767
case *name* is deleted from the sys module. Returns ``0`` on success, ``-1``

Doc/c-api/unicode.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,7 @@ They all return *NULL* or ``-1`` if an exception occurs.
16281628
respectively.
16291629
16301630
1631-
.. c:function:: int PyUnicode_CompareWithASCIIString(PyObject *uni, char *string)
1631+
.. c:function:: int PyUnicode_CompareWithASCIIString(PyObject *uni, const char *string)
16321632
16331633
Compare a unicode object, *uni*, with *string* and return -1, 0, 1 for less
16341634
than, equal, and greater than, respectively. It is best to pass only

Doc/extending/extending.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ Extracting Parameters in Extension Functions
590590

591591
The :c:func:`PyArg_ParseTuple` function is declared as follows::
592592

593-
int PyArg_ParseTuple(PyObject *arg, char *format, ...);
593+
int PyArg_ParseTuple(PyObject *arg, const char *format, ...);
594594

595595
The *arg* argument must be a tuple object containing an argument list passed
596596
from Python to a C function. The *format* argument must be a format string,
@@ -683,7 +683,7 @@ Keyword Parameters for Extension Functions
683683
The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::
684684

685685
int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,
686-
char *format, char *kwlist[], ...);
686+
const char *format, char *kwlist[], ...);
687687

688688
The *arg* and *format* parameters are identical to those of the
689689
:c:func:`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of
@@ -760,7 +760,7 @@ Building Arbitrary Values
760760
This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is declared
761761
as follows::
762762

763-
PyObject *Py_BuildValue(char *format, ...);
763+
PyObject *Py_BuildValue(const char *format, ...);
764764

765765
It recognizes a set of format units similar to the ones recognized by
766766
:c:func:`PyArg_ParseTuple`, but the arguments (which are input to the function,

Doc/faq/extending.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ call, a format string like that used with :c:func:`Py_BuildValue`, and the
115115
argument values::
116116

117117
PyObject *
118-
PyObject_CallMethod(PyObject *object, char *method_name,
119-
char *arg_format, ...);
118+
PyObject_CallMethod(PyObject *object, const char *method_name,
119+
const char *arg_format, ...);
120120

121121
This works for any object that has methods -- whether built-in or user-defined.
122122
You are responsible for eventually :c:func:`Py_DECREF`\ 'ing the return value.

0 commit comments

Comments
 (0)