]> granicus.if.org Git - python/commitdiff
Issue #1772673: The type of `char*` arguments now changed to `const char*`.
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 19 Oct 2013 18:03:34 +0000 (21:03 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Sat, 19 Oct 2013 18:03:34 +0000 (21:03 +0300)
39 files changed:
Doc/c-api/dict.rst
Doc/c-api/file.rst
Doc/c-api/import.rst
Doc/c-api/long.rst
Doc/c-api/mapping.rst
Doc/c-api/veryhigh.rst
Doc/data/refcounts.dat
Include/abstract.h
Include/fileobject.h
Include/grammar.h
Include/import.h
Include/longobject.h
Include/marshal.h
Include/parsetok.h
Include/pyport.h
Include/pythonrun.h
Misc/NEWS
Modules/_sqlite/statement.c
Modules/cjkcodecs/cjkcodecs.h
Modules/readline.c
Objects/abstract.c
Objects/bytesobject.c
Objects/exceptions.c
Objects/fileobject.c
Objects/longobject.c
Objects/unicodeobject.c
Parser/grammar.c
Parser/myreadline.c
Parser/parser.c
Parser/parsetok.c
Parser/pgenmain.c
Parser/tokenizer.c
Parser/tokenizer.h
Python/ast.c
Python/bltinmodule.c
Python/codecs.c
Python/import.c
Python/marshal.c
Python/mystrtoul.c

index 1f599fee78f2b5857021f7d434d5a8f81afa3ece..5a9dca2845003dac5fb7b19d0cf20129e016955f 100644 (file)
@@ -84,7 +84,7 @@ Dictionary Objects
    on failure.
 
 
-.. c:function:: int PyDict_DelItemString(PyObject *p, char *key)
+.. c:function:: int PyDict_DelItemString(PyObject *p, const char *key)
 
    Remove the entry in dictionary *p* which has a key specified by the string
    *key*.  Return ``0`` on success or ``-1`` on failure.
index cc190c9f4241ce5334ef308abb6e2decd6f5a959..6f2ecee51fd86a389dae5aa2104cfc0e8ecab289 100644 (file)
@@ -17,7 +17,7 @@ error reporting in the interpreter; third-party code is advised to access
 the :mod:`io` APIs instead.
 
 
-.. c:function:: PyFile_FromFd(int fd, char *name, char *mode, int buffering, char *encoding, char *errors, char *newline, int closefd)
+.. c:function:: PyFile_FromFd(int fd, const char *name, const char *mode, int buffering, const char *encoding, const char *errors, const char *newline, int closefd)
 
    Create a Python file object from the file descriptor of an already
    opened file *fd*.  The arguments *name*, *encoding*, *errors* and *newline*
index 270152ebbe742b6687256a32c0af5d30696e6f37..6cd2b8bea0e1bf1d97c55e4ba4b3dc510a7d37d5 100644 (file)
@@ -118,7 +118,7 @@ Importing Modules
    encoded string instead of a Unicode object.
 
 
-.. c:function:: PyObject* PyImport_ExecCodeModule(char *name, PyObject *co)
+.. c:function:: PyObject* PyImport_ExecCodeModule(const char *name, PyObject *co)
 
    .. index:: builtin: compile
 
@@ -145,7 +145,7 @@ Importing Modules
    :c:func:`PyImport_ExecCodeModuleWithPathnames`.
 
 
-.. c:function:: PyObject* PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname)
+.. c:function:: PyObject* PyImport_ExecCodeModuleEx(const char *name, PyObject *co, const char *pathname)
 
    Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute of
    the module object is set to *pathname* if it is non-``NULL``.
@@ -162,7 +162,7 @@ Importing Modules
    .. versionadded:: 3.3
 
 
-.. c:function:: PyObject* PyImport_ExecCodeModuleWithPathnames(char *name, PyObject *co, char *pathname, char *cpathname)
+.. c:function:: PyObject* PyImport_ExecCodeModuleWithPathnames(const char *name, PyObject *co, const char *pathname, const char *cpathname)
 
    Like :c:func:`PyImport_ExecCodeModuleObject`, but *name*, *pathname* and
    *cpathname* are UTF-8 encoded strings. Attempts are also made to figure out
@@ -246,7 +246,7 @@ Importing Modules
    .. versionadded:: 3.3
 
 
-.. c:function:: int PyImport_ImportFrozenModule(char *name)
+.. c:function:: int PyImport_ImportFrozenModule(const char *name)
 
    Similar to :c:func:`PyImport_ImportFrozenModuleObject`, but the name is a
    UTF-8 encoded string instead of a Unicode object.
index d5430fd56aa1e43d7f2bc6ca3cf956e57cd1b810..b3480159c03af022c1f6dbecd2e3a214a86ee64b 100644 (file)
@@ -80,7 +80,7 @@ All integers are implemented as "long" integer objects of arbitrary size.
    *NULL* on failure.
 
 
-.. c:function:: PyObject* PyLong_FromString(char *str, char **pend, int base)
+.. c:function:: PyObject* PyLong_FromString(const char *str, char **pend, int base)
 
    Return a new :c:type:`PyLongObject` based on the string value in *str*, which
    is interpreted according to the radix in *base*.  If *pend* is non-*NULL*,
index 0ef29616e549c5b5406038bc47a2f3776dcb0290..2803fd044e2706f623fc1491f5116d4d64240210 100644 (file)
@@ -22,7 +22,7 @@ Mapping Protocol
    expression ``len(o)``.
 
 
-.. c:function:: int PyMapping_DelItemString(PyObject *o, char *key)
+.. c:function:: int PyMapping_DelItemString(PyObject *o, const char *key)
 
    Remove the mapping for object *key* from the object *o*. Return ``-1`` on
    failure.  This is equivalent to the Python statement ``del o[key]``.
