[Python-checkins] cpython (3.4): Fixed documentation of functions with const char* arguments.

serhiy.storchaka python-checkins at python.org
Sun Jun 21 16:13:03 CEST 2015


https://hg.python.org/cpython/rev/ae5a4527f1fc
changeset:   96634:ae5a4527f1fc
branch:      3.4
parent:      96630:345d9b7542d9
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Jun 21 17:11:21 2015 +0300
summary:
  Fixed documentation of functions with const char* arguments.

files:
  Doc/c-api/conversion.rst    |  4 ++--
  Doc/c-api/exceptions.rst    |  8 ++++----
  Doc/c-api/import.rst        |  4 ++--
  Doc/c-api/init.rst          |  2 +-
  Doc/c-api/mapping.rst       |  2 +-
  Doc/c-api/marshal.rst       |  2 +-
  Doc/c-api/sys.rst           |  4 ++--
  Doc/c-api/unicode.rst       |  2 +-
  Doc/extending/extending.rst |  6 +++---
  Doc/faq/extending.rst       |  4 ++--
  10 files changed, 19 insertions(+), 19 deletions(-)


diff --git a/Doc/c-api/conversion.rst b/Doc/c-api/conversion.rst
--- a/Doc/c-api/conversion.rst
+++ b/Doc/c-api/conversion.rst
@@ -119,13 +119,13 @@
    .. 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.
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -324,7 +324,7 @@
    .. 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 @@
    .. 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 @@
    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 @@
    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
diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst
--- a/Doc/c-api/import.rst
+++ b/Doc/c-api/import.rst
@@ -39,7 +39,7 @@
       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 @@
    .. 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.
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -86,7 +86,7 @@
 =======================
 
 
-.. c:function:: int Py_SetStandardStreamEncoding(char *encoding, char *errors)
+.. c:function:: int Py_SetStandardStreamEncoding(const char *encoding, const char *errors)
 
    .. index::
       single: Py_Initialize()
diff --git a/Doc/c-api/mapping.rst b/Doc/c-api/mapping.rst
--- a/Doc/c-api/mapping.rst
+++ b/Doc/c-api/mapping.rst
@@ -34,7 +34,7 @@
    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``.
diff --git a/Doc/c-api/marshal.rst b/Doc/c-api/marshal.rst
--- a/Doc/c-api/marshal.rst
+++ b/Doc/c-api/marshal.rst
@@ -88,7 +88,7 @@
    :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*.
diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst
--- a/Doc/c-api/sys.rst
+++ b/Doc/c-api/sys.rst
@@ -56,12 +56,12 @@
 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``
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -1628,7 +1628,7 @@
    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
diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst
--- a/Doc/extending/extending.rst
+++ b/Doc/extending/extending.rst
@@ -590,7 +590,7 @@
 
 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 @@
 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 @@
 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,
diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst
--- a/Doc/faq/extending.rst
+++ b/Doc/faq/extending.rst
@@ -115,8 +115,8 @@
 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.

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list