summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-10-19 18:03:34 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-10-19 18:03:34 (GMT)
commitc679227e31245b0e8dec74a1f7cc77710541d985 (patch)
tree0ed52ac2bd85d0cad42e39aec5437a603750425b /Python
parent80ab13067e9b8fbd02a05a4863e26b04938b77f5 (diff)
downloadcpython-c679227e31245b0e8dec74a1f7cc77710541d985.zip
cpython-c679227e31245b0e8dec74a1f7cc77710541d985.tar.gz
cpython-c679227e31245b0e8dec74a1f7cc77710541d985.tar.bz2
Issue #1772673: The type of `char*` arguments now changed to `const char*`.
Diffstat (limited to 'Python')
-rw-r--r--Python/ast.c14
-rw-r--r--Python/bltinmodule.c2
-rw-r--r--Python/codecs.c4
-rw-r--r--Python/import.c17
-rw-r--r--Python/marshal.c6
-rw-r--r--Python/mystrtoul.c24
6 files changed, 33 insertions, 34 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 9ffe3c7..3bd24fd 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -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;
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 3f270b4..4713874 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -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);
diff --git a/Python/codecs.c b/Python/codecs.c
index cb9f0d8..c541ba0 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -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
diff --git a/Python/import.c b/Python/import.c
index 1a162ee..c96106f 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -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;
diff --git a/Python/marshal.c b/Python/marshal.c
index f94276a..4401afb 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -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);
diff --git a/Python/mystrtoul.c b/Python/mystrtoul.c
index 725f07c..98429d4 100644
--- a/Python/mystrtoul.c
+++ b/Python/mystrtoul.c
@@ -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;