@@ -67,13 +67,13 @@ Mapping Protocol
    the Python expression ``list(o.items())``.
 
 
-.. c:function:: PyObject* PyMapping_GetItemString(PyObject *o, char *key)
+.. c:function:: PyObject* PyMapping_GetItemString(PyObject *o, const char *key)
 
    Return element of *o* corresponding to the object *key* or *NULL* on failure.
    This is the equivalent of the Python expression ``o[key]``.
 
 
-.. c:function:: int PyMapping_SetItemString(PyObject *o, char *key, PyObject *v)
+.. c:function:: int PyMapping_SetItemString(PyObject *o, const char *key, PyObject *v)
 
    Map the object *key* to the value *v* in object *o*. Returns ``-1`` on failure.
    This is the equivalent of the Python statement ``o[key] = v``.
index a1299636a62d0fefffe2731ff81f93eeb166f2de..9f21b89b9421a19d8a5f37f26fec082a497e5a35 100644 (file)
@@ -155,7 +155,7 @@ the same library that the Python runtime is using.
    Python source code.
 
 
-.. c:var:: char* (*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *)
+.. c:var:: char* (*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *)
 
    Can be set to point to a function with the prototype
    ``char *func(FILE *stdin, FILE *stdout, char *prompt)``,
index 83f23ebd1112814bde1d8a7dfeab6e9bf64ef22f..814c3b043793b7b8e35889b8d95c6692435dbf63 100644 (file)
@@ -508,13 +508,13 @@ PyImport_AddModule:const char*:name::
 PyImport_Cleanup:void:::
 
 PyImport_ExecCodeModule:PyObject*::+1:
-PyImport_ExecCodeModule:char*:name::
+PyImport_ExecCodeModule:const char*:name::
 PyImport_ExecCodeModule:PyObject*:co:0:
 
 PyImport_ExecCodeModuleEx:PyObject*::+1:
-PyImport_ExecCodeModuleEx:char*:name::
+PyImport_ExecCodeModuleEx:const char*:name::
 PyImport_ExecCodeModuleEx:PyObject*:co:0:
-PyImport_ExecCodeModuleEx:char*:pathname::
+PyImport_ExecCodeModuleEx:const char*:pathname::
 
 PyImport_GetMagicNumber:long:::
 
@@ -524,7 +524,7 @@ PyImport_Import:PyObject*::+1:
 PyImport_Import:PyObject*:name:0:
 
 PyImport_ImportFrozenModule:int:::
-PyImport_ImportFrozenModule:char*:::
+PyImport_ImportFrozenModule:const char*:::
 
 PyImport_ImportModule:PyObject*::+1:
 PyImport_ImportModule:const char*:name::
@@ -673,7 +673,7 @@ PyLong_FromUnsignedLongLong:PyObject*::+1:
 PyLong_FromUnsignedLongLong:unsigned long long:v::
 
 PyLong_FromString:PyObject*::+1:
-PyLong_FromString:char*:str::
+PyLong_FromString:const char*:str::
 PyLong_FromString:char**:pend::
 PyLong_FromString:int:base::
 
@@ -701,7 +701,7 @@ PyMapping_DelItemString:const char*:key::
 
 PyMapping_GetItemString:PyObject*::+1:
 PyMapping_GetItemString:PyObject*:o:0:
-PyMapping_GetItemString:char*:key::
+PyMapping_GetItemString:const char*:key::
 
 PyMapping_HasKey:int:::
 PyMapping_HasKey:PyObject*:o:0:
@@ -709,7 +709,7 @@ PyMapping_HasKey:PyObject*:key::
 
 PyMapping_HasKeyString:int:::
 PyMapping_HasKeyString:PyObject*:o:0:
-PyMapping_HasKeyString:char*:key::
+PyMapping_HasKeyString:const char*:key::
 
 PyMapping_Items:PyObject*::+1:
 PyMapping_Items:PyObject*:o:0:
@@ -722,7 +722,7 @@ PyMapping_Length:PyObject*:o:0:
 
 PyMapping_SetItemString:int:::
 PyMapping_SetItemString:PyObject*:o:0:
-PyMapping_SetItemString:char*:key::
+PyMapping_SetItemString:const char*:key::
 PyMapping_SetItemString:PyObject*:v:+1:
 
 PyMapping_Values:PyObject*::+1:
@@ -735,7 +735,7 @@ PyMarshal_ReadObjectFromFile:PyObject*::+1:
 PyMarshal_ReadObjectFromFile:FILE*:file::
 
 PyMarshal_ReadObjectFromString:PyObject*::+1:
-PyMarshal_ReadObjectFromString:char*:string::
+PyMarshal_ReadObjectFromString:const char*:string::
 PyMarshal_ReadObjectFromString:int:len::
 
 PyMarshal_WriteObjectToString:PyObject*::+1:
index a1f0595189e62eb8b1f485c90e4f1c5dc1b07ec0..d258ad5568756b1f4b2c4b9c4d4e44aa5ee22759 100644 (file)
@@ -144,7 +144,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
 
      /* Implemented elsewhere:
 
-     int PyObject_HasAttrString(PyObject *o, char *attr_name);
+     int PyObject_HasAttrString(PyObject *o, const char *attr_name);
 
      Returns 1 if o has the attribute attr_name, and 0 otherwise.
      This is equivalent to the Python expression:
@@ -156,7 +156,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
 
      /* Implemented elsewhere:
 
-     PyObject* PyObject_GetAttrString(PyObject *o, char *attr_name);
+     PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name);
 
      Retrieve an attributed named attr_name form object o.
      Returns the attribute value on success, or NULL on failure.
@@ -189,7 +189,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
 
      /* Implemented elsewhere:
 
-     int PyObject_SetAttrString(PyObject *o, char *attr_name, PyObject *v);
+     int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v);
 
      Set the value of the attribute named attr_name, for object o,
      to the value, v. Returns -1 on failure.  This is
@@ -209,7 +209,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
 
      /* implemented as a macro:
 
-     int PyObject_DelAttrString(PyObject *o, char *attr_name);
+     int PyObject_DelAttrString(PyObject *o, const char *attr_name);
 
      Delete attribute named attr_name, for object o. Returns
      -1 on failure.  This is the equivalent of the Python
@@ -434,7 +434,7 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
      statement: o[key]=v.
        */
 
