]> granicus.if.org Git - python/commitdiff
Fixed documentation of functions with const char* arguments.
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 21 Jun 2015 14:11:21 +0000 (17:11 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 21 Jun 2015 14:11:21 +0000 (17:11 +0300)
Doc/c-api/conversion.rst
Doc/c-api/exceptions.rst
Doc/c-api/import.rst
Doc/c-api/init.rst
Doc/c-api/mapping.rst
Doc/c-api/marshal.rst
Doc/c-api/sys.rst
Doc/c-api/unicode.rst
Doc/extending/extending.rst
Doc/faq/extending.rst

index 9578f984fd8e7bed2227caadac1f98bb91363d42..9566d9d792000dff0f16a89b1b62e474e933e8a1 100644 (file)
@@ -119,13 +119,13 @@ The following functions provide locale-independent string to number conversions.
    .. versionadded:: 3.1
 
 
-.. c:function:: int PyOS_stricmp(char *s1, char *s2)
+.. c:function:: int PyOS_stricmp(const char *s1, const char *s2)
 
    Case insensitive comparison of strings. The function works almost
    identically to :c:func:`strcmp` except that it ignores the case.
 
 
-.. c:function:: int PyOS_strnicmp(char *s1, char *s2, Py_ssize_t  size)
+.. c:function:: int PyOS_strnicmp(const char *s1, const char *s2, Py_ssize_t  size)
 
    Case insensitive comparison of strings. The function works almost
    identically to :c:func:`strncmp` except that it ignores the case.
index d89c31c0df9e54ea9530a8aa72ccf4040bde6439..c2df767998e95e290f65e8c1b5bd255e2a6ee0e9 100644 (file)
@@ -324,7 +324,7 @@ in various ways.  There is a separate error indicator for each thread.
    .. versionadded:: 3.4
 
 
-.. c:function:: void PyErr_SyntaxLocationEx(char *filename, int lineno, int col_offset)
+.. c:function:: void PyErr_SyntaxLocationEx(const char *filename, int lineno, int col_offset)
 
    Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string
    decoded from the filesystem encoding (:func:`os.fsdecode`).
@@ -332,7 +332,7 @@ in various ways.  There is a separate error indicator for each thread.
    .. versionadded:: 3.2
 
 
-.. c:function:: void PyErr_SyntaxLocation(char *filename, int lineno)
+.. c:function:: void PyErr_SyntaxLocation(const char *filename, int lineno)
 
    Like :c:func:`PyErr_SyntaxLocationEx`, but the col_offset parameter is
    omitted.
@@ -451,7 +451,7 @@ in various ways.  There is a separate error indicator for each thread.
    only be called from the main thread.
 
 
-.. c:function:: PyObject* PyErr_NewException(char *name, PyObject *base, PyObject *dict)
+.. c:function:: PyObject* PyErr_NewException(const char *name, PyObject *base, PyObject *dict)
 
    This utility function creates and returns a new exception class. The *name*
    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.
    argument can be used to specify a dictionary of class variables and methods.
 
 
-.. c:function:: PyObject* PyErr_NewExceptionWithDoc(char *name, char *doc, PyObject *base, PyObject *dict)
+.. c:function:: PyObject* PyErr_NewExceptionWithDoc(const char *name, const char *doc, PyObject *base, PyObject *dict)
 
    Same as :c:func:`PyErr_NewException`, except that the new exception class can
    easily be given a docstring: If *doc* is non-*NULL*, it will be used as the
index 3641fc69b1ad58f1db4e681de6eddeae2978253d..60865f456f693e9a6c9c7cbaef55ec39d15eff9e 100644 (file)
@@ -39,7 +39,7 @@ Importing Modules
       behaviour isn't needed anymore.
 
 
-.. c:function:: PyObject* PyImport_ImportModuleEx(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)
+.. c:function:: PyObject* PyImport_ImportModuleEx(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)
 
    .. index:: builtin: __import__
 
@@ -70,7 +70,7 @@ Importing Modules
    .. versionadded:: 3.3
 
 
-.. c:function:: PyObject* PyImport_ImportModuleLevel(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level)
+.. c:function:: PyObject* PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level)
 
    Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is an
    UTF-8 encoded string instead of a Unicode object.
index 4d358ca757d7f8ec4c0ba1023f56d880eb5e909a..4bb50649ef4cf1410f7a4d61733593106d0117b8 100644 (file)
@@ -86,7 +86,7 @@ Process-wide parameters
 =======================
 
 
-.. c:function:: int Py_SetStandardStreamEncoding(char *encoding, char *errors)
+.. c:function:: int Py_SetStandardStreamEncoding(const char *encoding, const char *errors)
 
    .. index::
       single: Py_Initialize()
