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

Commit cd881b8

Browse files
Fixed documentation of functions with const char* arguments.
2 parents 289dd19 + 03863d2 commit cd881b8

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
@@ -244,15 +244,15 @@ NULL pointer for use in a ``return`` statement.
244244
.. versionadded:: 3.4
245245
246246
247-
.. c:function:: void PyErr_SyntaxLocationEx(char *filename, int lineno, int col_offset)
247+
.. c:function:: void PyErr_SyntaxLocationEx(const char *filename, int lineno, int col_offset)
248248
249249
Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string
250250
decoded from the filesystem encoding (:func:`os.fsdecode`).
251251
252252
.. versionadded:: 3.2
253253
254254
255-
.. c:function:: void PyErr_SyntaxLocation(char *filename, int lineno)
255+
.. c:function:: void PyErr_SyntaxLocation(const char *filename, int lineno)
256256
257257
Like :c:func:`PyErr_SyntaxLocationEx`, but the col_offset parameter is
258258
omitted.
@@ -516,7 +516,7 @@ Signal Handling
516516
Exception Classes
517517
=================
518518
519-
.. c:function:: PyObject* PyErr_NewException(char *name, PyObject *base, PyObject *dict)
519+
.. c:function:: PyObject* PyErr_NewException(const char *name, PyObject *base, PyObject *dict)
520520
521521
This utility function creates and returns a new exception class. The *name*
522522
argument must be the name of the new exception, a C string of the form
@@ -531,7 +531,7 @@ Exception Classes
531531
argument can be used to specify a dictionary of class variables and methods.
532532
533533
534-
.. c:function:: PyObject* PyErr_NewExceptionWithDoc(char *name, char *doc, PyObject *base, PyObject *dict)
534+
.. c:function:: PyObject* PyErr_NewExceptionWithDoc(const char *name, const char *doc, PyObject *base, PyObject *dict)
535535
536536
Same as :c:func:`PyErr_NewException`, except that the new exception class can
537537
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
@@ -110,12 +110,12 @@ These are utility functions that make functionality from the :mod:`sys` module
110110
accessible to C code. They all work with the current interpreter thread's
111111
:mod:`sys` module's dict, which is contained in the internal thread state structure.
112112
113-
.. c:function:: PyObject *PySys_GetObject(char *name)
113+
.. c:function:: PyObject *PySys_GetObject(const char *name)
114114
115115
Return the object *name* from the :mod:`sys` module or *NULL* if it does
116116
not exist, without setting an exception.
117117
118-
.. c:function:: int PySys_SetObject(char *name, PyObject *v)
118+
.. c:function:: int PySys_SetObject(const char *name, PyObject *v)
119119
120120
Set *name* in the :mod:`sys` module to *v* unless *v* is *NULL*, in which
121121
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
@@ -1635,7 +1635,7 @@ They all return *NULL* or ``-1`` if an exception occurs.
16351635
respectively.
16361636
16371637
1638-
.. c:function:: int PyUnicode_CompareWithASCIIString(PyObject *uni, char *string)
1638+
.. c:function:: int PyUnicode_CompareWithASCIIString(PyObject *uni, const char *string)
16391639
16401640
Compare a unicode object, *uni*, with *string* and return -1, 0, 1 for less
16411641
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
@@ -600,7 +600,7 @@ Extracting Parameters in Extension Functions
600600

601601
The :c:func:`PyArg_ParseTuple` function is declared as follows::
602602

603-
int PyArg_ParseTuple(PyObject *arg, char *format, ...);
603+
int PyArg_ParseTuple(PyObject *arg, const char *format, ...);
604604

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

695695
int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,
696-
char *format, char *kwlist[], ...);
696+
const char *format, char *kwlist[], ...);
697697

698698
The *arg* and *format* parameters are identical to those of the
699699
:c:func:`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of
@@ -770,7 +770,7 @@ Building Arbitrary Values
770770
This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is declared
771771
as follows::
772772

773-
PyObject *Py_BuildValue(char *format, ...);
773+
PyObject *Py_BuildValue(const char *format, ...);
774774

775775
It recognizes a set of format units similar to the ones recognized by
776776
: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)