-     PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, char *key);
+     PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, const char *key);
 
        /*
      Remove the mapping for object, key, from the object *o.
@@ -1156,7 +1156,7 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
 
      /* implemented as a macro:
 
-     int PyMapping_DelItemString(PyObject *o, char *key);
+     int PyMapping_DelItemString(PyObject *o, const char *key);
 
      Remove the mapping for object, key, from the object *o.
      Returns -1 on failure.  This is equivalent to
@@ -1174,7 +1174,7 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
        */
 #define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K))
 
-     PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, char *key);
+     PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, const char *key);
 
        /*
      On success, return 1 if the mapping object has the key, key,
@@ -1218,7 +1218,8 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
 
        */
 
-     PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, char *key);
+     PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o,
+                                                    const char *key);
 
        /*
      Return element of o corresponding to the object, key, or NULL
@@ -1226,7 +1227,7 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
      o[key].
        */
 
-     PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, char *key,
+     PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, const char *key,
                                             PyObject *value);
 
        /*
index a99c94d2d54dc10701ae53c334c4ccb4587193e4..0939744e6d32080f328b888a7cc81b54be324f39 100644 (file)
@@ -8,8 +8,9 @@ extern "C" {
 
 #define PY_STDIOTEXTMODE "b"
 
-PyAPI_FUNC(PyObject *) PyFile_FromFd(int, char *, char *, int, char *, char *,
-                                    char *, int);
+PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int,
+                                     const char *, const char *,
+                                     const char *, int);
 PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
 PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
 PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
index 862f6a8e6e704549743fbb5274f2958259c8cbcb..ba7d19d821b68e1ee313c1f5939c59b58ed27665 100644 (file)
@@ -69,13 +69,13 @@ typedef struct {
 /* FUNCTIONS */
 
 grammar *newgrammar(int start);
-dfa *adddfa(grammar *g, int type, char *name);
+dfa *adddfa(grammar *g, int type, const char *name);
 int addstate(dfa *d);
 void addarc(dfa *d, int from, int to, int lbl);
 dfa *PyGrammar_FindDFA(grammar *g, int type);
 
-int addlabel(labellist *ll, int type, char *str);
-int findlabel(labellist *ll, int type, char *str);
+int addlabel(labellist *ll, int type, const char *str);
+int findlabel(labellist *ll, int type, const char *str);
 const char *PyGrammar_LabelRepr(label *lb);
 void translatelabels(grammar *g);
 
index 90049e051b18d35494ffef3400e28f879c1e3ebb..4a515d5b6be9f7ea26f5c8545796405ec7343350 100644 (file)
@@ -13,19 +13,19 @@ PyMODINIT_FUNC PyInit_imp(void);
 PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
 PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
-    char *name,                 /* UTF-8 encoded string */
+    const char *name,           /* UTF-8 encoded string */
     PyObject *co
     );
 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
-    char *name,                 /* UTF-8 encoded string */
+    const char *name,           /* UTF-8 encoded string */
     PyObject *co,
-    char *pathname              /* decoded from the filesystem encoding */
+    const char *pathname        /* decoded from the filesystem encoding */
     );
 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
-    char *name,                 /* UTF-8 encoded string */
+    const char *name,           /* UTF-8 encoded string */
     PyObject *co,
-    char *pathname,             /* decoded from the filesystem encoding */
-    char *cpathname             /* decoded from the filesystem encoding */
+    const char *pathname,       /* decoded from the filesystem encoding */
+    const char *cpathname       /* decoded from the filesystem encoding */
     );
 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
     PyObject *name,
@@ -72,7 +72,7 @@ PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
     PyObject *name
     );
 PyAPI_FUNC(int) PyImport_ImportFrozenModule(
-    char *name                  /* UTF-8 encoded string */
+    const char *name            /* UTF-8 encoded string */
     );
 
 #ifndef Py_LIMITED_API
@@ -92,12 +92,12 @@ PyAPI_FUNC(PyObject *)_PyImport_FindBuiltin(
 PyAPI_FUNC(PyObject *)_PyImport_FindExtensionObject(PyObject *, PyObject *);
 PyAPI_FUNC(int)_PyImport_FixupBuiltin(
     PyObject *mod,
-    char *name                  /* UTF-8 encoded string */
+    const char *name            /* UTF-8 encoded string */
     );
 PyAPI_FUNC(int)_PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
 
 struct _inittab {
-    char *name;                 /* ASCII encoded string */
+    const char *name;           /* ASCII encoded string */
     PyObject* (*initfunc)(void);
 };
 PyAPI_DATA(struct _inittab *) PyImport_Inittab;
index e62d954c8bfffc56e707a8019a3e2be977175bf4..7c3f6d02d5c71a3fdcc741c67645300394752165 100644 (file)
@@ -93,7 +93,7 @@ PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
 PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
 #endif /* HAVE_LONG_LONG */
 
-PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int);
+PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int);
 #ifndef Py_LIMITED_API
 PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
 PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base);
