int(*creadline)(PyObject *, char **);
/* Write a string to an output object*/
- int(*cwrite)(PyObject *, char *, int);
+ int(*cwrite)(PyObject *, const char *, int);
/* Get the output object as a Python string (returns new reference). */
PyObject *(*cgetvalue)(PyObject *);
#define PyEval_CallObject(func,arg) \
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
-PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj, char *format, ...);
+PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj,
+ const char *format, ...);
PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj,
- char *methodname, char *format, ...);
+ const char *methodname,
+ const char *format, ...);
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
#endif
-PyAPI_FUNC(char *) PyEval_GetFuncName(PyObject *);
-PyAPI_FUNC(char *) PyEval_GetFuncDesc(PyObject *);
+PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *);
+PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *);
PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *);
PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *);
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
char *name, PyObject *co, char *pathname);
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
-PyAPI_FUNC(PyObject *) PyImport_AddModule(char *name);
-PyAPI_FUNC(PyObject *) PyImport_ImportModule(char *name);
+PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name);
+PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name);
PyAPI_FUNC(PyObject *) PyImport_ImportModuleEx(
char *name, PyObject *globals, PyObject *locals, PyObject *fromlist);
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
struct PyMethodDef {
- char *ml_name; /* The name of the built-in function/method */
+ const char *ml_name; /* The name of the built-in function/method */
PyCFunction ml_meth; /* The C function that implements it */
int ml_flags; /* Combination of METH_xxx flags, which mostly
describe the args expected by the C func */
- char *ml_doc; /* The __doc__ attribute, or NULL */
+ const char *ml_doc; /* The __doc__ attribute, or NULL */
};
typedef struct PyMethodDef PyMethodDef;
-PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, char *);
+PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *);
#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
} PyMethodChain;
PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *,
- char *);
+ const char *);
typedef struct {
PyObject_HEAD
#include <stdarg.h>
-PyAPI_FUNC(int) PyArg_Parse(PyObject *, char *, ...);
-PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, char *, ...);
+PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...);
+PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...);
PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
- char *, char **, ...);
-PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, char *, int, int, ...);
-PyAPI_FUNC(PyObject *) Py_BuildValue(char *, ...);
-PyAPI_FUNC(int) _PyArg_NoKeywords(char *funcname, PyObject *kw);
+ const char *, const char **, ...);
+PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, int, int, ...);
+PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
+PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw);
-PyAPI_FUNC(int) PyArg_VaParse(PyObject *, char *, va_list);
+PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list);
PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
- char *, char **, va_list);
-PyAPI_FUNC(PyObject *) Py_VaBuildValue(char *, va_list);
+ const char *, const char **, va_list);
+PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
-PyAPI_FUNC(int) PyModule_AddObject(PyObject *, char *, PyObject *);
-PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, char *, long);
-PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, char *, char *);
+PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *);
+PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
+PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
#define PYTHON_API_VERSION 1012
#define PYTHON_API_STRING "1012"
#define Py_InitModule4 Py_InitModule4TraceRefs
#endif
-PyAPI_FUNC(PyObject *) Py_InitModule4(char *name, PyMethodDef *methods,
- char *doc, PyObject *self,
- int apiver);
+PyAPI_FUNC(PyObject *) Py_InitModule4(const char *name, PyMethodDef *methods,
+ const char *doc, PyObject *self,
+ int apiver);
#define Py_InitModule(name, methods) \
Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
#define PyModule_CheckExact(op) ((op)->ob_type == &PyModule_Type)
-PyAPI_FUNC(PyObject *) PyModule_New(char *);
+PyAPI_FUNC(PyObject *) PyModule_New(const char *);
PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
PyAPI_FUNC(char *) PyModule_GetName(PyObject *);
PyAPI_FUNC(char *) PyModule_GetFilename(PyObject *);
typedef void (*freefunc)(void *);
typedef void (*destructor)(PyObject *);
typedef int (*printfunc)(PyObject *, FILE *, int);
-typedef PyObject *(*getattrfunc)(PyObject *, char *);
+typedef PyObject *(*getattrfunc)(PyObject *, const char *);
typedef PyObject *(*getattrofunc)(PyObject *, PyObject *);
-typedef int (*setattrfunc)(PyObject *, char *, PyObject *);
+typedef int (*setattrfunc)(PyObject *, const char *, PyObject *);
typedef int (*setattrofunc)(PyObject *, PyObject *, PyObject *);
typedef int (*cmpfunc)(PyObject *, PyObject *);
typedef PyObject *(*reprfunc)(PyObject *);
typedef struct _typeobject {
PyObject_VAR_HEAD
- char *tp_name; /* For printing, in format "<module>.<name>" */
+ const char *tp_name; /* For printing, in format "<module>.<name>" */
int tp_basicsize, tp_itemsize; /* For allocation */
/* Methods to implement standard operations */
/* Flags to define presence of optional/expanded features */
long tp_flags;
- char *tp_doc; /* Documentation string */
+ const char *tp_doc; /* Documentation string */
/* Assigned meaning in release 2.0 */
/* call function for all accessible objects */
PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int);
PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int);
-PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, char *);
-PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, char *, PyObject *);
-PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, char *);
+PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *);
+PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *);
+PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *);
PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *);
PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *);
int lo = 0;
int hi = -1;
int index;
- static char *keywords[] = {"a", "x", "lo", "hi", NULL};
+ static const char *keywords[] = {"a", "x", "lo", "hi", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|ii:bisect_right",
keywords, &list, &item, &lo, &hi))
int lo = 0;
int hi = -1;
int index;
- static char *keywords[] = {"a", "x", "lo", "hi", NULL};
+ static const char *keywords[] = {"a", "x", "lo", "hi", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|ii:insort_right",
keywords, &list, &item, &lo, &hi))
int lo = 0;
int hi = -1;
int index;
- static char *keywords[] = {"a", "x", "lo", "hi", NULL};
+ static const char *keywords[] = {"a", "x", "lo", "hi", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|ii:bisect_left",
keywords, &list, &item, &lo, &hi))
int lo = 0;
int hi = -1;
int index;
- static char *keywords[] = {"a", "x", "lo", "hi", NULL};
+ static const char *keywords[] = {"a", "x", "lo", "hi", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|ii:insort_left",
keywords, &list, &item, &lo, &hi))
m = Py_InitModule3("_bisect", bisect_methods, module_doc);
}
-
int dlen = -1;
int doff = -1;
int flags = 0;
- char* kwnames[] = { "flags", "dlen", "doff", NULL };
+ static const char* kwnames[] = { "flags", "dlen", "doff", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, format, kwnames,
&flags, &dlen, &doff))
#if (DBVER >= 41)
PyObject *txnobj = NULL;
DB_TXN *txn = NULL;
- char* kwnames[] = {"secondaryDB", "callback", "flags", "txn", NULL};
+ static const char* kwnames[] = {"secondaryDB", "callback", "flags", "txn",
+ NULL};
#else
- char* kwnames[] = {"secondaryDB", "callback", "flags", NULL};
+ static const char* kwnames[] = {"secondaryDB", "callback", "flags", NULL};
#endif
#if (DBVER >= 41)
PyObject* retval = NULL;
DBT key, data;
DB_TXN *txn = NULL;
- char* kwnames[] = { "txn", "flags", NULL };
+ static const char* kwnames[] = { "txn", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:consume", kwnames,
&txnobj, &flags))
DBC* dbc;
PyObject* txnobj = NULL;
DB_TXN *txn = NULL;
- char* kwnames[] = { "txn", "flags", NULL };
+ static const char* kwnames[] = { "txn", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:cursor", kwnames,
&txnobj, &flags))
PyObject* keyobj;
DBT key;
DB_TXN *txn = NULL;
- char* kwnames[] = { "key", "txn", "flags", NULL };
+ static const char* kwnames[] = { "key", "txn", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|Oi:delete", kwnames,
&keyobj, &txnobj, &flags))
int doff = -1;
DBT key, data;
DB_TXN *txn = NULL;
- char* kwnames[] = {"key", "default", "txn", "flags", "dlen", "doff", NULL};
+ static const char* kwnames[] = {"key", "default", "txn", "flags", "dlen",
+ "doff", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OOiii:get", kwnames,
&keyobj, &dfltobj, &txnobj, &flags, &dlen,
int doff = -1;
DBT key, pkey, data;
DB_TXN *txn = NULL;
- char* kwnames[] = {"key", "default", "txn", "flags", "dlen", "doff", NULL};
+ static const char* kwnames[] = {"key", "default", "txn", "flags", "dlen",
+ "doff", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OOiii:pget", kwnames,
&keyobj, &dfltobj, &txnobj, &flags, &dlen,
PyObject* retval = NULL;
DBT key, data;
DB_TXN *txn = NULL;
- char* kwnames[] = { "key", "txn", NULL };
+ static const char* kwnames[] = { "key", "txn", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:get_size", kwnames,
&keyobj, &txnobj))
PyObject* retval = NULL;
DBT key, data;
DB_TXN *txn = NULL;
- char* kwnames[] = { "key", "data", "txn", "flags", NULL };
+ static const char* kwnames[] = { "key", "data", "txn", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|Oi:get_both", kwnames,
DBT key;
DB_TXN *txn = NULL;
DB_KEY_RANGE range;
- char* kwnames[] = { "key", "txn", "flags", NULL };
+ static const char* kwnames[] = { "key", "txn", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|Oi:key_range", kwnames,
&keyobj, &txnobj, &flags))
PyObject *txnobj = NULL;
DB_TXN *txn = NULL;
/* with dbname */
- char* kwnames[] = {
+ static const char* kwnames[] = {
"filename", "dbname", "dbtype", "flags", "mode", "txn", NULL};
/* without dbname */
- char* kwnames_basic[] = {
+ static const char* kwnames_basic[] = {
"filename", "dbtype", "flags", "mode", "txn", NULL};
#else
/* with dbname */
- char* kwnames[] = {
+ static const char* kwnames[] = {
"filename", "dbname", "dbtype", "flags", "mode", NULL};
/* without dbname */
- char* kwnames_basic[] = {
+ static const char* kwnames_basic[] = {
"filename", "dbtype", "flags", "mode", NULL};
#endif
PyObject* keyobj, *dataobj, *retval;
DBT key, data;
DB_TXN *txn = NULL;
- char* kwnames[] = { "key", "data", "txn", "flags", "dlen", "doff", NULL };
+ static const char* kwnames[] = { "key", "data", "txn", "flags", "dlen",
+ "doff", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|Oiii:put", kwnames,
&keyobj, &dataobj, &txnobj, &flags, &dlen, &doff))
char* filename;
char* database = NULL;
int err, flags=0;
- char* kwnames[] = { "filename", "dbname", "flags", NULL};
+ static const char* kwnames[] = { "filename", "dbname", "flags", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zi:remove", kwnames,
&filename, &database, &flags))
#if (DBVER >= 43)
PyObject* txnobj = NULL;
DB_TXN *txn = NULL;
- char* kwnames[] = { "txn", "flags", NULL };
+ static const char* kwnames[] = { "txn", "flags", NULL };
#else
- char* kwnames[] = { "flags", NULL };
+ static const char* kwnames[] = { "flags", NULL };
#endif
#if (DBVER >= 43)
u_int32_t count=0;
PyObject* txnobj = NULL;
DB_TXN *txn = NULL;
- char* kwnames[] = { "txn", "flags", NULL };
+ static const char* kwnames[] = { "txn", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:cursor", kwnames,
&txnobj, &flags))
char* dbName=NULL;
char* outFileName=NULL;
FILE* outFile=NULL;
- char* kwnames[] = { "filename", "dbname", "outfile", "flags", NULL };
+ static const char* kwnames[] = { "filename", "dbname", "outfile", "flags",
+ NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zzi:verify", kwnames,
&fileName, &dbName, &outFileName, &flags))
int err;
u_int32_t flags=0;
char *passwd = NULL;
- char* kwnames[] = { "passwd", "flags", NULL };
+ static const char* kwnames[] = { "passwd", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|i:set_encrypt", kwnames,
&passwd, &flags)) {
int dlen = -1;
int doff = -1;
DBT key, data;
- char* kwnames[] = { "key","data", "flags", "dlen", "doff", NULL };
+ static const char* kwnames[] = { "key","data", "flags", "dlen", "doff",
+ NULL };
CLEAR_DBT(key);
CLEAR_DBT(data);
int dlen = -1;
int doff = -1;
DBT key, pkey, data;
- char* kwnames[] = { "key","data", "flags", "dlen", "doff", NULL };
+ static const char* kwnames[] = { "key","data", "flags", "dlen", "doff",
+ NULL };
CLEAR_DBT(key);
CLEAR_DBT(data);
int err, flags = 0;
PyObject* keyobj, *dataobj;
DBT key, data;
- char* kwnames[] = { "key", "data", "flags", "dlen", "doff", NULL };
+ static const char* kwnames[] = { "key", "data", "flags", "dlen", "doff",
+ NULL };
int dlen = -1;
int doff = -1;
int err, flags = 0;
DBT key, data;
PyObject* retval, *keyobj;
- char* kwnames[] = { "key", "flags", "dlen", "doff", NULL };
+ static const char* kwnames[] = { "key", "flags", "dlen", "doff", NULL };
int dlen = -1;
int doff = -1;
int err, flags = 0;
DBT key, data;
PyObject* retval, *keyobj;
- char* kwnames[] = { "key", "flags", "dlen", "doff", NULL };
+ static const char* kwnames[] = { "key", "flags", "dlen", "doff", NULL };
int dlen = -1;
int doff = -1;
PyObject* retval;
int dlen = -1;
int doff = -1;
- char* kwnames[] = { "recno","flags", "dlen", "doff", NULL };
+ static const char* kwnames[] = { "recno","flags", "dlen", "doff", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|iii:set_recno", kwnames,
&irecno, &flags, &dlen, &doff))
char *database = NULL;
PyObject *txnobj = NULL;
DB_TXN *txn = NULL;
- char* kwnames[] = { "file", "database", "txn", "flags", NULL };
+ static const char* kwnames[] = { "file", "database", "txn", "flags",
+ NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ss|Oi:dbremove", kwnames,
&file, &database, &txnobj, &flags)) {
char *newname = NULL;
PyObject *txnobj = NULL;
DB_TXN *txn = NULL;
- char* kwnames[] = { "file", "database", "newname", "txn", "flags", NULL };
+ static const char* kwnames[] = { "file", "database", "newname", "txn",
+ "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sss|Oi:dbrename", kwnames,
&file, &database, &newname, &txnobj, &flags)) {
int err;
u_int32_t flags=0;
char *passwd = NULL;
- char* kwnames[] = { "passwd", "flags", NULL };
+ static const char* kwnames[] = { "passwd", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|i:set_encrypt", kwnames,
&passwd, &flags)) {
int err;
u_int32_t flags=0;
u_int32_t timeout = 0;
- char* kwnames[] = { "timeout", "flags", NULL };
+ static const char* kwnames[] = { "timeout", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:set_timeout", kwnames,
&timeout, &flags)) {
int flags = 0;
PyObject* txnobj = NULL;
DB_TXN *txn = NULL;
- char* kwnames[] = { "parent", "flags", NULL };
+ static const char* kwnames[] = { "parent", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:txn_begin", kwnames,
&txnobj, &flags))
{
PyObject* dbenvobj = NULL;
int flags = 0;
- char* kwnames[] = { "dbEnv", "flags", NULL};
+ static const char* kwnames[] = { "dbEnv", "flags", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:DB", kwnames,
&dbenvobj, &flags))
self->ob_type->tp_free((PyObject *)self);
}
-static char *dialect_kws[] = {
+static const char *dialect_kws[] = {
"dialect",
"delimiter",
"doublequote",
int err;
char* termstr = NULL;
- static char *kwlist[] = {"term", "fd", NULL};
+ static const char *kwlist[] = {"term", "fd", NULL};
if (!PyArg_ParseTupleAndKeywords(
- args,keywds,"|zi:setupterm",kwlist,&termstr,&fd)) {
+ args, keywds, "|zi:setupterm", kwlist, &termstr, &fd)) {
return NULL;
}
static int
EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds)
{
- static char *kwlist[] = {"name", "string", NULL};
+ static const char *kwlist[] = {"name", "string", NULL};
PyObject *name_obj = NULL;
char *nameStr;
unsigned char *cp = NULL;
static PyObject *
EVP_new(PyObject *self, PyObject *args, PyObject *kwdict)
{
- static char *kwlist[] = {"name", "string", NULL};
+ static const char *kwlist[] = {"name", "string", NULL};
PyObject *name_obj = NULL;
char *name;
const EVP_MD *digest;
PyObject* string;
int start = 0;
int end = INT_MAX;
- static char* kwlist[] = { "pattern", "pos", "endpos", NULL };
+ static const char* kwlist[] = { "pattern", "pos", "endpos", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:match", kwlist,
&string, &start, &end))
return NULL;
PyObject* string;
int start = 0;
int end = INT_MAX;
- static char* kwlist[] = { "pattern", "pos", "endpos", NULL };
+ static const char* kwlist[] = { "pattern", "pos", "endpos", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:search", kwlist,
&string, &start, &end))
return NULL;
PyObject* string;
int start = 0;
int end = INT_MAX;
- static char* kwlist[] = { "source", "pos", "endpos", NULL };
+ static const char* kwlist[] = { "source", "pos", "endpos", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:findall", kwlist,
&string, &start, &end))
return NULL;
PyObject* string;
int maxsplit = 0;
- static char* kwlist[] = { "source", "maxsplit", NULL };
+ static const char* kwlist[] = { "source", "maxsplit", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|i:split", kwlist,
&string, &maxsplit))
return NULL;
PyObject* template;
PyObject* string;
int count = 0;
- static char* kwlist[] = { "repl", "string", "count", NULL };
+ static const char* kwlist[] = { "repl", "string", "count", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|i:sub", kwlist,
&template, &string, &count))
return NULL;
PyObject* template;
PyObject* string;
int count = 0;
- static char* kwlist[] = { "repl", "string", "count", NULL };
+ static const char* kwlist[] = { "repl", "string", "count", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|i:subn", kwlist,
&template, &string, &count))
return NULL;
int index;
PyObject* def = Py_None;
- static char* kwlist[] = { "default", NULL };
+ static const char* kwlist[] = { "default", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:groups", kwlist, &def))
return NULL;
int index;
PyObject* def = Py_None;
- static char* kwlist[] = { "default", NULL };
+ static const char* kwlist[] = { "default", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:groupdict", kwlist, &def))
return NULL;
}
static PyObject *
-Tktt_GetAttr(PyObject *self, char *name)
+Tktt_GetAttr(PyObject *self, const char *name)
{
return Py_FindMethod(Tktt_methods, self, name);
}
}
static PyObject *
-Tkapp_GetAttr(PyObject *self, char *name)
+Tkapp_GetAttr(PyObject *self, const char *name)
{
return Py_FindMethod(Tkapp_methods, self, name);
}
unsigned char *data, *odata;
unsigned int datalen = 0;
PyObject *rv;
- static char *kwlist[] = {"data", "header", NULL};
+ static const char *kwlist[] = {"data", "header", NULL};
int header = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|i", kwlist, &data,
unsigned int datalen = 0, odatalen = 0;
PyObject *rv;
unsigned int linelen = 0;
- static char *kwlist[] = {"data", "quotetabs", "istext", "header", NULL};
+ static const char *kwlist[] = {"data", "quotetabs", "istext",
+ "header", NULL};
int istext = 1;
int quotetabs = 0;
int header = 0;
static int
BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
{
- static char *kwlist[] = {"filename", "mode", "buffering",
- "compresslevel", 0};
+ static const char *kwlist[] = {"filename", "mode", "buffering",
+ "compresslevel", 0};
PyObject *name;
char *mode = "r";
int buffering = -1;
{
int compresslevel = 9;
int bzerror;
- static char *kwlist[] = {"compresslevel", 0};
+ static const char *kwlist[] = {"compresslevel", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:BZ2Compressor",
kwlist, &compresslevel))
bz_stream _bzs;
bz_stream *bzs = &_bzs;
int bzerror;
- static char *kwlist[] = {"data", "compresslevel", 0};
+ static const char *kwlist[] = {"data", "compresslevel", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|i",
kwlist, &data, &datasize,
int fast; /* Fast mode doesn't save in memo, don't use if circ ref */
int nesting;
- int (*write_func)(struct Picklerobject *, char *, int);
+ int (*write_func)(struct Picklerobject *, const char *, int);
char *write_buf;
int buf_size;
PyObject *dispatch_table;
}
static int
-write_file(Picklerobject *self, char *s, int n)
+write_file(Picklerobject *self, const char *s, int n)
{
size_t nbyteswritten;
}
static int
-write_cStringIO(Picklerobject *self, char *s, int n)
+write_cStringIO(Picklerobject *self, const char *s, int n)
{
if (s == NULL) {
return 0;
}
static int
-write_none(Picklerobject *self, char *s, int n)
+write_none(Picklerobject *self, const char *s, int n)
{
if (s == NULL) return 0;
return n;
}
static int
-write_other(Picklerobject *self, char *s, int n)
+write_other(Picklerobject *self, const char *s, int n)
{
PyObject *py_str = 0, *junk = 0;
* The caller is responsible for free()'ing the return value.
*/
static char *
-pystrndup(char *s, int n)
+pystrndup(const char *s, int n)
{
char *r = (char *)malloc(n+1);
if (r == NULL)
static int
save_bool(Picklerobject *self, PyObject *args)
{
- static char *buf[2] = {FALSE, TRUE};
+ static const char *buf[2] = {FALSE, TRUE};
static char len[2] = {sizeof(FALSE)-1, sizeof(TRUE)-1};
long l = PyInt_AS_LONG((PyIntObject *)args);
static PyObject *
get_Pickler(PyObject *self, PyObject *args, PyObject *kwds)
{
- static char *kwlist[] = {"file", "protocol", NULL};
+ static const char *kwlist[] = {"file", "protocol", NULL};
PyObject *file = NULL;
int proto = 0;
static PyObject *
cpm_dump(PyObject *self, PyObject *args, PyObject *kwds)
{
- static char *kwlist[] = {"obj", "file", "protocol", NULL};
+ static const char *kwlist[] = {"obj", "file", "protocol", NULL};
PyObject *ob, *file, *res = NULL;
Picklerobject *pickler = 0;
int proto = 0;
static PyObject *
cpm_dumps(PyObject *self, PyObject *args, PyObject *kwds)
{
- static char *kwlist[] = {"obj", "protocol", NULL};
+ static const char *kwlist[] = {"obj", "protocol", NULL};
PyObject *ob, *file = 0, *res = NULL;
Picklerobject *pickler = 0;
int proto = 0;
static int
-O_cwrite(PyObject *self, char *c, int l) {
+O_cwrite(PyObject *self, const char *c, int l) {
int newl;
Oobject *oself;
PyDoc_STRVAR(MultibyteCodec_StreamWriter__doc__,
"I.StreamWriter(stream[, errors]) -> StreamWriter instance");
-static char *codeckwarglist[] = {"input", "errors", NULL};
-static char *streamkwarglist[] = {"stream", "errors", NULL};
+static const char *codeckwarglist[] = {"input", "errors", NULL};
+static const char *streamkwarglist[] = {"stream", "errors", NULL};
static PyObject *multibytecodec_encode(MultibyteCodec *,
MultibyteCodec_State *, const Py_UNICODE **, size_t,
static PyObject *
format_ctime(PyDateTime_Date *date, int hours, int minutes, int seconds)
{
- static char *DayNames[] = {
+ static const char *DayNames[] = {
"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"
};
- static char *MonthNames[] = {
+ static const char *MonthNames[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
PyObject *y = NULL; /* temp sum of microseconds */
double leftover_us = 0.0;
- static char *keywords[] = {
+ static const char *keywords[] = {
"days", "seconds", "microseconds", "milliseconds",
"minutes", "hours", "weeks", NULL
};
/* Constructors. */
-static char *date_kws[] = {"year", "month", "day", NULL};
+static const char *date_kws[] = {"year", "month", "day", NULL};
static PyObject *
date_new(PyTypeObject *type, PyObject *args, PyObject *kw)
date_repr(PyDateTime_Date *self)
{
char buffer[1028];
- char *typename;
+ const char *typename;
typename = self->ob_type->tp_name;
PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d)",
PyObject *result;
PyObject *format;
PyObject *tuple;
- static char *keywords[] = {"format", NULL};
+ static const char *keywords[] = {"format", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords,
&PyString_Type, &format))
* Constructors.
*/
-static char *time_kws[] = {"hour", "minute", "second", "microsecond",
+static const char *time_kws[] = {"hour", "minute", "second", "microsecond",
"tzinfo", NULL};
static PyObject *
time_repr(PyDateTime_Time *self)
{
char buffer[100];
- char *typename = self->ob_type->tp_name;
+ const char *typename = self->ob_type->tp_name;
int h = TIME_GET_HOUR(self);
int m = TIME_GET_MINUTE(self);
int s = TIME_GET_SECOND(self);
PyObject *result;
PyObject *format;
PyObject *tuple;
- static char *keywords[] = {"format", NULL};
+ static const char *keywords[] = {"format", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords,
&PyString_Type, &format))
* Constructors.
*/
-static char *datetime_kws[] = {
+static const char *datetime_kws[] = {
"year", "month", "day", "hour", "minute", "second",
"microsecond", "tzinfo", NULL
};
{
PyObject *self;
PyObject *tzinfo = Py_None;
- static char *keywords[] = {"tz", NULL};
+ static const char *keywords[] = {"tz", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "|O:now", keywords,
&tzinfo))
PyObject *self;
double timestamp;
PyObject *tzinfo = Py_None;
- static char *keywords[] = {"timestamp", "tz", NULL};
+ static const char *keywords[] = {"timestamp", "tz", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "d|O:fromtimestamp",
keywords, ×tamp, &tzinfo))
static PyObject *
datetime_combine(PyObject *cls, PyObject *args, PyObject *kw)
{
- static char *keywords[] = {"date", "time", NULL};
+ static const char *keywords[] = {"date", "time", NULL};
PyObject *date;
PyObject *time;
PyObject *result = NULL;
datetime_repr(PyDateTime_DateTime *self)
{
char buffer[1000];
- char *typename = self->ob_type->tp_name;
+ const char *typename = self->ob_type->tp_name;
PyObject *baserepr;
if (DATE_GET_MICROSECOND(self)) {
datetime_isoformat(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
{
char sep = 'T';
- static char *keywords[] = {"sep", NULL};
+ static const char *keywords[] = {"sep", NULL};
char buffer[100];
char *cp;
PyObject *result;
int offset, none;
PyObject *tzinfo;
- static char *keywords[] = {"tz", NULL};
+ static const char *keywords[] = {"tz", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:astimezone", keywords,
&PyDateTime_TZInfoType, &tzinfo))
static PyObject *
groupby_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
- static char *kwargs[] = {"iterable", "key", NULL};
+ static const char *kwargs[] = {"iterable", "key", NULL};
groupbyobject *gbo;
PyObject *it, *keyfunc = Py_None;
int map_size;
int fd, flags = MAP_SHARED, prot = PROT_WRITE | PROT_READ;
access_mode access = ACCESS_DEFAULT;
- char *keywords[] = {"fileno", "length",
- "flags", "prot",
- "access", NULL};
+ static const char *keywords[] = {"fileno", "length",
+ "flags", "prot",
+ "access", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwdict, "iO|iii", keywords,
- &fd, &map_size_obj, &flags, &prot, &access))
+ &fd, &map_size_obj, &flags, &prot,
+ &access))
return NULL;
map_size = _GetMapSize(map_size_obj);
if (map_size < 0)
HANDLE fh = 0;
access_mode access = ACCESS_DEFAULT;
DWORD flProtect, dwDesiredAccess;
- char *keywords[] = { "fileno", "length",
- "tagname",
- "access", NULL };
+ static const char *keywords[] = { "fileno", "length",
+ "tagname",
+ "access", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwdict, "iO|zi", keywords,
&fileno, &map_size_obj,
static void parser_free(PyST_Object *st);
static int parser_compare(PyST_Object *left, PyST_Object *right);
-static PyObject *parser_getattr(PyObject *self, char *name);
+static PyObject *parser_getattr(PyObject *self, const char *name);
static
PyObject *res = 0;
int ok;
- static char *keywords[] = {"ast", "line_info", NULL};
+ static const char *keywords[] = {"ast", "line_info", NULL};
if (self == NULL) {
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|O:st2tuple", keywords,
PyObject *res = 0;
int ok;
- static char *keywords[] = {"ast", "line_info", NULL};
+ static const char *keywords[] = {"ast", "line_info", NULL};
if (self == NULL)
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|O:st2list", keywords,
char* str = "<syntax-tree>";
int ok;
- static char *keywords[] = {"ast", "filename", NULL};
+ static const char *keywords[] = {"ast", "filename", NULL};
if (self == NULL)
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|s:compilest", keywords,
PyObject* res = 0;
int ok;
- static char *keywords[] = {"ast", NULL};
+ static const char *keywords[] = {"ast", NULL};
if (self == NULL)
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!:isexpr", keywords,
PyObject* res = 0;
int ok;
- static char *keywords[] = {"ast", NULL};
+ static const char *keywords[] = {"ast", NULL};
if (self == NULL)
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!:issuite", keywords,
static PyObject*
-parser_getattr(PyObject *self, char *name)
+parser_getattr(PyObject *self, const char *name)
{
return (Py_FindMethod(parser_methods, self, name));
}
char* string = 0;
PyObject* res = 0;
- static char *keywords[] = {"source", NULL};
+ static const char *keywords[] = {"source", NULL};
if (PyArg_ParseTupleAndKeywords(args, kw, argspec, keywords, &string)) {
node* n = PyParser_SimpleParseString(string,
PyObject *tuple;
node *tree;
- static char *keywords[] = {"sequence", NULL};
+ static const char *keywords[] = {"sequence", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "O:sequence2st", keywords,
&tuple))
PyObject *intern = NULL;
PyObject *result;
int intern_decref = 0;
- static char *kwlist[] = {"encoding", "namespace_separator",
- "intern", NULL};
+ static const char *kwlist[] = {"encoding", "namespace_separator",
+ "intern", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "|zzO:ParserCreate", kwlist,
&encoding, &namespace_separator, &intern))
static PyObject *
SHA256_new(PyObject *self, PyObject *args, PyObject *kwdict)
{
- static char *kwlist[] = {"string", NULL};
+ static const char *kwlist[] = {"string", NULL};
SHAobject *new;
unsigned char *cp = NULL;
int len;
static PyObject *
SHA224_new(PyObject *self, PyObject *args, PyObject *kwdict)
{
- static char *kwlist[] = {"string", NULL};
+ static const char *kwlist[] = {"string", NULL};
SHAobject *new;
unsigned char *cp = NULL;
int len;
static PyObject *
SHA512_new(PyObject *self, PyObject *args, PyObject *kwdict)
{
- static char *kwlist[] = {"string", NULL};
+ static const char *kwlist[] = {"string", NULL};
SHAobject *new;
unsigned char *cp = NULL;
int len;
static PyObject *
SHA384_new(PyObject *self, PyObject *args, PyObject *kwdict)
{
- static char *kwlist[] = {"string", NULL};
+ static const char *kwlist[] = {"string", NULL};
SHAobject *new;
unsigned char *cp = NULL;
int len;
PySocketSockObject *s = (PySocketSockObject *)self;
SOCKET_T fd;
int family = AF_INET, type = SOCK_STREAM, proto = 0;
- static char *keywords[] = {"family", "type", "proto", 0};
+ static const char *keywords[] = {"family", "type", "proto", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|iii:socket", keywords,
static PyObject *
bool_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
- static char *kwlist[] = {"x", 0};
+ static const char *kwlist[] = {"x", 0};
PyObject *x = Py_False;
long ok;
class_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *name, *bases, *dict;
- static char *kwlist[] = {"name", "bases", "dict", 0};
+ static const char *kwlist[] = {"name", "bases", "dict", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "SOO", kwlist,
&name, &bases, &dict))
Py_complex cr, ci;
int own_r = 0;
static PyObject *complexstr;
- static char *kwlist[] = {"real", "imag", 0};
+ static const char *kwlist[] = {"real", "imag", 0};
r = Py_False;
i = NULL;
};
static PyDescrObject *
-descr_new(PyTypeObject *descrtype, PyTypeObject *type, char *name)
+descr_new(PyTypeObject *descrtype, PyTypeObject *type, const char *name)
{
PyDescrObject *descr;
property_init(PyObject *self, PyObject *args, PyObject *kwds)
{
PyObject *get = NULL, *set = NULL, *del = NULL, *doc = NULL;
- static char *kwlist[] = {"fget", "fset", "fdel", "doc", 0};
+ static const char *kwlist[] = {"fget", "fset", "fdel", "doc", 0};
propertyobject *gs = (propertyobject *)self;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOOO:property",
{
enumobject *en;
PyObject *seq = NULL;
- static char *kwlist[] = {"sequence", 0};
+ static const char *kwlist[] = {"sequence", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:enumerate", kwlist,
&seq))
{
PyFileObject *foself = (PyFileObject *)self;
int ret = 0;
- static char *kwlist[] = {"name", "mode", "buffering", 0};
+ static const char *kwlist[] = {"name", "mode", "buffering", 0};
char *name = NULL;
char *mode = "r";
int bufsize = -1;
return -1;
/* We parse again to get the name as a PyObject */
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|si:file", kwlist,
- &o_name, &mode, &bufsize))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|si:file",
+ kwlist, &o_name, &mode,
+ &bufsize))
return -1;
if (fill_file_fields(foself, NULL, o_name, mode,
float_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *x = Py_False; /* Integer zero */
- static char *kwlist[] = {"x", 0};
+ static const char *kwlist[] = {"x", 0};
if (type != &PyFloat_Type)
return float_subtype_new(type, args, kwds); /* Wimp out */
PyObject *closure = Py_None;
PyFunctionObject *newfunc;
int nfree, nclosure;
- static char *kwlist[] = {"code", "globals", "name",
+ static const char *kwlist[] = {"code", "globals", "name",
"argdefs", "closure", 0};
if (!PyArg_ParseTupleAndKeywords(args, kw, "O!O!|OOO:function",
{
PyObject *x = NULL;
int base = -909;
- static char *kwlist[] = {"x", "base", 0};
+ static const char *kwlist[] = {"x", "base", 0};
if (type != &PyInt_Type)
return int_subtype_new(type, args, kwds); /* Wimp out */
PyObject *keyfunc = NULL;
int i;
PyObject *key, *value, *kvpair;
- static char *kwlist[] = {"cmp", "key", "reverse", 0};
+ static const char *kwlist[] = {"cmp", "key", "reverse", 0};
assert(self != NULL);
assert (PyList_Check(self));
list_init(PyListObject *self, PyObject *args, PyObject *kw)
{
PyObject *arg = NULL;
- static char *kwlist[] = {"sequence", 0};
+ static const char *kwlist[] = {"sequence", 0};
if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:list", kwlist, &arg))
return -1;
+
/* Long (arbitrary precision) integer object implementation */
/* XXX The functional organization of this file is terrible */
{
PyObject *x = NULL;
int base = -909; /* unlikely! */
- static char *kwlist[] = {"x", "base", 0};
+ static const char *kwlist[] = {"x", "base", 0};
if (type != &PyLong_Type)
return long_subtype_new(type, args, kwds); /* Wimp out */
static PyObject *
meth_get__doc__(PyCFunctionObject *m, void *closure)
{
- char *doc = m->m_ml->ml_doc;
+ const char *doc = m->m_ml->ml_doc;
if (doc != NULL)
return PyString_FromString(doc);
/* Find a method in a method chain */
PyObject *
-Py_FindMethodInChain(PyMethodChain *chain, PyObject *self, char *name)
+Py_FindMethodInChain(PyMethodChain *chain, PyObject *self, const char *name)
{
if (name[0] == '_' && name[1] == '_') {
if (strcmp(name, "__methods__") == 0)
return listmethodchain(chain);
if (strcmp(name, "__doc__") == 0) {
- char *doc = self->ob_type->tp_doc;
+ const char *doc = self->ob_type->tp_doc;
if (doc != NULL)
return PyString_FromString(doc);
}
/* Find a method in a single method list */
PyObject *
-Py_FindMethod(PyMethodDef *methods, PyObject *self, char *name)
+Py_FindMethod(PyMethodDef *methods, PyObject *self, const char *name)
{
PyMethodChain chain;
chain.methods = methods;
};
PyObject *
-PyModule_New(char *name)
+PyModule_New(const char *name)
{
PyModuleObject *m;
PyObject *nameobj;
static int
module_init(PyModuleObject *m, PyObject *args, PyObject *kwds)
{
- static char *kwlist[] = {"name", "doc", NULL};
+ static const char *kwlist[] = {"name", "doc", NULL};
PyObject *dict, *name = Py_None, *doc = Py_None;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "S|O:module.__init__", kwlist,
- &name, &doc))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "S|O:module.__init__",
+ kwlist, &name, &doc))
return -1;
dict = m->md_dict;
if (dict == NULL) {
default_3way_compare(PyObject *v, PyObject *w)
{
int c;
- char *vname, *wname;
+ const char *vname, *wname;
if (v->ob_type == w->ob_type) {
/* When comparing these pointers, they must be cast to
}
PyObject *
-PyObject_GetAttrString(PyObject *v, char *name)
+PyObject_GetAttrString(PyObject *v, const char *name)
{
PyObject *w, *res;
}
int
-PyObject_HasAttrString(PyObject *v, char *name)
+PyObject_HasAttrString(PyObject *v, const char *name)
{
PyObject *res = PyObject_GetAttrString(v, name);
if (res != NULL) {
}
int
-PyObject_SetAttrString(PyObject *v, char *name, PyObject *w)
+PyObject_SetAttrString(PyObject *v, const char *name, PyObject *w)
{
PyObject *s;
int res;
*/
static int
-merge_list_attr(PyObject* dict, PyObject* obj, char *attrname)
+merge_list_attr(PyObject* dict, PyObject* obj, const char *attrname)
{
PyObject *list;
int result = 0;
string_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *x = NULL;
- static char *kwlist[] = {"object", 0};
+ static const char *kwlist[] = {"object", 0};
if (type != &PyString_Type)
return str_subtype_new(type, args, kwds);
PyObject *ob;
PyStructSequence *res = NULL;
int len, min_len, max_len, i, n_unnamed_fields;
- static char *kwlist[] = {"sequence", "dict", 0};
+ static const char *kwlist[] = {"sequence", "dict", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:structseq",
kwlist, &arg, &dict))
tuple_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *arg = NULL;
- static char *kwlist[] = {"sequence", 0};
+ static const char *kwlist[] = {"sequence", 0};
if (type != &PyTuple_Type)
return tuple_subtype_new(type, args, kwds);
static PyObject *
type_name(PyTypeObject *type, void *context)
{
- char *s;
+ const char *s;
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
PyHeapTypeObject* et = (PyHeapTypeObject*)type;
type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
{
PyObject *name, *bases, *dict;
- static char *kwlist[] = {"name", "bases", "dict", 0};
+ static const char *kwlist[] = {"name", "bases", "dict", 0};
PyObject *slots, *tmp, *newslots;
PyTypeObject *type, *base, *tmptype, *winner;
PyHeapTypeObject *et;
PyObject *doc = PyDict_GetItemString(dict, "__doc__");
if (doc != NULL && PyString_Check(doc)) {
const size_t n = (size_t)PyString_GET_SIZE(doc);
- type->tp_doc = (char *)PyObject_MALLOC(n+1);
- if (type->tp_doc == NULL) {
+ char *tp_doc = PyObject_MALLOC(n+1);
+ if (tp_doc == NULL) {
Py_DECREF(type);
return NULL;
}
- memcpy(type->tp_doc, PyString_AS_STRING(doc), n+1);
+ memcpy(tp_doc, PyString_AS_STRING(doc), n+1);
+ type->tp_doc = tp_doc;
}
}
Py_XDECREF(type->tp_mro);
Py_XDECREF(type->tp_cache);
Py_XDECREF(type->tp_subclasses);
- PyObject_Free(type->tp_doc);
+ /* A type's tp_doc is heap allocated, unlike the tp_doc slots
+ * of most other objects. It's okay to cast it to char *.
+ */
+ PyObject_Free((char *)type->tp_doc);
Py_XDECREF(et->name);
Py_XDECREF(et->slots);
type->ob_type->tp_free((PyObject *)type);
unicode_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *x = NULL;
- static char *kwlist[] = {"string", "encoding", "errors", 0};
+ static const char *kwlist[] = {"string", "encoding", "errors", 0};
char *encoding = NULL;
char *errors = NULL;
static PyObject *
weakref_call(PyWeakReference *self, PyObject *args, PyObject *kw)
{
- static char *argnames[] = {NULL};
+ static const char *argnames[] = {NULL};
if (PyArg_ParseTupleAndKeywords(args, kw, ":__call__", argnames)) {
PyObject *object = PyWeakref_GET_OBJECT(self);
{
PyObject *newlist, *v, *seq, *compare=NULL, *keyfunc=NULL, *newargs;
PyObject *callable;
- static char *kwlist[] = {"iterable", "cmp", "key", "reverse", 0};
+ static const char *kwlist[] = {"iterable", "cmp", "key", "reverse", 0};
long reverse;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOi:sorted",
return result;
}
-char *
+const char *
PyEval_GetFuncName(PyObject *func)
{
if (PyMethod_Check(func))
}
}
-char *
+const char *
PyEval_GetFuncDesc(PyObject *func)
{
if (PyMethod_Check(func))
#include <ctype.h>
-int PyArg_Parse(PyObject *, char *, ...);
-int PyArg_ParseTuple(PyObject *, char *, ...);
-int PyArg_VaParse(PyObject *, char *, va_list);
+int PyArg_Parse(PyObject *, const char *, ...);
+int PyArg_ParseTuple(PyObject *, const char *, ...);
+int PyArg_VaParse(PyObject *, const char *, va_list);
int PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
- char *, char **, ...);
+ const char *, const char **, ...);
int PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
- char *, char **, va_list);
+ const char *, const char **, va_list);
/* Forward */
-static int vgetargs1(PyObject *, char *, va_list *, int);
-static void seterror(int, char *, int *, char *, char *);
-static char *convertitem(PyObject *, char **, va_list *, int *, char *,
+static int vgetargs1(PyObject *, const char *, va_list *, int);
+static void seterror(int, const char *, int *, const char *, const char *);
+static char *convertitem(PyObject *, const char **, va_list *, int *, char *,
size_t, PyObject **);
-static char *converttuple(PyObject *, char **, va_list *,
+static char *converttuple(PyObject *, const char **, va_list *,
int *, char *, size_t, int, PyObject **);
-static char *convertsimple(PyObject *, char **, va_list *, char *,
+static char *convertsimple(PyObject *, const char **, va_list *, char *,
size_t, PyObject **);
static int convertbuffer(PyObject *, void **p, char **);
static int vgetargskeywords(PyObject *, PyObject *,
- char *, char **, va_list *);
-static char *skipitem(char **, va_list *);
+ const char *, const char **, va_list *);
+static char *skipitem(const char **, va_list *);
int
-PyArg_Parse(PyObject *args, char *format, ...)
+PyArg_Parse(PyObject *args, const char *format, ...)
{
int retval;
va_list va;
int
-PyArg_ParseTuple(PyObject *args, char *format, ...)
+PyArg_ParseTuple(PyObject *args, const char *format, ...)
{
int retval;
va_list va;
int
-PyArg_VaParse(PyObject *args, char *format, va_list va)
+PyArg_VaParse(PyObject *args, const char *format, va_list va)
{
va_list lva;
static int
-vgetargs1(PyObject *args, char *format, va_list *p_va, int compat)
+vgetargs1(PyObject *args, const char *format, va_list *p_va, int compat)
{
char msgbuf[256];
int levels[32];
- char *fname = NULL;
- char *message = NULL;
+ const char *fname = NULL;
+ const char *message = NULL;
int min = -1;
int max = 0;
int level = 0;
int endfmt = 0;
- char *formatsave = format;
+ const char *formatsave = format;
int i, len;
char *msg;
PyObject *freelist = NULL;
static void
-seterror(int iarg, char *msg, int *levels, char *fname, char *message)
+seterror(int iarg, const char *msg, int *levels, const char *fname,
+ const char *message)
{
char buf[512];
int i;
*/
static char *
-converttuple(PyObject *arg, char **p_format, va_list *p_va, int *levels,
+converttuple(PyObject *arg, const char **p_format, va_list *p_va, int *levels,
char *msgbuf, size_t bufsize, int toplevel, PyObject **freelist)
{
int level = 0;
int n = 0;
- char *format = *p_format;
+ const char *format = *p_format;
int i;
for (;;) {
/* Convert a single item. */
static char *
-convertitem(PyObject *arg, char **p_format, va_list *p_va, int *levels,
+convertitem(PyObject *arg, const char **p_format, va_list *p_va, int *levels,
char *msgbuf, size_t bufsize, PyObject **freelist)
{
char *msg;
- char *format = *p_format;
+ const char *format = *p_format;
if (*format == '(' /* ')' */) {
format++;
/* Format an error message generated by convertsimple(). */
static char *
-converterr(char *expected, PyObject *arg, char *msgbuf, size_t bufsize)
+converterr(const char *expected, PyObject *arg, char *msgbuf, size_t bufsize)
{
assert(expected != NULL);
assert(arg != NULL);
*/
static char *
-convertsimple(PyObject *arg, char **p_format, va_list *p_va, char *msgbuf,
- size_t bufsize, PyObject **freelist)
+convertsimple(PyObject *arg, const char **p_format, va_list *p_va,
+ char *msgbuf, size_t bufsize, PyObject **freelist)
{
- char *format = *p_format;
+ const char *format = *p_format;
char c = *format++;
#ifdef Py_USING_UNICODE
PyObject *uarg;
int
PyArg_ParseTupleAndKeywords(PyObject *args,
PyObject *keywords,
- char *format,
- char **kwlist, ...)
+ const char *format,
+ const char **kwlist, ...)
{
int retval;
va_list va;
int
PyArg_VaParseTupleAndKeywords(PyObject *args,
- PyObject *keywords,
- char *format,
- char **kwlist, va_list va)
+ PyObject *keywords,
+ const char *format,
+ const char **kwlist, va_list va)
{
int retval;
va_list lva;
static int
-vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
- char **kwlist, va_list *p_va)
+vgetargskeywords(PyObject *args, PyObject *keywords, const char *format,
+ const char **kwlist, va_list *p_va)
{
char msgbuf[512];
int levels[32];
- char *fname, *message;
+ const char *fname, *message;
int min, max;
- char *formatsave;
+ const char *formatsave;
int i, len, nargs, nkeywords;
- char *msg, **p;
+ const char *msg, **p;
PyObject *freelist = NULL;
assert(args != NULL && PyTuple_Check(args));
keyword parameter in messages */
if (nkeywords > 0) {
for (i = 0; i < nargs; i++) {
- char *thiskw = kwlist[i];
+ const char *thiskw = kwlist[i];
if (thiskw == NULL)
break;
if (PyDict_GetItemString(keywords, thiskw)) {
static char *
-skipitem(char **p_format, va_list *p_va)
+skipitem(const char **p_format, va_list *p_va)
{
- char *format = *p_format;
+ const char *format = *p_format;
char c = *format++;
switch (c) {
int
-PyArg_UnpackTuple(PyObject *args, char *name, int min, int max, ...)
+PyArg_UnpackTuple(PyObject *args, const char *name, int min, int max, ...)
{
int i, l;
PyObject **o;
* not emtpy, returns 1 otherwise
*/
int
-_PyArg_NoKeywords(char *funcname, PyObject *kw)
+_PyArg_NoKeywords(const char *funcname, PyObject *kw)
{
if (kw == NULL)
return 1;
funcname);
return 0;
}
-
-
-
'NEW' REFERENCE! */
PyObject *
-PyImport_AddModule(char *name)
+PyImport_AddModule(const char *name)
{
PyObject *modules = PyImport_GetModuleDict();
PyObject *m;
its module object WITH INCREMENTED REFERENCE COUNT */
PyObject *
-PyImport_ImportModule(char *name)
+PyImport_ImportModule(const char *name)
{
PyObject *pname;
PyObject *result;
This Python has API version %d, module %.100s has version %d.";
PyObject *
-Py_InitModule4(char *name, PyMethodDef *methods, char *doc,
+Py_InitModule4(const char *name, PyMethodDef *methods, const char *doc,
PyObject *passthrough, int module_api_version)
{
PyObject *m, *d, *v, *n;
/* Helper for mkvalue() to scan the length of a format */
static int
-countformat(char *format, int endchar)
+countformat(const char *format, int endchar)
{
int count = 0;
int level = 0;
/* Generic function to create a value -- the inverse of getargs() */
/* After an original idea and first implementation by Steven Miale */
-static PyObject *do_mktuple(char**, va_list *, int, int);
-static PyObject *do_mklist(char**, va_list *, int, int);
-static PyObject *do_mkdict(char**, va_list *, int, int);
-static PyObject *do_mkvalue(char**, va_list *);
+static PyObject *do_mktuple(const char**, va_list *, int, int);
+static PyObject *do_mklist(const char**, va_list *, int, int);
+static PyObject *do_mkdict(const char**, va_list *, int, int);
+static PyObject *do_mkvalue(const char**, va_list *);
static PyObject *
-do_mkdict(char **p_format, va_list *p_va, int endchar, int n)
+do_mkdict(const char **p_format, va_list *p_va, int endchar, int n)
{
PyObject *d;
int i;
}
static PyObject *
-do_mklist(char **p_format, va_list *p_va, int endchar, int n)
+do_mklist(const char **p_format, va_list *p_va, int endchar, int n)
{
PyObject *v;
int i;
#endif
static PyObject *
-do_mktuple(char **p_format, va_list *p_va, int endchar, int n)
+do_mktuple(const char **p_format, va_list *p_va, int endchar, int n)
{
PyObject *v;
int i;
}
static PyObject *
-do_mkvalue(char **p_format, va_list *p_va)
+do_mkvalue(const char **p_format, va_list *p_va)
{
for (;;) {
switch (*(*p_format)++) {
PyObject *
-Py_BuildValue(char *format, ...)
+Py_BuildValue(const char *format, ...)
{
va_list va;
PyObject* retval;
}
PyObject *
-Py_VaBuildValue(char *format, va_list va)
+Py_VaBuildValue(const char *format, va_list va)
{
- char *f = format;
+ const char *f = format;
int n = countformat(f, '\0');
va_list lva;
PyObject *
-PyEval_CallFunction(PyObject *obj, char *format, ...)
+PyEval_CallFunction(PyObject *obj, const char *format, ...)
{
va_list vargs;
PyObject *args;
PyObject *
-PyEval_CallMethod(PyObject *obj, char *methodname, char *format, ...)
+PyEval_CallMethod(PyObject *obj, const char *methodname, const char *format, ...)
{
va_list vargs;
PyObject *meth;
}
int
-PyModule_AddObject(PyObject *m, char *name, PyObject *o)
+PyModule_AddObject(PyObject *m, const char *name, PyObject *o)
{
PyObject *dict;
if (!PyModule_Check(m)) {
}
int
-PyModule_AddIntConstant(PyObject *m, char *name, long value)
+PyModule_AddIntConstant(PyObject *m, const char *name, long value)
{
return PyModule_AddObject(m, name, PyInt_FromLong(value));
}
int
-PyModule_AddStringConstant(PyObject *m, char *name, char *value)
+PyModule_AddStringConstant(PyObject *m, const char *name, const char *value)
{
return PyModule_AddObject(m, name, PyString_FromString(value));
}