index 2803fd044e2706f623fc1491f5116d4d64240210..e34104708ca68c734336f3fb5ac18b8a79a8171b 100644 (file)
@@ -34,7 +34,7 @@ Mapping Protocol
    failure.  This is equivalent to the Python statement ``del o[key]``.
 
 
-.. c:function:: int PyMapping_HasKeyString(PyObject *o, char *key)
+.. c:function:: int PyMapping_HasKeyString(PyObject *o, const char *key)
 
    On success, return ``1`` if the mapping object has the key *key* and ``0``
    otherwise.  This is equivalent to the Python expression ``key in o``.
index 9ea0aaa54f7ef5d18f6e0f49393275f6c8a6a7ee..a6d0f4688d1b78ba815917d00ef83330ca5cef4c 100644 (file)
@@ -88,7 +88,7 @@ written using these routines?
    :exc:`TypeError`) and returns *NULL*.
 
 
-.. c:function:: PyObject* PyMarshal_ReadObjectFromString(char *string, Py_ssize_t len)
+.. c:function:: PyObject* PyMarshal_ReadObjectFromString(const char *string, Py_ssize_t len)
 
    Return a Python object from the data stream in a character buffer
    containing *len* bytes pointed to by *string*.
index 9760dca2df1e6149910f1a7f878ff34b8495cf05..7cead07081eca3d58f64093b944124d382099e7b 100644 (file)
@@ -56,12 +56,12 @@ These are utility functions that make functionality from the :mod:`sys` module
 accessible to C code.  They all work with the current interpreter thread's
 :mod:`sys` module's dict, which is contained in the internal thread state structure.
 
-.. c:function:: PyObject *PySys_GetObject(char *name)
+.. c:function:: PyObject *PySys_GetObject(const char *name)
 
    Return the object *name* from the :mod:`sys` module or *NULL* if it does
    not exist, without setting an exception.
 
-.. c:function:: int PySys_SetObject(char *name, PyObject *v)
+.. c:function:: int PySys_SetObject(const char *name, PyObject *v)
 
    Set *name* in the :mod:`sys` module to *v* unless *v* is *NULL*, in which
    case *name* is deleted from the sys module. Returns ``0`` on success, ``-1``
index 65d24c408346ca7d259f90ed7ee0d65a2e64459a..f7e99d6d993dc659e1994ad03e4905b25678fba9 100644 (file)
@@ -1628,7 +1628,7 @@ They all return *NULL* or ``-1`` if an exception occurs.
    respectively.
 
 
-.. c:function:: int PyUnicode_CompareWithASCIIString(PyObject *uni, char *string)
+.. c:function:: int PyUnicode_CompareWithASCIIString(PyObject *uni, const char *string)
 
    Compare a unicode object, *uni*, with *string* and return -1, 0, 1 for less
    than, equal, and greater than, respectively. It is best to pass only
index c10efa976d11cd6eb90fb0ab11c961041392d4b9..ba6bfa70a29fd5d7a063960cd8080bb5b4a3106b 100644 (file)
@@ -590,7 +590,7 @@ Extracting Parameters in Extension Functions
 
 The :c:func:`PyArg_ParseTuple` function is declared as follows::
 
-   int PyArg_ParseTuple(PyObject *arg, char *format, ...);
+   int PyArg_ParseTuple(PyObject *arg, const char *format, ...);
 
 The *arg* argument must be a tuple object containing an argument list passed
 from Python to a C function.  The *format* argument must be a format string,
@@ -683,7 +683,7 @@ Keyword Parameters for Extension Functions
 The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::
 
    int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,
-                                   char *format, char *kwlist[], ...);
+                                   const char *format, char *kwlist[], ...);
 
 The *arg* and *format* parameters are identical to those of the
 :c:func:`PyArg_ParseTuple` function.  The *kwdict* parameter is the dictionary of
@@ -760,7 +760,7 @@ Building Arbitrary Values
 This function is the counterpart to :c:func:`PyArg_ParseTuple`.  It is declared
 as follows::
 
-   PyObject *Py_BuildValue(char *format, ...);
+   PyObject *Py_BuildValue(const char *format, ...);
 
 It recognizes a set of format units similar to the ones recognized by
 :c:func:`PyArg_ParseTuple`, but the arguments (which are input to the function,
index 02bba591cfd13ace9362c7d334932bb16b3825f6..fea5a57601250f8f389fdd327d4a5cdfec0fd3fc 100644 (file)
@@ -115,8 +115,8 @@ call, a format string like that used with :c:func:`Py_BuildValue`, and the
 argument values::
 
    PyObject *
-   PyObject_CallMethod(PyObject *object, char *method_name,
-                       char *arg_format, ...);
+   PyObject_CallMethod(PyObject *object, const char *method_name,
+                       const char *arg_format, ...);
 
 This works for any object that has methods -- whether built-in or user-defined.
 You are responsible for eventually :c:func:`Py_DECREF`\ 'ing the return value.