@@ -189,8 +189,8 @@ PyAPI_FUNC(int) _PyLong_FormatAdvancedWriter(
 /* These aren't really part of the int object, but they're handy. The
    functions are in Python/mystrtoul.c.
  */
-PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int);
-PyAPI_FUNC(long) PyOS_strtol(char *, char **, int);
+PyAPI_FUNC(unsigned long) PyOS_strtoul(const char *, char **, int);
+PyAPI_FUNC(long) PyOS_strtol(const char *, char **, int);
 
 #ifdef __cplusplus
 }
index 77d9c5eec3abd2efec5636064d6ddbdbb4026959..09d9337e57b0aa3ca18ba4a64bc360f8661ec080 100644 (file)
@@ -19,7 +19,8 @@ PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *);
 PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *);
 PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *);
 #endif
-PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t);
+PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *,
+                                                      Py_ssize_t);
 
 #ifdef __cplusplus
 }
index 68b59bcc5184b981160e8beb56c6f68b838b1bb3..2acb854672774d00a63e86c2ea1e2573419da14c 100644 (file)
@@ -38,7 +38,8 @@ typedef struct {
 PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
                                               perrdetail *);
 PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
-                                             char *, char *, perrdetail *);
+                                             const char *, const char *,
+                                             perrdetail *);
 
 PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
                                               perrdetail *, int);
@@ -48,8 +49,8 @@ PyAPI_FUNC(node *) PyParser_ParseFileFlags(
     const char *enc,
     grammar *g,
     int start,
-    char *ps1,
-    char *ps2,
+    const char *ps1,
+    const char *ps2,
     perrdetail *err_ret,
     int flags);
 PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(
@@ -58,8 +59,8 @@ PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(
     const char *enc,
     grammar *g,
     int start,
-    char *ps1,
-    char *ps2,
+    const char *ps1,
+    const char *ps2,
     perrdetail *err_ret,
     int *flags);
 PyAPI_FUNC(node *) PyParser_ParseFileObject(
@@ -68,8 +69,8 @@ PyAPI_FUNC(node *) PyParser_ParseFileObject(
     const char *enc,
     grammar *g,
     int start,
-    char *ps1,
-    char *ps2,
+    const char *ps1,
+    const char *ps2,
     perrdetail *err_ret,
     int *flags);
 
index ca20b226016a90ad93af3696d4b3c1742ef2d2ce..17dad4165aec5ab58071cea01566d0629023d974 100644 (file)
@@ -673,8 +673,10 @@ extern char * _getpty(int *, int, mode_t, int);
 /* BSDI does not supply a prototype for the 'openpty' and 'forkpty'
    functions, even though they are included in libutil. */
 #include <termios.h>
-extern int openpty(int *, int *, char *, struct termios *, struct winsize *);
-extern pid_t forkpty(int *, char *, struct termios *, struct winsize *);
+extern int openpty(int *, int *, char *,
+                   const struct termios *, const struct winsize *);
+extern pid_t forkpty(int *, char *,
+                     const struct termios *, const struct winsize *);
 #endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */
 #endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */
 
index 7f67ab7829763f0aec4e02646965ef249eb95faa..ec0565e2539d88b168731b72a0d700e7e9dcd6d2 100644 (file)
@@ -261,10 +261,10 @@ PyAPI_DATA(PyThreadState *) _Py_Finalizing;
 
 /* Stuff with no proper home (yet) */
 #ifndef Py_LIMITED_API
-PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
+PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
 #endif
 PyAPI_DATA(int) (*PyOS_InputHook)(void);
-PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);
+PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
 #ifndef Py_LIMITED_API
 PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
 #endif
index 78efa315b382d3b1aaaf6fc584355c13f20ac425..f752a94011541a3eb22ecf8e56f8e3813dc48302 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -166,6 +166,8 @@ Library
 C API
 -----
 
+- Issue #1772673: The type of `char*` arguments now changed to `const char*`.
+
 - Issue #16129: Added a `Py_SetStandardStreamEncoding` pre-initialization API
   to allow embedding applications like Blender to force a particular
   encoding and error handler for the standard IO streams (initial patch by
index 36beef10a1f53746e0a63b93728a29a7eb5ab825..b056d8b5c667111fafeaedd5c63b768b8352323e 100644 (file)
@@ -248,7 +248,7 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para
                 current_param = PyDict_GetItemString(parameters, binding_name);
                 Py_XINCREF(current_param);
             } else {
-                current_param = PyMapping_GetItemString(parameters, (char*)binding_name);
+                current_param = PyMapping_GetItemString(parameters, binding_name);
             }
             if (!current_param) {
                 PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding %d.", i);
index 9e92db2fa57b76988071c2f959638d8550419892..35723f4c52219cfc38278f26b12016e7a0bf25fe 100644 (file)
@@ -371,7 +371,7 @@ importmap(const char *modname, const char *symbol,
 {
     PyObject *o, *mod;
 
-    mod = PyImport_ImportModule((char *)modname);
+    mod = PyImport_ImportModule(modname);
     if (mod == NULL)
         return -1;
 
index d14a09f296e6cad179cdcb48e8788317626a5254..f255a8747f9f87cff0dca15ed66dba497a3cde0b 100644 (file)
@@ -1043,7 +1043,7 @@ rlhandler(char *text)
 extern PyThreadState* _PyOS_ReadlineTState;
 
 static char *
-readline_until_enter_or_signal(char *prompt, int *signal)
+readline_until_enter_or_signal(const char *prompt, int *signal)
 {
     char * not_done_reading = "";
     fd_set selectset;
@@ -1145,7 +1145,7 @@ readline_until_enter_or_signal(char *prompt, int *signal)
 
 
 static char *
-call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
+call_readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
 {
     size_t n;
     char *p, *q;
index 078b4bcac7cabff1de4e5006632c922dc00a6333..d937892781628acf23bfbda39398d37b133bf19f 100644 (file)
@@ -223,7 +223,7 @@ PyObject_DelItem(PyObject *o, PyObject *key)
 }
 
 int
-PyObject_DelItemString(PyObject *o, char *key)
+PyObject_DelItemString(PyObject *o, const char *key)
 {
     PyObject *okey;
     int ret;
@@ -1950,7 +1950,7 @@ PyMapping_Length(PyObject *o)
 #define PyMapping_Length PyMapping_Size
 
 PyObject *
-PyMapping_GetItemString(PyObject *o, char *key)
+PyMapping_GetItemString(PyObject *o, const char *key)
 {
     PyObject *okey, *r;
 
@@ -1966,7 +1966,7 @@ PyMapping_GetItemString(PyObject *o, char *key)
 }
 
 int
-PyMapping_SetItemString(PyObject *o, char *key, PyObject *value)
+PyMapping_SetItemString(PyObject *o, const char *key, PyObject *value)
 {
     PyObject *okey;
     int r;
@@ -1985,7 +1985,7 @@ PyMapping_SetItemString(PyObject *o, char *key, PyObject *value)
 }
 
 int
-PyMapping_HasKeyString(PyObject *o, char *key)
+PyMapping_HasKeyString(PyObject *o, const char *key)
 {
     PyObject *v;
 
index 3a2906cf3c8e776fbbf0eb782b248ebee500021f..613269045bb9525af16fe8ba68bfc1505032bac1 100644 (file)
@@ -1347,7 +1347,7 @@ do_argstrip(PyBytesObject *self, int striptype, PyObject *args)
 {
     PyObject *sep = NULL;
 
-    if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep))
+    if (!PyArg_ParseTuple(args, stripformat[striptype], &sep))
         return NULL;
 
     if (sep != NULL && sep != Py_None) {
index 79bbb8f2ff6d3053bb5c64fbbb38a115d17871d5..de5d7468581016ca595dbc6fc0365450f12591a6 100644 (file)
@@ -121,11 +121,11 @@ BaseException_str(PyBaseExceptionObject *self)
 static PyObject *
 BaseException_repr(PyBaseExceptionObject *self)
 {
-    char *name;
-    char *dot;
+    const char *name;
+    const char *dot;
 
-    name = (char *)Py_TYPE(self)->tp_name;
-    dot = strrchr(name, '.');
+    name = Py_TYPE(self)->tp_name;
+    dot = (const char *) strrchr(name, '.');
     if (dot != NULL) name = dot+1;
 
     return PyUnicode_FromFormat("%s%R", name, self->args);
index f273b0b44bf474a1413aa25687ca49dcefb95536..596f909755d7487676cdbda77c2c6ece7026e9c0 100644 (file)
@@ -26,8 +26,8 @@ extern "C" {
 /* External C interface */
 
 PyObject *
-PyFile_FromFd(int fd, char *name, char *mode, int buffering, char *encoding,
-              char *errors, char *newline, int closefd)
+PyFile_FromFd(int fd, const char *name, const char *mode, int buffering, const char *encoding,
+              const char *errors, const char *newline, int closefd)
 {
     PyObject *io, *stream;
     _Py_IDENTIFIER(open);
index 876cd19e61efb8d2ef0122c28f49e1fbcbf52817..a5c0d1b33f392b5890f8ff1a2cf59ea1007f7abb 100644 (file)
@@ -1941,10 +1941,10 @@ unsigned char _PyLong_DigitValue[256] = {
  * string characters.
  */
 static PyLongObject *
-long_from_binary_base(char **str, int base)
+long_from_binary_base(const char **str, int base)
 {
-    char *p = *str;
-    char *start = p;
+    const char *p = *str;
+    const char *start = p;
     int bits_per_char;
     Py_ssize_t n;
     PyLongObject *z;
@@ -2009,10 +2009,10 @@ long_from_binary_base(char **str, int base)
  * If unsuccessful, NULL will be returned.
  */
 PyObject *
-PyLong_FromString(char *str, char **pend, int base)
+PyLong_FromString(const char *str, char **pend, int base)
 {
     int sign = 1, error_if_nonzero = 0;
-    char *start, *orig_str = str;
+    const char *start, *orig_str = str;
     PyLongObject *z = NULL;
     PyObject *strobj;
     Py_ssize_t slen;
@@ -2147,7 +2147,7 @@ digit beyond the first.
         int convwidth;
         twodigits convmultmax, convmult;
         digit *pz, *pzstop;
-        char* scan;
+        const char* scan;
 
         static double log_base_BASE[37] = {0.0e0,};
         static int convwidth_base[37] = {0,};
@@ -2275,12 +2275,12 @@ digit beyond the first.
     if (z == NULL)
         return NULL;
     if (pend != NULL)
-        *pend = str;
+        *pend = (char *)str;
     return (PyObject *) z;
 
   onError:
     if (pend != NULL)
-        *pend = str;
+        *pend = (char *)str;
     Py_XDECREF(z);
     slen = strlen(orig_str) < 200 ? strlen(orig_str) : 200;
     strobj = PyUnicode_FromStringAndSize(orig_str, slen);
index b9e8e1e003f31871f1827a1c1ffc3b42da769076..ff806cf1a115db4fab00c6525c726bae11137484 100644 (file)
@@ -11874,7 +11874,7 @@ do_argstrip(PyObject *self, int striptype, PyObject *args)
 {
     PyObject *sep = NULL;
 
-    if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep))
+    if (!PyArg_ParseTuple(args, stripformat[striptype], &sep))
         return NULL;
 
     if (sep != NULL && sep != Py_None) {
index f2a25cab0c6243f5359da5d2c6d4aeb364b261c1..d4270de6b76fc3d97f52d093658f5e786c4cd6fb 100644 (file)
@@ -29,7 +29,7 @@ newgrammar(int start)
 }
 
 dfa *
-adddfa(grammar *g, int type, char *name)
+adddfa(grammar *g, int type, const char *name)
 {
     dfa *d;
 
@@ -85,7 +85,7 @@ addarc(dfa *d, int from, int to, int lbl)
 }
 
 int
-addlabel(labellist *ll, int type, char *str)
+addlabel(labellist *ll, int type, const char *str)
 {
     int i;
     label *lb;
@@ -111,7 +111,7 @@ addlabel(labellist *ll, int type, char *str)
 /* Same, but rather dies than adds */
 
 int
-findlabel(labellist *ll, int type, char *str)
+findlabel(labellist *ll, int type, const char *str)
 {
     int i;
 
index 8bb35bd59eca73bc1644675c4bbff894b0ff9c2d..a1c4b5c896ae1dd021332c4e20da92d0041422a2 100644 (file)
@@ -109,7 +109,7 @@ my_fgets(char *buf, int len, FILE *fp)
 /* Readline implementation using fgets() */
 
 char *
-PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
+PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
 {
     size_t n;
     char *p, *pr;
@@ -170,13 +170,13 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
 
    Note: Python expects in return a buffer allocated with PyMem_Malloc. */
 
-char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);
+char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
 
 
 /* Interface used by tokenizer.c and bltinmodule.c */
 
 char *
-PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
+PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
 {
     char *rv, *res;
     size_t len;
index fc102f2a3226ddbdb4e2db1a4695b02c8c01a210..56ec5148d3034cfc9cad0982df92e6c5b3d0873a 100644 (file)
@@ -134,13 +134,13 @@ push(stack *s, int type, dfa *d, int newstate, int lineno, int col_offset)
 /* PARSER PROPER */
 
 static int
-classify(parser_state *ps, int type, char *str)
+classify(parser_state *ps, int type, const char *str)
 {
     grammar *g = ps->p_grammar;
     int n = g->g_ll.ll_nlabels;
 
     if (type == NAME) {
-        char *s = str;
+        const char *s = str;
         label *l = g->g_ll.ll_label;
         int i;
         for (i = n; i > 0; i--, l++) {
index 2df91599268ef6175740f1bbaef902165ba65a14..b4957b851269811fecc5e88577445495db171b4b 100644 (file)
@@ -94,7 +94,8 @@ PyParser_ParseStringFlagsFilenameEx(const char *s, const char *filename_str,
 
 node *
 PyParser_ParseFile(FILE *fp, const char *filename, grammar *g, int start,
-                   char *ps1, char *ps2, perrdetail *err_ret)
+                   const char *ps1, const char *ps2,
+                   perrdetail *err_ret)
 {
     return PyParser_ParseFileFlags(fp, filename, NULL,
                                    g, start, ps1, ps2, err_ret, 0);
@@ -103,7 +104,8 @@ PyParser_ParseFile(FILE *fp, const char *filename, grammar *g, int start,
 node *
 PyParser_ParseFileFlags(FILE *fp, const char *filename, const char *enc,
                         grammar *g, int start,
-                        char *ps1, char *ps2, perrdetail *err_ret, int flags)
+                        const char *ps1, const char *ps2,
+                        perrdetail *err_ret, int flags)
 {
     int iflags = flags;
     return PyParser_ParseFileFlagsEx(fp, filename, enc, g, start, ps1,
@@ -113,15 +115,15 @@ PyParser_ParseFileFlags(FILE *fp, const char *filename, const char *enc,
 node *
 PyParser_ParseFileObject(FILE *fp, PyObject *filename,
                          const char *enc, grammar *g, int start,
-                         char *ps1, char *ps2, perrdetail *err_ret,
-                         int *flags)
+                         const char *ps1, const char *ps2,
+                         perrdetail *err_ret, int *flags)
 {
     struct tok_state *tok;
 
     if (initerr(err_ret, filename) < 0)
         return NULL;
 
-    if ((tok = PyTokenizer_FromFile(fp, (char *)enc, ps1, ps2)) == NULL) {
+    if ((tok = PyTokenizer_FromFile(fp, enc, ps1, ps2)) == NULL) {
         err_ret->error = E_NOMEM;
         return NULL;
     }
@@ -135,7 +137,8 @@ PyParser_ParseFileObject(FILE *fp, PyObject *filename,
 node *
 PyParser_ParseFileFlagsEx(FILE *fp, const char *filename,
                           const char *enc, grammar *g, int start,
-                          char *ps1, char *ps2, perrdetail *err_ret, int *flags)
+                          const char *ps1, const char *ps2,
+                          perrdetail *err_ret, int *flags)
 {
     node *n;
     PyObject *fileobj = NULL;
index a624dd2c61a71b38c73f0906bc63e2543d3564f6..017a4f9274304c17c43d6060dd2e5af7adfa166c 100644 (file)
@@ -138,7 +138,7 @@ Py_FatalError(const char *msg)
 /* No-nonsense my_readline() for tokenizer.c */
 
 char *
-PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
+PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
 {
     size_t n = 1000;
     char *p = (char *)PyMem_MALLOC(n);
index dafb4bd7752ec911ee361fb501d3b72c09985ca1..5bf7e84f26163489d923bbcef0a22a1954b2b426 100644 (file)
@@ -31,7 +31,7 @@
                || c == '_'\
                || (c >= 128))
 
-extern char *PyOS_Readline(FILE *, FILE *, char *);
+extern char *PyOS_Readline(FILE *, FILE *, const char *);
 /* Return malloc'ed string including trailing \n;
    empty malloc'ed string for EOF;
    NULL if interrupted */
@@ -780,7 +780,7 @@ PyTokenizer_FromString(const char *str, int exec_input)
     struct tok_state *tok = tok_new();
     if (tok == NULL)
         return NULL;
-    str = (char *)decode_str(str, exec_input, tok);
+    str = decode_str(str, exec_input, tok);
     if (str == NULL) {
         PyTokenizer_Free(tok);
         return NULL;
@@ -823,7 +823,8 @@ PyTokenizer_FromUTF8(const char *str, int exec_input)
 /* Set up tokenizer for file */
 
 struct tok_state *
-PyTokenizer_FromFile(FILE *fp, char* enc, char *ps1, char *ps2)
+PyTokenizer_FromFile(FILE *fp, const char* enc,
+                     const char *ps1, const char *ps2)
 {
     struct tok_state *tok = tok_new();
     if (tok == NULL)
index ed1f3aa147e9f64af10ea31799e84ed2eac9a4d0..1ce6eeba8ca59b01562aca2648ebc77cca1263ce 100644 (file)
@@ -35,7 +35,7 @@ struct tok_state {
     int indstack[MAXINDENT];            /* Stack of indents */
     int atbol;          /* Nonzero if at begin of new line */
     int pendin;         /* Pending indents (if > 0) or dedents (if < 0) */
-    char *prompt, *nextprompt;          /* For interactive prompting */
+    const char *prompt, *nextprompt;          /* For interactive prompting */
     int lineno;         /* Current line number */
     int level;          /* () [] {} Parentheses nesting level */
             /* Used to allow free continuations inside them */
@@ -69,8 +69,8 @@ struct tok_state {
 
 extern struct tok_state *PyTokenizer_FromString(const char *, int);
 extern struct tok_state *PyTokenizer_FromUTF8(const char *, int);
-extern struct tok_state *PyTokenizer_FromFile(FILE *, char*,
-                                              char *, char *);
+extern struct tok_state *PyTokenizer_FromFile(FILE *, const char*,
+                                              const char *, const char *);
 extern void PyTokenizer_Free(struct tok_state *);
 extern int PyTokenizer_Get(struct tok_state *, char **, char **);
 extern char * PyTokenizer_RestoreEncoding(struct tok_state* tok,
index 9ffe3c7681848e2fe366550ba8e2ad5faffe49a3..3bd24fdb1410e90195ad6a86ce6e2c664c7425d8 100644 (file)
@@ -3651,18 +3651,16 @@ parsenumber(struct compiling *c, const char *s)
     end = s + strlen(s) - 1;
     imflag = *end == 'j' || *end == 'J';
     if (s[0] == '0') {
-        x = (long) PyOS_strtoul((char *)s, (char **)&end, 0);
+        x = (long) PyOS_strtoul(s, (char **)&end, 0);
         if (x < 0 && errno == 0) {
-            return PyLong_FromString((char *)s,
-                                     (char **)0,
-                                     0);
+            return PyLong_FromString(s, (char **)0, 0);
         }
     }
     else
-        x = PyOS_strtol((char *)s, (char **)&end, 0);
+        x = PyOS_strtol(s, (char **)&end, 0);
     if (*end == '\0') {
         if (errno != 0)
-            return PyLong_FromString((char *)s, (char **)0, 0);
+            return PyLong_FromString(s, (char **)0, 0);
         return PyLong_FromLong(x);
     }
     /* XXX Huge floats may silently fail */
@@ -3685,8 +3683,8 @@ parsenumber(struct compiling *c, const char *s)
 static PyObject *
 decode_utf8(struct compiling *c, const char **sPtr, const char *end)
 {
-    char *s, *t;
-    t = s = (char *)*sPtr;
+    const char *s, *t;
+    t = s = *sPtr;
     /* while (s < end && *s != '\\') s++; */ /* inefficient for u".." */
     while (s < end && (*s & 0x80)) s++;
     *sPtr = s;
index 3f270b43631f8ada77662b10573767fab362984c..471387445775463f5d6a87953fafed3a8371dd56 100644 (file)
@@ -1335,7 +1335,7 @@ min_max(PyObject *args, PyObject *kwds, int op)
 
     if (positional)
         v = args;
-    else if (!PyArg_UnpackTuple(args, (char *)name, 1, 1, &v))
+    else if (!PyArg_UnpackTuple(args, name, 1, 1, &v))
         return NULL;
 
     emptytuple = PyTuple_New(0);
index cb9f0d8a70d72abb6246e6524565da35e59a945b..c541ba02b1dec61c7d238f7b3bb97c1a5bab6f4d 100644 (file)
@@ -441,7 +441,7 @@ int PyCodec_RegisterError(const char *name, PyObject *error)
         return -1;
     }
     return PyDict_SetItemString(interp->codec_error_registry,
-                                (char *)name, error);
+                                name, error);
 }
 
 /* Lookup the error handling callback function registered under the
@@ -457,7 +457,7 @@ PyObject *PyCodec_LookupError(const char *name)
 
     if (name==NULL)
         name = "strict";
-    handler = PyDict_GetItemString(interp->codec_error_registry, (char *)name);
+    handler = PyDict_GetItemString(interp->codec_error_registry, name);
     if (!handler)
         PyErr_Format(PyExc_LookupError, "unknown error handler name '%.400s'", name);
     else
index 1a162ee711c9659dc2f3ef658799a503c91d7175..c96106f373265b44282c06e0dbc45ed3a6bd2e5b 100644 (file)
@@ -517,7 +517,7 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name,
 }
 
 int
-_PyImport_FixupBuiltin(PyObject *mod, char *name)
+_PyImport_FixupBuiltin(PyObject *mod, const char *name)
 {
     int res;
     PyObject *nameobj;
@@ -656,22 +656,23 @@ remove_module(PyObject *name)
  * interface.  The other two exist primarily for backward compatibility.
  */
 PyObject *
-PyImport_ExecCodeModule(char *name, PyObject *co)
+PyImport_ExecCodeModule(const char *name, PyObject *co)
 {
     return PyImport_ExecCodeModuleWithPathnames(
         name, co, (char *)NULL, (char *)NULL);
 }
 
 PyObject *
-PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname)
+PyImport_ExecCodeModuleEx(const char *name, PyObject *co, const char *pathname)
 {
     return PyImport_ExecCodeModuleWithPathnames(
         name, co, pathname, (char *)NULL);
 }
 
 PyObject *
-PyImport_ExecCodeModuleWithPathnames(char *name, PyObject *co, char *pathname,
-                                     char *cpathname)
+PyImport_ExecCodeModuleWithPathnames(const char *name, PyObject *co,
+                                     const char *pathname,
+                                     const char *cpathname)
 {
     PyObject *m = NULL;
     PyObject *nameobj, *pathobj = NULL, *cpathobj = NULL;
@@ -1019,7 +1020,7 @@ get_frozen_object(PyObject *name)
     size = p->size;
     if (size < 0)
         size = -size;
-    return PyMarshal_ReadObjectFromString((char *)p->code, size);
+    return PyMarshal_ReadObjectFromString((const char *)p->code, size);
 }
 
 static PyObject *
@@ -1071,7 +1072,7 @@ PyImport_ImportFrozenModuleObject(PyObject *name)
     ispackage = (size < 0);
     if (ispackage)
         size = -size;
-    co = PyMarshal_ReadObjectFromString((char *)p->code, size);
+    co = PyMarshal_ReadObjectFromString((const char *)p->code, size);
     if (co == NULL)
         return -1;
     if (!PyCode_Check(co)) {
@@ -1113,7 +1114,7 @@ err_return:
 }
 
 int
-PyImport_ImportFrozenModule(char *name)
+PyImport_ImportFrozenModule(const char *name)
 {
     PyObject *nameobj;
     int ret;
index f94276ad3252da909b14e677053d1b7da48aa54a..4401afb2116ada3e62078130aa6c8201be427939 100644 (file)
@@ -1466,15 +1466,15 @@ PyMarshal_ReadObjectFromFile(FILE *fp)
 }
 
 PyObject *
-PyMarshal_ReadObjectFromString(char *str, Py_ssize_t len)
+PyMarshal_ReadObjectFromString(const char *str, Py_ssize_t len)
 {
     RFILE rf;
     PyObject *result;
     rf.fp = NULL;
     rf.readable = NULL;
     rf.current_filename = NULL;
-    rf.ptr = str;
-    rf.end = str + len;
+    rf.ptr = (char *)str;
+    rf.end = (char *)str + len;
     rf.buf = NULL;
     rf.depth = 0;
     rf.refs = PyList_New(0);
index 725f07c9fef7a45d6bb85c8eb07fce84fcb0deb2..98429d4b428dc6d93af6ad3dd46ed7a2140deecc 100644 (file)
@@ -92,7 +92,7 @@ static int digitlimit[] = {
 **              exceptions - we don't check for them.
 */
 unsigned long
-PyOS_strtoul(char *str, char **ptr, int base)
+PyOS_strtoul(const char *str, char **ptr, int base)
 {
     unsigned long result = 0; /* return value of the function */
     int c;             /* current input character */
@@ -111,7 +111,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
                 /* there must be at least one digit after 0x */
                 if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 16) {
                     if (ptr)
-                        *ptr = str;
+                        *ptr = (char *)str;
                     return 0;
                 }
                 ++str;
@@ -120,7 +120,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
                 /* there must be at least one digit after 0o */
                 if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 8) {
                     if (ptr)
-                        *ptr = str;
+                        *ptr = (char *)str;
                     return 0;
                 }
                 ++str;
@@ -129,7 +129,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
                 /* there must be at least one digit after 0b */
                 if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 2) {
                     if (ptr)
-                        *ptr = str;
+                        *ptr = (char *)str;
                     return 0;
                 }
                 ++str;
@@ -141,7 +141,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
                 while (Py_ISSPACE(Py_CHARMASK(*str)))
                     ++str;
                 if (ptr)
-                    *ptr = str;
+                    *ptr = (char *)str;
                 return 0;
             }
         }
@@ -157,7 +157,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
                 /* there must be at least one digit after 0x */
                 if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 16) {
                     if (ptr)
-                        *ptr = str;
+                        *ptr = (char *)str;
                     return 0;
                 }
                 ++str;
@@ -171,7 +171,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
                 /* there must be at least one digit after 0o */
                 if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 8) {
                     if (ptr)
-                        *ptr = str;
+                        *ptr = (char *)str;
                     return 0;
                 }
                 ++str;
@@ -185,7 +185,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
                 /* there must be at least one digit after 0b */
                 if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 2) {
                     if (ptr)
-                        *ptr = str;
+                        *ptr = (char *)str;
                     return 0;
                 }
                 ++str;
@@ -197,7 +197,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
     /* catch silly bases */
     if (base < 2 || base > 36) {
         if (ptr)
-            *ptr = str;
+            *ptr = (char *)str;
         return 0;
     }
 
@@ -239,7 +239,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
 
     /* set pointer to point to the last character scanned */
     if (ptr)
-        *ptr = str;
+        *ptr = (char *)str;
 
     return result;
 
@@ -248,7 +248,7 @@ overflowed:
         /* spool through remaining digit characters */
         while (_PyLong_DigitValue[Py_CHARMASK(*str)] < base)
             ++str;
-        *ptr = str;
+        *ptr = (char *)str;
     }
     errno = ERANGE;
     return (unsigned long)-1;
@@ -260,7 +260,7 @@ overflowed:
 #define PY_ABS_LONG_MIN         (0-(unsigned long)LONG_MIN)
 
 long
-PyOS_strtol(char *str, char **ptr, int base)
+PyOS_strtol(const char *str, char **ptr, int base)
 {
     long result;
     unsigned long uresult;