mirror of https://github.com/python/cpython
Add const to several API functions that take char *.
In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
This commit is contained in:
parent
aaa2f1dea7
commit
af68c874a6
|
@ -38,7 +38,7 @@ static struct PycStringIO_CAPI {
|
||||||
int(*creadline)(PyObject *, char **);
|
int(*creadline)(PyObject *, char **);
|
||||||
|
|
||||||
/* Write a string to an output object*/
|
/* 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). */
|
/* Get the output object as a Python string (returns new reference). */
|
||||||
PyObject *(*cgetvalue)(PyObject *);
|
PyObject *(*cgetvalue)(PyObject *);
|
||||||
|
|
|
@ -18,9 +18,11 @@ PyAPI_FUNC(PyObject *) PyEval_CallObject(PyObject *, PyObject *);
|
||||||
#define PyEval_CallObject(func,arg) \
|
#define PyEval_CallObject(func,arg) \
|
||||||
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
|
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,
|
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_SetProfile(Py_tracefunc, PyObject *);
|
||||||
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
|
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
|
||||||
|
@ -60,8 +62,8 @@ PyAPI_DATA(int) _Py_CheckRecursionLimit;
|
||||||
# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
|
# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyAPI_FUNC(char *) PyEval_GetFuncName(PyObject *);
|
PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *);
|
||||||
PyAPI_FUNC(char *) PyEval_GetFuncDesc(PyObject *);
|
PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *);
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *);
|
PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *);
|
PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *);
|
||||||
|
|
|
@ -12,8 +12,8 @@ PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co);
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
|
||||||
char *name, PyObject *co, char *pathname);
|
char *name, PyObject *co, char *pathname);
|
||||||
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
|
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
|
||||||
PyAPI_FUNC(PyObject *) PyImport_AddModule(char *name);
|
PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name);
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ImportModule(char *name);
|
PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name);
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ImportModuleEx(
|
PyAPI_FUNC(PyObject *) PyImport_ImportModuleEx(
|
||||||
char *name, PyObject *globals, PyObject *locals, PyObject *fromlist);
|
char *name, PyObject *globals, PyObject *locals, PyObject *fromlist);
|
||||||
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
|
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
|
||||||
|
|
|
@ -35,15 +35,15 @@ PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
|
PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
|
||||||
|
|
||||||
struct PyMethodDef {
|
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 */
|
PyCFunction ml_meth; /* The C function that implements it */
|
||||||
int ml_flags; /* Combination of METH_xxx flags, which mostly
|
int ml_flags; /* Combination of METH_xxx flags, which mostly
|
||||||
describe the args expected by the C func */
|
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;
|
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)
|
#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
|
||||||
PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
|
PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
|
||||||
|
@ -76,7 +76,7 @@ typedef struct PyMethodChain {
|
||||||
} PyMethodChain;
|
} PyMethodChain;
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *,
|
PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *,
|
||||||
char *);
|
const char *);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
|
|
|
@ -9,22 +9,22 @@ extern "C" {
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyArg_Parse(PyObject *, char *, ...);
|
PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...);
|
||||||
PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, char *, ...);
|
PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...);
|
||||||
PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
|
PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
|
||||||
char *, char **, ...);
|
const char *, const char **, ...);
|
||||||
PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, char *, int, int, ...);
|
PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, int, int, ...);
|
||||||
PyAPI_FUNC(PyObject *) Py_BuildValue(char *, ...);
|
PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
|
||||||
PyAPI_FUNC(int) _PyArg_NoKeywords(char *funcname, PyObject *kw);
|
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 *,
|
PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
|
||||||
char *, char **, va_list);
|
const char *, const char **, va_list);
|
||||||
PyAPI_FUNC(PyObject *) Py_VaBuildValue(char *, va_list);
|
PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyModule_AddObject(PyObject *, char *, PyObject *);
|
PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *);
|
||||||
PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, char *, long);
|
PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
|
||||||
PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, char *, char *);
|
PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
|
||||||
|
|
||||||
#define PYTHON_API_VERSION 1012
|
#define PYTHON_API_VERSION 1012
|
||||||
#define PYTHON_API_STRING "1012"
|
#define PYTHON_API_STRING "1012"
|
||||||
|
@ -84,9 +84,9 @@ PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, char *, char *);
|
||||||
#define Py_InitModule4 Py_InitModule4TraceRefs
|
#define Py_InitModule4 Py_InitModule4TraceRefs
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) Py_InitModule4(char *name, PyMethodDef *methods,
|
PyAPI_FUNC(PyObject *) Py_InitModule4(const char *name, PyMethodDef *methods,
|
||||||
char *doc, PyObject *self,
|
const char *doc, PyObject *self,
|
||||||
int apiver);
|
int apiver);
|
||||||
|
|
||||||
#define Py_InitModule(name, methods) \
|
#define Py_InitModule(name, methods) \
|
||||||
Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
|
Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
|
||||||
|
|
|
@ -12,7 +12,7 @@ PyAPI_DATA(PyTypeObject) PyModule_Type;
|
||||||
#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
|
#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
|
||||||
#define PyModule_CheckExact(op) ((op)->ob_type == &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(PyObject *) PyModule_GetDict(PyObject *);
|
||||||
PyAPI_FUNC(char *) PyModule_GetName(PyObject *);
|
PyAPI_FUNC(char *) PyModule_GetName(PyObject *);
|
||||||
PyAPI_FUNC(char *) PyModule_GetFilename(PyObject *);
|
PyAPI_FUNC(char *) PyModule_GetFilename(PyObject *);
|
||||||
|
|
|
@ -225,9 +225,9 @@ typedef struct {
|
||||||
typedef void (*freefunc)(void *);
|
typedef void (*freefunc)(void *);
|
||||||
typedef void (*destructor)(PyObject *);
|
typedef void (*destructor)(PyObject *);
|
||||||
typedef int (*printfunc)(PyObject *, FILE *, int);
|
typedef int (*printfunc)(PyObject *, FILE *, int);
|
||||||
typedef PyObject *(*getattrfunc)(PyObject *, char *);
|
typedef PyObject *(*getattrfunc)(PyObject *, const char *);
|
||||||
typedef PyObject *(*getattrofunc)(PyObject *, PyObject *);
|
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 (*setattrofunc)(PyObject *, PyObject *, PyObject *);
|
||||||
typedef int (*cmpfunc)(PyObject *, PyObject *);
|
typedef int (*cmpfunc)(PyObject *, PyObject *);
|
||||||
typedef PyObject *(*reprfunc)(PyObject *);
|
typedef PyObject *(*reprfunc)(PyObject *);
|
||||||
|
@ -243,7 +243,7 @@ typedef PyObject *(*allocfunc)(struct _typeobject *, int);
|
||||||
|
|
||||||
typedef struct _typeobject {
|
typedef struct _typeobject {
|
||||||
PyObject_VAR_HEAD
|
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 */
|
int tp_basicsize, tp_itemsize; /* For allocation */
|
||||||
|
|
||||||
/* Methods to implement standard operations */
|
/* Methods to implement standard operations */
|
||||||
|
@ -275,7 +275,7 @@ typedef struct _typeobject {
|
||||||
/* Flags to define presence of optional/expanded features */
|
/* Flags to define presence of optional/expanded features */
|
||||||
long tp_flags;
|
long tp_flags;
|
||||||
|
|
||||||
char *tp_doc; /* Documentation string */
|
const char *tp_doc; /* Documentation string */
|
||||||
|
|
||||||
/* Assigned meaning in release 2.0 */
|
/* Assigned meaning in release 2.0 */
|
||||||
/* call function for all accessible objects */
|
/* call function for all accessible objects */
|
||||||
|
@ -379,9 +379,9 @@ PyAPI_FUNC(PyObject *) PyObject_Unicode(PyObject *);
|
||||||
PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *);
|
PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int);
|
PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int);
|
||||||
PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int);
|
PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int);
|
||||||
PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, char *);
|
PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *);
|
||||||
PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, char *, PyObject *);
|
PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *);
|
||||||
PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, char *);
|
PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *);
|
||||||
PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *);
|
PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *);
|
||||||
PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
|
PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
|
||||||
PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *);
|
PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *);
|
||||||
|
|
|
@ -40,7 +40,7 @@ bisect_right(PyObject *self, PyObject *args, PyObject *kw)
|
||||||
int lo = 0;
|
int lo = 0;
|
||||||
int hi = -1;
|
int hi = -1;
|
||||||
int index;
|
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",
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|ii:bisect_right",
|
||||||
keywords, &list, &item, &lo, &hi))
|
keywords, &list, &item, &lo, &hi))
|
||||||
|
@ -70,7 +70,7 @@ insort_right(PyObject *self, PyObject *args, PyObject *kw)
|
||||||
int lo = 0;
|
int lo = 0;
|
||||||
int hi = -1;
|
int hi = -1;
|
||||||
int index;
|
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",
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|ii:insort_right",
|
||||||
keywords, &list, &item, &lo, &hi))
|
keywords, &list, &item, &lo, &hi))
|
||||||
|
@ -137,7 +137,7 @@ bisect_left(PyObject *self, PyObject *args, PyObject *kw)
|
||||||
int lo = 0;
|
int lo = 0;
|
||||||
int hi = -1;
|
int hi = -1;
|
||||||
int index;
|
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",
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|ii:bisect_left",
|
||||||
keywords, &list, &item, &lo, &hi))
|
keywords, &list, &item, &lo, &hi))
|
||||||
|
@ -167,7 +167,7 @@ insort_left(PyObject *self, PyObject *args, PyObject *kw)
|
||||||
int lo = 0;
|
int lo = 0;
|
||||||
int hi = -1;
|
int hi = -1;
|
||||||
int index;
|
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",
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|ii:insort_left",
|
||||||
keywords, &list, &item, &lo, &hi))
|
keywords, &list, &item, &lo, &hi))
|
||||||
|
@ -233,4 +233,3 @@ init_bisect(void)
|
||||||
|
|
||||||
m = Py_InitModule3("_bisect", bisect_methods, module_doc);
|
m = Py_InitModule3("_bisect", bisect_methods, module_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -650,7 +650,7 @@ static PyObject* _DBCursor_get(DBCursorObject* self, int extra_flags,
|
||||||
int dlen = -1;
|
int dlen = -1;
|
||||||
int doff = -1;
|
int doff = -1;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
char* kwnames[] = { "flags", "dlen", "doff", NULL };
|
static const char* kwnames[] = { "flags", "dlen", "doff", NULL };
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, format, kwnames,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, format, kwnames,
|
||||||
&flags, &dlen, &doff))
|
&flags, &dlen, &doff))
|
||||||
|
@ -1147,9 +1147,10 @@ DB_associate(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
#if (DBVER >= 41)
|
#if (DBVER >= 41)
|
||||||
PyObject *txnobj = NULL;
|
PyObject *txnobj = NULL;
|
||||||
DB_TXN *txn = NULL;
|
DB_TXN *txn = NULL;
|
||||||
char* kwnames[] = {"secondaryDB", "callback", "flags", "txn", NULL};
|
static const char* kwnames[] = {"secondaryDB", "callback", "flags", "txn",
|
||||||
|
NULL};
|
||||||
#else
|
#else
|
||||||
char* kwnames[] = {"secondaryDB", "callback", "flags", NULL};
|
static const char* kwnames[] = {"secondaryDB", "callback", "flags", NULL};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (DBVER >= 41)
|
#if (DBVER >= 41)
|
||||||
|
@ -1255,7 +1256,7 @@ _DB_consume(DBObject* self, PyObject* args, PyObject* kwargs, int consume_flag)
|
||||||
PyObject* retval = NULL;
|
PyObject* retval = NULL;
|
||||||
DBT key, data;
|
DBT key, data;
|
||||||
DB_TXN *txn = NULL;
|
DB_TXN *txn = NULL;
|
||||||
char* kwnames[] = { "txn", "flags", NULL };
|
static const char* kwnames[] = { "txn", "flags", NULL };
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:consume", kwnames,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:consume", kwnames,
|
||||||
&txnobj, &flags))
|
&txnobj, &flags))
|
||||||
|
@ -1325,7 +1326,7 @@ DB_cursor(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
DBC* dbc;
|
DBC* dbc;
|
||||||
PyObject* txnobj = NULL;
|
PyObject* txnobj = NULL;
|
||||||
DB_TXN *txn = 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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:cursor", kwnames,
|
||||||
&txnobj, &flags))
|
&txnobj, &flags))
|
||||||
|
@ -1350,7 +1351,7 @@ DB_delete(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
PyObject* keyobj;
|
PyObject* keyobj;
|
||||||
DBT key;
|
DBT key;
|
||||||
DB_TXN *txn = NULL;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|Oi:delete", kwnames,
|
||||||
&keyobj, &txnobj, &flags))
|
&keyobj, &txnobj, &flags))
|
||||||
|
@ -1402,7 +1403,8 @@ DB_get(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
int doff = -1;
|
int doff = -1;
|
||||||
DBT key, data;
|
DBT key, data;
|
||||||
DB_TXN *txn = NULL;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OOiii:get", kwnames,
|
||||||
&keyobj, &dfltobj, &txnobj, &flags, &dlen,
|
&keyobj, &dfltobj, &txnobj, &flags, &dlen,
|
||||||
|
@ -1469,7 +1471,8 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
int doff = -1;
|
int doff = -1;
|
||||||
DBT key, pkey, data;
|
DBT key, pkey, data;
|
||||||
DB_TXN *txn = NULL;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OOiii:pget", kwnames,
|
||||||
&keyobj, &dfltobj, &txnobj, &flags, &dlen,
|
&keyobj, &dfltobj, &txnobj, &flags, &dlen,
|
||||||
|
@ -1558,7 +1561,7 @@ DB_get_size(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
PyObject* retval = NULL;
|
PyObject* retval = NULL;
|
||||||
DBT key, data;
|
DBT key, data;
|
||||||
DB_TXN *txn = NULL;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:get_size", kwnames,
|
||||||
&keyobj, &txnobj))
|
&keyobj, &txnobj))
|
||||||
|
@ -1601,7 +1604,7 @@ DB_get_both(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
PyObject* retval = NULL;
|
PyObject* retval = NULL;
|
||||||
DBT key, data;
|
DBT key, data;
|
||||||
DB_TXN *txn = NULL;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|Oi:get_both", kwnames,
|
||||||
|
@ -1752,7 +1755,7 @@ DB_key_range(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
DBT key;
|
DBT key;
|
||||||
DB_TXN *txn = NULL;
|
DB_TXN *txn = NULL;
|
||||||
DB_KEY_RANGE range;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|Oi:key_range", kwnames,
|
||||||
&keyobj, &txnobj, &flags))
|
&keyobj, &txnobj, &flags))
|
||||||
|
@ -1783,17 +1786,17 @@ DB_open(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
PyObject *txnobj = NULL;
|
PyObject *txnobj = NULL;
|
||||||
DB_TXN *txn = NULL;
|
DB_TXN *txn = NULL;
|
||||||
/* with dbname */
|
/* with dbname */
|
||||||
char* kwnames[] = {
|
static const char* kwnames[] = {
|
||||||
"filename", "dbname", "dbtype", "flags", "mode", "txn", NULL};
|
"filename", "dbname", "dbtype", "flags", "mode", "txn", NULL};
|
||||||
/* without dbname */
|
/* without dbname */
|
||||||
char* kwnames_basic[] = {
|
static const char* kwnames_basic[] = {
|
||||||
"filename", "dbtype", "flags", "mode", "txn", NULL};
|
"filename", "dbtype", "flags", "mode", "txn", NULL};
|
||||||
#else
|
#else
|
||||||
/* with dbname */
|
/* with dbname */
|
||||||
char* kwnames[] = {
|
static const char* kwnames[] = {
|
||||||
"filename", "dbname", "dbtype", "flags", "mode", NULL};
|
"filename", "dbname", "dbtype", "flags", "mode", NULL};
|
||||||
/* without dbname */
|
/* without dbname */
|
||||||
char* kwnames_basic[] = {
|
static const char* kwnames_basic[] = {
|
||||||
"filename", "dbtype", "flags", "mode", NULL};
|
"filename", "dbtype", "flags", "mode", NULL};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1877,7 +1880,8 @@ DB_put(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
PyObject* keyobj, *dataobj, *retval;
|
PyObject* keyobj, *dataobj, *retval;
|
||||||
DBT key, data;
|
DBT key, data;
|
||||||
DB_TXN *txn = NULL;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|Oiii:put", kwnames,
|
||||||
&keyobj, &dataobj, &txnobj, &flags, &dlen, &doff))
|
&keyobj, &dataobj, &txnobj, &flags, &dlen, &doff))
|
||||||
|
@ -1917,7 +1921,7 @@ DB_remove(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
char* filename;
|
char* filename;
|
||||||
char* database = NULL;
|
char* database = NULL;
|
||||||
int err, flags=0;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zi:remove", kwnames,
|
||||||
&filename, &database, &flags))
|
&filename, &database, &flags))
|
||||||
|
@ -2335,9 +2339,9 @@ DB_stat(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
#if (DBVER >= 43)
|
#if (DBVER >= 43)
|
||||||
PyObject* txnobj = NULL;
|
PyObject* txnobj = NULL;
|
||||||
DB_TXN *txn = NULL;
|
DB_TXN *txn = NULL;
|
||||||
char* kwnames[] = { "txn", "flags", NULL };
|
static const char* kwnames[] = { "txn", "flags", NULL };
|
||||||
#else
|
#else
|
||||||
char* kwnames[] = { "flags", NULL };
|
static const char* kwnames[] = { "flags", NULL };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (DBVER >= 43)
|
#if (DBVER >= 43)
|
||||||
|
@ -2477,7 +2481,7 @@ DB_truncate(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
u_int32_t count=0;
|
u_int32_t count=0;
|
||||||
PyObject* txnobj = NULL;
|
PyObject* txnobj = NULL;
|
||||||
DB_TXN *txn = 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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:cursor", kwnames,
|
||||||
&txnobj, &flags))
|
&txnobj, &flags))
|
||||||
|
@ -2521,7 +2525,8 @@ DB_verify(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
char* dbName=NULL;
|
char* dbName=NULL;
|
||||||
char* outFileName=NULL;
|
char* outFileName=NULL;
|
||||||
FILE* outFile=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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zzi:verify", kwnames,
|
||||||
&fileName, &dbName, &outFileName, &flags))
|
&fileName, &dbName, &outFileName, &flags))
|
||||||
|
@ -2578,7 +2583,7 @@ DB_set_encrypt(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
int err;
|
int err;
|
||||||
u_int32_t flags=0;
|
u_int32_t flags=0;
|
||||||
char *passwd = NULL;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|i:set_encrypt", kwnames,
|
||||||
&passwd, &flags)) {
|
&passwd, &flags)) {
|
||||||
|
@ -3018,7 +3023,8 @@ DBC_get(DBCursorObject* self, PyObject* args, PyObject *kwargs)
|
||||||
int dlen = -1;
|
int dlen = -1;
|
||||||
int doff = -1;
|
int doff = -1;
|
||||||
DBT key, data;
|
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(key);
|
||||||
CLEAR_DBT(data);
|
CLEAR_DBT(data);
|
||||||
|
@ -3104,7 +3110,8 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
|
||||||
int dlen = -1;
|
int dlen = -1;
|
||||||
int doff = -1;
|
int doff = -1;
|
||||||
DBT key, pkey, data;
|
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(key);
|
||||||
CLEAR_DBT(data);
|
CLEAR_DBT(data);
|
||||||
|
@ -3257,7 +3264,8 @@ DBC_put(DBCursorObject* self, PyObject* args, PyObject* kwargs)
|
||||||
int err, flags = 0;
|
int err, flags = 0;
|
||||||
PyObject* keyobj, *dataobj;
|
PyObject* keyobj, *dataobj;
|
||||||
DBT key, data;
|
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 dlen = -1;
|
||||||
int doff = -1;
|
int doff = -1;
|
||||||
|
|
||||||
|
@ -3292,7 +3300,7 @@ DBC_set(DBCursorObject* self, PyObject* args, PyObject *kwargs)
|
||||||
int err, flags = 0;
|
int err, flags = 0;
|
||||||
DBT key, data;
|
DBT key, data;
|
||||||
PyObject* retval, *keyobj;
|
PyObject* retval, *keyobj;
|
||||||
char* kwnames[] = { "key", "flags", "dlen", "doff", NULL };
|
static const char* kwnames[] = { "key", "flags", "dlen", "doff", NULL };
|
||||||
int dlen = -1;
|
int dlen = -1;
|
||||||
int doff = -1;
|
int doff = -1;
|
||||||
|
|
||||||
|
@ -3362,7 +3370,7 @@ DBC_set_range(DBCursorObject* self, PyObject* args, PyObject* kwargs)
|
||||||
int err, flags = 0;
|
int err, flags = 0;
|
||||||
DBT key, data;
|
DBT key, data;
|
||||||
PyObject* retval, *keyobj;
|
PyObject* retval, *keyobj;
|
||||||
char* kwnames[] = { "key", "flags", "dlen", "doff", NULL };
|
static const char* kwnames[] = { "key", "flags", "dlen", "doff", NULL };
|
||||||
int dlen = -1;
|
int dlen = -1;
|
||||||
int doff = -1;
|
int doff = -1;
|
||||||
|
|
||||||
|
@ -3552,7 +3560,7 @@ DBC_set_recno(DBCursorObject* self, PyObject* args, PyObject *kwargs)
|
||||||
PyObject* retval;
|
PyObject* retval;
|
||||||
int dlen = -1;
|
int dlen = -1;
|
||||||
int doff = -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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|iii:set_recno", kwnames,
|
||||||
&irecno, &flags, &dlen, &doff))
|
&irecno, &flags, &dlen, &doff))
|
||||||
|
@ -3746,7 +3754,8 @@ DBEnv_dbremove(DBEnvObject* self, PyObject* args, PyObject* kwargs)
|
||||||
char *database = NULL;
|
char *database = NULL;
|
||||||
PyObject *txnobj = NULL;
|
PyObject *txnobj = NULL;
|
||||||
DB_TXN *txn = 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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ss|Oi:dbremove", kwnames,
|
||||||
&file, &database, &txnobj, &flags)) {
|
&file, &database, &txnobj, &flags)) {
|
||||||
|
@ -3773,7 +3782,8 @@ DBEnv_dbrename(DBEnvObject* self, PyObject* args, PyObject* kwargs)
|
||||||
char *newname = NULL;
|
char *newname = NULL;
|
||||||
PyObject *txnobj = NULL;
|
PyObject *txnobj = NULL;
|
||||||
DB_TXN *txn = 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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sss|Oi:dbrename", kwnames,
|
||||||
&file, &database, &newname, &txnobj, &flags)) {
|
&file, &database, &newname, &txnobj, &flags)) {
|
||||||
|
@ -3797,7 +3807,7 @@ DBEnv_set_encrypt(DBEnvObject* self, PyObject* args, PyObject* kwargs)
|
||||||
int err;
|
int err;
|
||||||
u_int32_t flags=0;
|
u_int32_t flags=0;
|
||||||
char *passwd = NULL;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|i:set_encrypt", kwnames,
|
||||||
&passwd, &flags)) {
|
&passwd, &flags)) {
|
||||||
|
@ -3820,7 +3830,7 @@ DBEnv_set_timeout(DBEnvObject* self, PyObject* args, PyObject* kwargs)
|
||||||
int err;
|
int err;
|
||||||
u_int32_t flags=0;
|
u_int32_t flags=0;
|
||||||
u_int32_t timeout = 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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:set_timeout", kwnames,
|
||||||
&timeout, &flags)) {
|
&timeout, &flags)) {
|
||||||
|
@ -4107,7 +4117,7 @@ DBEnv_txn_begin(DBEnvObject* self, PyObject* args, PyObject* kwargs)
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
PyObject* txnobj = NULL;
|
PyObject* txnobj = NULL;
|
||||||
DB_TXN *txn = 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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:txn_begin", kwnames,
|
||||||
&txnobj, &flags))
|
&txnobj, &flags))
|
||||||
|
@ -4937,7 +4947,7 @@ DB_construct(PyObject* self, PyObject* args, PyObject* kwargs)
|
||||||
{
|
{
|
||||||
PyObject* dbenvobj = NULL;
|
PyObject* dbenvobj = NULL;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
char* kwnames[] = { "dbEnv", "flags", NULL};
|
static const char* kwnames[] = { "dbEnv", "flags", NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:DB", kwnames,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:DB", kwnames,
|
||||||
&dbenvobj, &flags))
|
&dbenvobj, &flags))
|
||||||
|
|
|
@ -291,7 +291,7 @@ Dialect_dealloc(DialectObj *self)
|
||||||
self->ob_type->tp_free((PyObject *)self);
|
self->ob_type->tp_free((PyObject *)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *dialect_kws[] = {
|
static const char *dialect_kws[] = {
|
||||||
"dialect",
|
"dialect",
|
||||||
"delimiter",
|
"delimiter",
|
||||||
"doublequote",
|
"doublequote",
|
||||||
|
|
|
@ -1886,10 +1886,10 @@ PyCurses_setupterm(PyObject* self, PyObject *args, PyObject* keywds)
|
||||||
int err;
|
int err;
|
||||||
char* termstr = NULL;
|
char* termstr = NULL;
|
||||||
|
|
||||||
static char *kwlist[] = {"term", "fd", NULL};
|
static const char *kwlist[] = {"term", "fd", NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(
|
if (!PyArg_ParseTupleAndKeywords(
|
||||||
args,keywds,"|zi:setupterm",kwlist,&termstr,&fd)) {
|
args, keywds, "|zi:setupterm", kwlist, &termstr, &fd)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ EVP_repr(PyObject *self)
|
||||||
static int
|
static int
|
||||||
EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds)
|
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;
|
PyObject *name_obj = NULL;
|
||||||
char *nameStr;
|
char *nameStr;
|
||||||
unsigned char *cp = NULL;
|
unsigned char *cp = NULL;
|
||||||
|
@ -366,7 +366,7 @@ The MD5 and SHA1 algorithms are always supported.\n");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
EVP_new(PyObject *self, PyObject *args, PyObject *kwdict)
|
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;
|
PyObject *name_obj = NULL;
|
||||||
char *name;
|
char *name;
|
||||||
const EVP_MD *digest;
|
const EVP_MD *digest;
|
||||||
|
|
|
@ -2007,7 +2007,7 @@ pattern_match(PatternObject* self, PyObject* args, PyObject* kw)
|
||||||
PyObject* string;
|
PyObject* string;
|
||||||
int start = 0;
|
int start = 0;
|
||||||
int end = INT_MAX;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:match", kwlist,
|
||||||
&string, &start, &end))
|
&string, &start, &end))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2044,7 +2044,7 @@ pattern_search(PatternObject* self, PyObject* args, PyObject* kw)
|
||||||
PyObject* string;
|
PyObject* string;
|
||||||
int start = 0;
|
int start = 0;
|
||||||
int end = INT_MAX;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:search", kwlist,
|
||||||
&string, &start, &end))
|
&string, &start, &end))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2185,7 +2185,7 @@ pattern_findall(PatternObject* self, PyObject* args, PyObject* kw)
|
||||||
PyObject* string;
|
PyObject* string;
|
||||||
int start = 0;
|
int start = 0;
|
||||||
int end = INT_MAX;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:findall", kwlist,
|
||||||
&string, &start, &end))
|
&string, &start, &end))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2311,7 +2311,7 @@ pattern_split(PatternObject* self, PyObject* args, PyObject* kw)
|
||||||
|
|
||||||
PyObject* string;
|
PyObject* string;
|
||||||
int maxsplit = 0;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|i:split", kwlist,
|
||||||
&string, &maxsplit))
|
&string, &maxsplit))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2595,7 +2595,7 @@ pattern_sub(PatternObject* self, PyObject* args, PyObject* kw)
|
||||||
PyObject* template;
|
PyObject* template;
|
||||||
PyObject* string;
|
PyObject* string;
|
||||||
int count = 0;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|i:sub", kwlist,
|
||||||
&template, &string, &count))
|
&template, &string, &count))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2609,7 +2609,7 @@ pattern_subn(PatternObject* self, PyObject* args, PyObject* kw)
|
||||||
PyObject* template;
|
PyObject* template;
|
||||||
PyObject* string;
|
PyObject* string;
|
||||||
int count = 0;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|i:subn", kwlist,
|
||||||
&template, &string, &count))
|
&template, &string, &count))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2916,7 +2916,7 @@ match_groups(MatchObject* self, PyObject* args, PyObject* kw)
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
PyObject* def = Py_None;
|
PyObject* def = Py_None;
|
||||||
static char* kwlist[] = { "default", NULL };
|
static const char* kwlist[] = { "default", NULL };
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:groups", kwlist, &def))
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:groups", kwlist, &def))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -2945,7 +2945,7 @@ match_groupdict(MatchObject* self, PyObject* args, PyObject* kw)
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
PyObject* def = Py_None;
|
PyObject* def = Py_None;
|
||||||
static char* kwlist[] = { "default", NULL };
|
static const char* kwlist[] = { "default", NULL };
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:groupdict", kwlist, &def))
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:groupdict", kwlist, &def))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -2393,7 +2393,7 @@ Tktt_Repr(PyObject *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
Tktt_GetAttr(PyObject *self, char *name)
|
Tktt_GetAttr(PyObject *self, const char *name)
|
||||||
{
|
{
|
||||||
return Py_FindMethod(Tktt_methods, self, name);
|
return Py_FindMethod(Tktt_methods, self, name);
|
||||||
}
|
}
|
||||||
|
@ -2723,7 +2723,7 @@ Tkapp_Dealloc(PyObject *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
Tkapp_GetAttr(PyObject *self, char *name)
|
Tkapp_GetAttr(PyObject *self, const char *name)
|
||||||
{
|
{
|
||||||
return Py_FindMethod(Tkapp_methods, self, name);
|
return Py_FindMethod(Tkapp_methods, self, name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1032,7 +1032,7 @@ binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
unsigned char *data, *odata;
|
unsigned char *data, *odata;
|
||||||
unsigned int datalen = 0;
|
unsigned int datalen = 0;
|
||||||
PyObject *rv;
|
PyObject *rv;
|
||||||
static char *kwlist[] = {"data", "header", NULL};
|
static const char *kwlist[] = {"data", "header", NULL};
|
||||||
int header = 0;
|
int header = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|i", kwlist, &data,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|i", kwlist, &data,
|
||||||
|
@ -1133,7 +1133,8 @@ binascii_b2a_qp (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
unsigned int datalen = 0, odatalen = 0;
|
unsigned int datalen = 0, odatalen = 0;
|
||||||
PyObject *rv;
|
PyObject *rv;
|
||||||
unsigned int linelen = 0;
|
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 istext = 1;
|
||||||
int quotetabs = 0;
|
int quotetabs = 0;
|
||||||
int header = 0;
|
int header = 0;
|
||||||
|
|
|
@ -1285,8 +1285,8 @@ static PyMemberDef BZ2File_members[] = {
|
||||||
static int
|
static int
|
||||||
BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
|
BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"filename", "mode", "buffering",
|
static const char *kwlist[] = {"filename", "mode", "buffering",
|
||||||
"compresslevel", 0};
|
"compresslevel", 0};
|
||||||
PyObject *name;
|
PyObject *name;
|
||||||
char *mode = "r";
|
char *mode = "r";
|
||||||
int buffering = -1;
|
int buffering = -1;
|
||||||
|
@ -1674,7 +1674,7 @@ BZ2Comp_init(BZ2CompObject *self, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
int compresslevel = 9;
|
int compresslevel = 9;
|
||||||
int bzerror;
|
int bzerror;
|
||||||
static char *kwlist[] = {"compresslevel", 0};
|
static const char *kwlist[] = {"compresslevel", 0};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:BZ2Compressor",
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:BZ2Compressor",
|
||||||
kwlist, &compresslevel))
|
kwlist, &compresslevel))
|
||||||
|
@ -2019,7 +2019,7 @@ bz2_compress(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
bz_stream _bzs;
|
bz_stream _bzs;
|
||||||
bz_stream *bzs = &_bzs;
|
bz_stream *bzs = &_bzs;
|
||||||
int bzerror;
|
int bzerror;
|
||||||
static char *kwlist[] = {"data", "compresslevel", 0};
|
static const char *kwlist[] = {"data", "compresslevel", 0};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|i",
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|i",
|
||||||
kwlist, &data, &datasize,
|
kwlist, &data, &datasize,
|
||||||
|
|
|
@ -339,7 +339,7 @@ typedef struct Picklerobject {
|
||||||
|
|
||||||
int fast; /* Fast mode doesn't save in memo, don't use if circ ref */
|
int fast; /* Fast mode doesn't save in memo, don't use if circ ref */
|
||||||
int nesting;
|
int nesting;
|
||||||
int (*write_func)(struct Picklerobject *, char *, int);
|
int (*write_func)(struct Picklerobject *, const char *, int);
|
||||||
char *write_buf;
|
char *write_buf;
|
||||||
int buf_size;
|
int buf_size;
|
||||||
PyObject *dispatch_table;
|
PyObject *dispatch_table;
|
||||||
|
@ -417,7 +417,7 @@ cPickle_ErrFormat(PyObject *ErrType, char *stringformat, char *format, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
write_file(Picklerobject *self, char *s, int n)
|
write_file(Picklerobject *self, const char *s, int n)
|
||||||
{
|
{
|
||||||
size_t nbyteswritten;
|
size_t nbyteswritten;
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ write_file(Picklerobject *self, char *s, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
write_cStringIO(Picklerobject *self, char *s, int n)
|
write_cStringIO(Picklerobject *self, const char *s, int n)
|
||||||
{
|
{
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -451,14 +451,14 @@ write_cStringIO(Picklerobject *self, char *s, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
write_none(Picklerobject *self, char *s, int n)
|
write_none(Picklerobject *self, const char *s, int n)
|
||||||
{
|
{
|
||||||
if (s == NULL) return 0;
|
if (s == NULL) return 0;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
PyObject *py_str = 0, *junk = 0;
|
||||||
|
|
||||||
|
@ -669,7 +669,7 @@ readline_other(Unpicklerobject *self, char **s)
|
||||||
* The caller is responsible for free()'ing the return value.
|
* The caller is responsible for free()'ing the return value.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
pystrndup(char *s, int n)
|
pystrndup(const char *s, int n)
|
||||||
{
|
{
|
||||||
char *r = (char *)malloc(n+1);
|
char *r = (char *)malloc(n+1);
|
||||||
if (r == NULL)
|
if (r == NULL)
|
||||||
|
@ -945,7 +945,7 @@ save_none(Picklerobject *self, PyObject *args)
|
||||||
static int
|
static int
|
||||||
save_bool(Picklerobject *self, PyObject *args)
|
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};
|
static char len[2] = {sizeof(FALSE)-1, sizeof(TRUE)-1};
|
||||||
long l = PyInt_AS_LONG((PyIntObject *)args);
|
long l = PyInt_AS_LONG((PyIntObject *)args);
|
||||||
|
|
||||||
|
@ -2858,7 +2858,7 @@ newPicklerobject(PyObject *file, int proto)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
get_Pickler(PyObject *self, PyObject *args, PyObject *kwds)
|
get_Pickler(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"file", "protocol", NULL};
|
static const char *kwlist[] = {"file", "protocol", NULL};
|
||||||
PyObject *file = NULL;
|
PyObject *file = NULL;
|
||||||
int proto = 0;
|
int proto = 0;
|
||||||
|
|
||||||
|
@ -5378,7 +5378,7 @@ Unpickler_setattr(Unpicklerobject *self, char *name, PyObject *value)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
cpm_dump(PyObject *self, PyObject *args, PyObject *kwds)
|
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;
|
PyObject *ob, *file, *res = NULL;
|
||||||
Picklerobject *pickler = 0;
|
Picklerobject *pickler = 0;
|
||||||
int proto = 0;
|
int proto = 0;
|
||||||
|
@ -5407,7 +5407,7 @@ cpm_dump(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
cpm_dumps(PyObject *self, PyObject *args, PyObject *kwds)
|
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;
|
PyObject *ob, *file = 0, *res = NULL;
|
||||||
Picklerobject *pickler = 0;
|
Picklerobject *pickler = 0;
|
||||||
int proto = 0;
|
int proto = 0;
|
||||||
|
|
|
@ -362,7 +362,7 @@ PyDoc_STRVAR(O_write__doc__,
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
O_cwrite(PyObject *self, char *c, int l) {
|
O_cwrite(PyObject *self, const char *c, int l) {
|
||||||
int newl;
|
int newl;
|
||||||
Oobject *oself;
|
Oobject *oself;
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ PyDoc_STRVAR(MultibyteCodec_StreamReader__doc__,
|
||||||
PyDoc_STRVAR(MultibyteCodec_StreamWriter__doc__,
|
PyDoc_STRVAR(MultibyteCodec_StreamWriter__doc__,
|
||||||
"I.StreamWriter(stream[, errors]) -> StreamWriter instance");
|
"I.StreamWriter(stream[, errors]) -> StreamWriter instance");
|
||||||
|
|
||||||
static char *codeckwarglist[] = {"input", "errors", NULL};
|
static const char *codeckwarglist[] = {"input", "errors", NULL};
|
||||||
static char *streamkwarglist[] = {"stream", "errors", NULL};
|
static const char *streamkwarglist[] = {"stream", "errors", NULL};
|
||||||
|
|
||||||
static PyObject *multibytecodec_encode(MultibyteCodec *,
|
static PyObject *multibytecodec_encode(MultibyteCodec *,
|
||||||
MultibyteCodec_State *, const Py_UNICODE **, size_t,
|
MultibyteCodec_State *, const Py_UNICODE **, size_t,
|
||||||
|
|
|
@ -1073,10 +1073,10 @@ append_keyword_tzinfo(PyObject *repr, PyObject *tzinfo)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
format_ctime(PyDateTime_Date *date, int hours, int minutes, int seconds)
|
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"
|
"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"
|
||||||
};
|
};
|
||||||
static char *MonthNames[] = {
|
static const char *MonthNames[] = {
|
||||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||||
};
|
};
|
||||||
|
@ -1891,7 +1891,7 @@ delta_new(PyTypeObject *type, PyObject *args, PyObject *kw)
|
||||||
PyObject *y = NULL; /* temp sum of microseconds */
|
PyObject *y = NULL; /* temp sum of microseconds */
|
||||||
double leftover_us = 0.0;
|
double leftover_us = 0.0;
|
||||||
|
|
||||||
static char *keywords[] = {
|
static const char *keywords[] = {
|
||||||
"days", "seconds", "microseconds", "milliseconds",
|
"days", "seconds", "microseconds", "milliseconds",
|
||||||
"minutes", "hours", "weeks", NULL
|
"minutes", "hours", "weeks", NULL
|
||||||
};
|
};
|
||||||
|
@ -2194,7 +2194,7 @@ static PyGetSetDef date_getset[] = {
|
||||||
|
|
||||||
/* Constructors. */
|
/* Constructors. */
|
||||||
|
|
||||||
static char *date_kws[] = {"year", "month", "day", NULL};
|
static const char *date_kws[] = {"year", "month", "day", NULL};
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
date_new(PyTypeObject *type, PyObject *args, PyObject *kw)
|
date_new(PyTypeObject *type, PyObject *args, PyObject *kw)
|
||||||
|
@ -2406,7 +2406,7 @@ static PyObject *
|
||||||
date_repr(PyDateTime_Date *self)
|
date_repr(PyDateTime_Date *self)
|
||||||
{
|
{
|
||||||
char buffer[1028];
|
char buffer[1028];
|
||||||
char *typename;
|
const char *typename;
|
||||||
|
|
||||||
typename = self->ob_type->tp_name;
|
typename = self->ob_type->tp_name;
|
||||||
PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d)",
|
PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d)",
|
||||||
|
@ -2448,7 +2448,7 @@ date_strftime(PyDateTime_Date *self, PyObject *args, PyObject *kw)
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
PyObject *format;
|
PyObject *format;
|
||||||
PyObject *tuple;
|
PyObject *tuple;
|
||||||
static char *keywords[] = {"format", NULL};
|
static const char *keywords[] = {"format", NULL};
|
||||||
|
|
||||||
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords,
|
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords,
|
||||||
&PyString_Type, &format))
|
&PyString_Type, &format))
|
||||||
|
@ -3028,7 +3028,7 @@ static PyGetSetDef time_getset[] = {
|
||||||
* Constructors.
|
* Constructors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *time_kws[] = {"hour", "minute", "second", "microsecond",
|
static const char *time_kws[] = {"hour", "minute", "second", "microsecond",
|
||||||
"tzinfo", NULL};
|
"tzinfo", NULL};
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -3133,7 +3133,7 @@ static PyObject *
|
||||||
time_repr(PyDateTime_Time *self)
|
time_repr(PyDateTime_Time *self)
|
||||||
{
|
{
|
||||||
char buffer[100];
|
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 h = TIME_GET_HOUR(self);
|
||||||
int m = TIME_GET_MINUTE(self);
|
int m = TIME_GET_MINUTE(self);
|
||||||
int s = TIME_GET_SECOND(self);
|
int s = TIME_GET_SECOND(self);
|
||||||
|
@ -3196,7 +3196,7 @@ time_strftime(PyDateTime_Time *self, PyObject *args, PyObject *kw)
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
PyObject *format;
|
PyObject *format;
|
||||||
PyObject *tuple;
|
PyObject *tuple;
|
||||||
static char *keywords[] = {"format", NULL};
|
static const char *keywords[] = {"format", NULL};
|
||||||
|
|
||||||
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords,
|
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords,
|
||||||
&PyString_Type, &format))
|
&PyString_Type, &format))
|
||||||
|
@ -3548,7 +3548,7 @@ static PyGetSetDef datetime_getset[] = {
|
||||||
* Constructors.
|
* Constructors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *datetime_kws[] = {
|
static const char *datetime_kws[] = {
|
||||||
"year", "month", "day", "hour", "minute", "second",
|
"year", "month", "day", "hour", "minute", "second",
|
||||||
"microsecond", "tzinfo", NULL
|
"microsecond", "tzinfo", NULL
|
||||||
};
|
};
|
||||||
|
@ -3729,7 +3729,7 @@ datetime_now(PyObject *cls, PyObject *args, PyObject *kw)
|
||||||
{
|
{
|
||||||
PyObject *self;
|
PyObject *self;
|
||||||
PyObject *tzinfo = Py_None;
|
PyObject *tzinfo = Py_None;
|
||||||
static char *keywords[] = {"tz", NULL};
|
static const char *keywords[] = {"tz", NULL};
|
||||||
|
|
||||||
if (! PyArg_ParseTupleAndKeywords(args, kw, "|O:now", keywords,
|
if (! PyArg_ParseTupleAndKeywords(args, kw, "|O:now", keywords,
|
||||||
&tzinfo))
|
&tzinfo))
|
||||||
|
@ -3765,7 +3765,7 @@ datetime_fromtimestamp(PyObject *cls, PyObject *args, PyObject *kw)
|
||||||
PyObject *self;
|
PyObject *self;
|
||||||
double timestamp;
|
double timestamp;
|
||||||
PyObject *tzinfo = Py_None;
|
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",
|
if (! PyArg_ParseTupleAndKeywords(args, kw, "d|O:fromtimestamp",
|
||||||
keywords, ×tamp, &tzinfo))
|
keywords, ×tamp, &tzinfo))
|
||||||
|
@ -3843,7 +3843,7 @@ datetime_strptime(PyObject *cls, PyObject *args)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
datetime_combine(PyObject *cls, PyObject *args, PyObject *kw)
|
datetime_combine(PyObject *cls, PyObject *args, PyObject *kw)
|
||||||
{
|
{
|
||||||
static char *keywords[] = {"date", "time", NULL};
|
static const char *keywords[] = {"date", "time", NULL};
|
||||||
PyObject *date;
|
PyObject *date;
|
||||||
PyObject *time;
|
PyObject *time;
|
||||||
PyObject *result = NULL;
|
PyObject *result = NULL;
|
||||||
|
@ -4027,7 +4027,7 @@ static PyObject *
|
||||||
datetime_repr(PyDateTime_DateTime *self)
|
datetime_repr(PyDateTime_DateTime *self)
|
||||||
{
|
{
|
||||||
char buffer[1000];
|
char buffer[1000];
|
||||||
char *typename = self->ob_type->tp_name;
|
const char *typename = self->ob_type->tp_name;
|
||||||
PyObject *baserepr;
|
PyObject *baserepr;
|
||||||
|
|
||||||
if (DATE_GET_MICROSECOND(self)) {
|
if (DATE_GET_MICROSECOND(self)) {
|
||||||
|
@ -4070,7 +4070,7 @@ static PyObject *
|
||||||
datetime_isoformat(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
|
datetime_isoformat(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
|
||||||
{
|
{
|
||||||
char sep = 'T';
|
char sep = 'T';
|
||||||
static char *keywords[] = {"sep", NULL};
|
static const char *keywords[] = {"sep", NULL};
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
char *cp;
|
char *cp;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
@ -4261,7 +4261,7 @@ datetime_astimezone(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
|
||||||
int offset, none;
|
int offset, none;
|
||||||
|
|
||||||
PyObject *tzinfo;
|
PyObject *tzinfo;
|
||||||
static char *keywords[] = {"tz", NULL};
|
static const char *keywords[] = {"tz", NULL};
|
||||||
|
|
||||||
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:astimezone", keywords,
|
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:astimezone", keywords,
|
||||||
&PyDateTime_TZInfoType, &tzinfo))
|
&PyDateTime_TZInfoType, &tzinfo))
|
||||||
|
|
|
@ -26,7 +26,7 @@ static PyObject *_grouper_create(groupbyobject *, PyObject *);
|
||||||
static PyObject *
|
static PyObject *
|
||||||
groupby_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
groupby_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
static char *kwargs[] = {"iterable", "key", NULL};
|
static const char *kwargs[] = {"iterable", "key", NULL};
|
||||||
groupbyobject *gbo;
|
groupbyobject *gbo;
|
||||||
PyObject *it, *keyfunc = Py_None;
|
PyObject *it, *keyfunc = Py_None;
|
||||||
|
|
||||||
|
|
|
@ -864,12 +864,13 @@ new_mmap_object(PyObject *self, PyObject *args, PyObject *kwdict)
|
||||||
int map_size;
|
int map_size;
|
||||||
int fd, flags = MAP_SHARED, prot = PROT_WRITE | PROT_READ;
|
int fd, flags = MAP_SHARED, prot = PROT_WRITE | PROT_READ;
|
||||||
access_mode access = ACCESS_DEFAULT;
|
access_mode access = ACCESS_DEFAULT;
|
||||||
char *keywords[] = {"fileno", "length",
|
static const char *keywords[] = {"fileno", "length",
|
||||||
"flags", "prot",
|
"flags", "prot",
|
||||||
"access", NULL};
|
"access", NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwdict, "iO|iii", keywords,
|
if (!PyArg_ParseTupleAndKeywords(args, kwdict, "iO|iii", keywords,
|
||||||
&fd, &map_size_obj, &flags, &prot, &access))
|
&fd, &map_size_obj, &flags, &prot,
|
||||||
|
&access))
|
||||||
return NULL;
|
return NULL;
|
||||||
map_size = _GetMapSize(map_size_obj);
|
map_size = _GetMapSize(map_size_obj);
|
||||||
if (map_size < 0)
|
if (map_size < 0)
|
||||||
|
@ -952,9 +953,9 @@ new_mmap_object(PyObject *self, PyObject *args, PyObject *kwdict)
|
||||||
HANDLE fh = 0;
|
HANDLE fh = 0;
|
||||||
access_mode access = ACCESS_DEFAULT;
|
access_mode access = ACCESS_DEFAULT;
|
||||||
DWORD flProtect, dwDesiredAccess;
|
DWORD flProtect, dwDesiredAccess;
|
||||||
char *keywords[] = { "fileno", "length",
|
static const char *keywords[] = { "fileno", "length",
|
||||||
"tagname",
|
"tagname",
|
||||||
"access", NULL };
|
"access", NULL };
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwdict, "iO|zi", keywords,
|
if (!PyArg_ParseTupleAndKeywords(args, kwdict, "iO|zi", keywords,
|
||||||
&fileno, &map_size_obj,
|
&fileno, &map_size_obj,
|
||||||
|
|
|
@ -158,7 +158,7 @@ typedef struct {
|
||||||
|
|
||||||
static void parser_free(PyST_Object *st);
|
static void parser_free(PyST_Object *st);
|
||||||
static int parser_compare(PyST_Object *left, PyST_Object *right);
|
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
|
static
|
||||||
|
@ -292,7 +292,7 @@ parser_st2tuple(PyST_Object *self, PyObject *args, PyObject *kw)
|
||||||
PyObject *res = 0;
|
PyObject *res = 0;
|
||||||
int ok;
|
int ok;
|
||||||
|
|
||||||
static char *keywords[] = {"ast", "line_info", NULL};
|
static const char *keywords[] = {"ast", "line_info", NULL};
|
||||||
|
|
||||||
if (self == NULL) {
|
if (self == NULL) {
|
||||||
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|O:st2tuple", keywords,
|
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|O:st2tuple", keywords,
|
||||||
|
@ -330,7 +330,7 @@ parser_st2list(PyST_Object *self, PyObject *args, PyObject *kw)
|
||||||
PyObject *res = 0;
|
PyObject *res = 0;
|
||||||
int ok;
|
int ok;
|
||||||
|
|
||||||
static char *keywords[] = {"ast", "line_info", NULL};
|
static const char *keywords[] = {"ast", "line_info", NULL};
|
||||||
|
|
||||||
if (self == NULL)
|
if (self == NULL)
|
||||||
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|O:st2list", keywords,
|
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|O:st2list", keywords,
|
||||||
|
@ -367,7 +367,7 @@ parser_compilest(PyST_Object *self, PyObject *args, PyObject *kw)
|
||||||
char* str = "<syntax-tree>";
|
char* str = "<syntax-tree>";
|
||||||
int ok;
|
int ok;
|
||||||
|
|
||||||
static char *keywords[] = {"ast", "filename", NULL};
|
static const char *keywords[] = {"ast", "filename", NULL};
|
||||||
|
|
||||||
if (self == NULL)
|
if (self == NULL)
|
||||||
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|s:compilest", keywords,
|
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|s:compilest", keywords,
|
||||||
|
@ -396,7 +396,7 @@ parser_isexpr(PyST_Object *self, PyObject *args, PyObject *kw)
|
||||||
PyObject* res = 0;
|
PyObject* res = 0;
|
||||||
int ok;
|
int ok;
|
||||||
|
|
||||||
static char *keywords[] = {"ast", NULL};
|
static const char *keywords[] = {"ast", NULL};
|
||||||
|
|
||||||
if (self == NULL)
|
if (self == NULL)
|
||||||
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!:isexpr", keywords,
|
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!:isexpr", keywords,
|
||||||
|
@ -419,7 +419,7 @@ parser_issuite(PyST_Object *self, PyObject *args, PyObject *kw)
|
||||||
PyObject* res = 0;
|
PyObject* res = 0;
|
||||||
int ok;
|
int ok;
|
||||||
|
|
||||||
static char *keywords[] = {"ast", NULL};
|
static const char *keywords[] = {"ast", NULL};
|
||||||
|
|
||||||
if (self == NULL)
|
if (self == NULL)
|
||||||
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!:issuite", keywords,
|
ok = PyArg_ParseTupleAndKeywords(args, kw, "O!:issuite", keywords,
|
||||||
|
@ -456,7 +456,7 @@ parser_methods[] = {
|
||||||
|
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
parser_getattr(PyObject *self, char *name)
|
parser_getattr(PyObject *self, const char *name)
|
||||||
{
|
{
|
||||||
return (Py_FindMethod(parser_methods, self, name));
|
return (Py_FindMethod(parser_methods, self, name));
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ parser_do_parse(PyObject *args, PyObject *kw, char *argspec, int type)
|
||||||
char* string = 0;
|
char* string = 0;
|
||||||
PyObject* res = 0;
|
PyObject* res = 0;
|
||||||
|
|
||||||
static char *keywords[] = {"source", NULL};
|
static const char *keywords[] = {"source", NULL};
|
||||||
|
|
||||||
if (PyArg_ParseTupleAndKeywords(args, kw, argspec, keywords, &string)) {
|
if (PyArg_ParseTupleAndKeywords(args, kw, argspec, keywords, &string)) {
|
||||||
node* n = PyParser_SimpleParseString(string,
|
node* n = PyParser_SimpleParseString(string,
|
||||||
|
@ -568,7 +568,7 @@ parser_tuple2st(PyST_Object *self, PyObject *args, PyObject *kw)
|
||||||
PyObject *tuple;
|
PyObject *tuple;
|
||||||
node *tree;
|
node *tree;
|
||||||
|
|
||||||
static char *keywords[] = {"sequence", NULL};
|
static const char *keywords[] = {"sequence", NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "O:sequence2st", keywords,
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "O:sequence2st", keywords,
|
||||||
&tuple))
|
&tuple))
|
||||||
|
|
|
@ -1724,8 +1724,8 @@ pyexpat_ParserCreate(PyObject *notused, PyObject *args, PyObject *kw)
|
||||||
PyObject *intern = NULL;
|
PyObject *intern = NULL;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
int intern_decref = 0;
|
int intern_decref = 0;
|
||||||
static char *kwlist[] = {"encoding", "namespace_separator",
|
static const char *kwlist[] = {"encoding", "namespace_separator",
|
||||||
"intern", NULL};
|
"intern", NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "|zzO:ParserCreate", kwlist,
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "|zzO:ParserCreate", kwlist,
|
||||||
&encoding, &namespace_separator, &intern))
|
&encoding, &namespace_separator, &intern))
|
||||||
|
|
|
@ -624,7 +624,7 @@ PyDoc_STRVAR(SHA256_new__doc__,
|
||||||
static PyObject *
|
static PyObject *
|
||||||
SHA256_new(PyObject *self, PyObject *args, PyObject *kwdict)
|
SHA256_new(PyObject *self, PyObject *args, PyObject *kwdict)
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"string", NULL};
|
static const char *kwlist[] = {"string", NULL};
|
||||||
SHAobject *new;
|
SHAobject *new;
|
||||||
unsigned char *cp = NULL;
|
unsigned char *cp = NULL;
|
||||||
int len;
|
int len;
|
||||||
|
@ -655,7 +655,7 @@ PyDoc_STRVAR(SHA224_new__doc__,
|
||||||
static PyObject *
|
static PyObject *
|
||||||
SHA224_new(PyObject *self, PyObject *args, PyObject *kwdict)
|
SHA224_new(PyObject *self, PyObject *args, PyObject *kwdict)
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"string", NULL};
|
static const char *kwlist[] = {"string", NULL};
|
||||||
SHAobject *new;
|
SHAobject *new;
|
||||||
unsigned char *cp = NULL;
|
unsigned char *cp = NULL;
|
||||||
int len;
|
int len;
|
||||||
|
|
|
@ -690,7 +690,7 @@ PyDoc_STRVAR(SHA512_new__doc__,
|
||||||
static PyObject *
|
static PyObject *
|
||||||
SHA512_new(PyObject *self, PyObject *args, PyObject *kwdict)
|
SHA512_new(PyObject *self, PyObject *args, PyObject *kwdict)
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"string", NULL};
|
static const char *kwlist[] = {"string", NULL};
|
||||||
SHAobject *new;
|
SHAobject *new;
|
||||||
unsigned char *cp = NULL;
|
unsigned char *cp = NULL;
|
||||||
int len;
|
int len;
|
||||||
|
@ -721,7 +721,7 @@ PyDoc_STRVAR(SHA384_new__doc__,
|
||||||
static PyObject *
|
static PyObject *
|
||||||
SHA384_new(PyObject *self, PyObject *args, PyObject *kwdict)
|
SHA384_new(PyObject *self, PyObject *args, PyObject *kwdict)
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"string", NULL};
|
static const char *kwlist[] = {"string", NULL};
|
||||||
SHAobject *new;
|
SHAobject *new;
|
||||||
unsigned char *cp = NULL;
|
unsigned char *cp = NULL;
|
||||||
int len;
|
int len;
|
||||||
|
|
|
@ -2489,7 +2489,7 @@ sock_initobj(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
PySocketSockObject *s = (PySocketSockObject *)self;
|
PySocketSockObject *s = (PySocketSockObject *)self;
|
||||||
SOCKET_T fd;
|
SOCKET_T fd;
|
||||||
int family = AF_INET, type = SOCK_STREAM, proto = 0;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwds,
|
||||||
"|iii:socket", keywords,
|
"|iii:socket", keywords,
|
||||||
|
|
|
@ -50,7 +50,7 @@ PyObject *PyBool_FromLong(long ok)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bool_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
bool_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"x", 0};
|
static const char *kwlist[] = {"x", 0};
|
||||||
PyObject *x = Py_False;
|
PyObject *x = Py_False;
|
||||||
long ok;
|
long ok;
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ static PyObject *
|
||||||
class_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
class_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *name, *bases, *dict;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "SOO", kwlist,
|
||||||
&name, &bases, &dict))
|
&name, &bases, &dict))
|
||||||
|
|
|
@ -829,7 +829,7 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
Py_complex cr, ci;
|
Py_complex cr, ci;
|
||||||
int own_r = 0;
|
int own_r = 0;
|
||||||
static PyObject *complexstr;
|
static PyObject *complexstr;
|
||||||
static char *kwlist[] = {"real", "imag", 0};
|
static const char *kwlist[] = {"real", "imag", 0};
|
||||||
|
|
||||||
r = Py_False;
|
r = Py_False;
|
||||||
i = NULL;
|
i = NULL;
|
||||||
|
|
|
@ -579,7 +579,7 @@ PyTypeObject PyWrapperDescr_Type = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static PyDescrObject *
|
static PyDescrObject *
|
||||||
descr_new(PyTypeObject *descrtype, PyTypeObject *type, char *name)
|
descr_new(PyTypeObject *descrtype, PyTypeObject *type, const char *name)
|
||||||
{
|
{
|
||||||
PyDescrObject *descr;
|
PyDescrObject *descr;
|
||||||
|
|
||||||
|
@ -1182,7 +1182,7 @@ static int
|
||||||
property_init(PyObject *self, PyObject *args, PyObject *kwds)
|
property_init(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *get = NULL, *set = NULL, *del = NULL, *doc = NULL;
|
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;
|
propertyobject *gs = (propertyobject *)self;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOOO:property",
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOOO:property",
|
||||||
|
|
|
@ -16,7 +16,7 @@ enum_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
enumobject *en;
|
enumobject *en;
|
||||||
PyObject *seq = NULL;
|
PyObject *seq = NULL;
|
||||||
static char *kwlist[] = {"sequence", 0};
|
static const char *kwlist[] = {"sequence", 0};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:enumerate", kwlist,
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:enumerate", kwlist,
|
||||||
&seq))
|
&seq))
|
||||||
|
|
|
@ -1884,7 +1884,7 @@ file_init(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyFileObject *foself = (PyFileObject *)self;
|
PyFileObject *foself = (PyFileObject *)self;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
static char *kwlist[] = {"name", "mode", "buffering", 0};
|
static const char *kwlist[] = {"name", "mode", "buffering", 0};
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
char *mode = "r";
|
char *mode = "r";
|
||||||
int bufsize = -1;
|
int bufsize = -1;
|
||||||
|
@ -1926,8 +1926,9 @@ file_init(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* We parse again to get the name as a PyObject */
|
/* We parse again to get the name as a PyObject */
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|si:file", kwlist,
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|si:file",
|
||||||
&o_name, &mode, &bufsize))
|
kwlist, &o_name, &mode,
|
||||||
|
&bufsize))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (fill_file_fields(foself, NULL, o_name, mode,
|
if (fill_file_fields(foself, NULL, o_name, mode,
|
||||||
|
|
|
@ -941,7 +941,7 @@ static PyObject *
|
||||||
float_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
float_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *x = Py_False; /* Integer zero */
|
PyObject *x = Py_False; /* Integer zero */
|
||||||
static char *kwlist[] = {"x", 0};
|
static const char *kwlist[] = {"x", 0};
|
||||||
|
|
||||||
if (type != &PyFloat_Type)
|
if (type != &PyFloat_Type)
|
||||||
return float_subtype_new(type, args, kwds); /* Wimp out */
|
return float_subtype_new(type, args, kwds); /* Wimp out */
|
||||||
|
|
|
@ -364,7 +364,7 @@ func_new(PyTypeObject* type, PyObject* args, PyObject* kw)
|
||||||
PyObject *closure = Py_None;
|
PyObject *closure = Py_None;
|
||||||
PyFunctionObject *newfunc;
|
PyFunctionObject *newfunc;
|
||||||
int nfree, nclosure;
|
int nfree, nclosure;
|
||||||
static char *kwlist[] = {"code", "globals", "name",
|
static const char *kwlist[] = {"code", "globals", "name",
|
||||||
"argdefs", "closure", 0};
|
"argdefs", "closure", 0};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "O!O!|OOO:function",
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "O!O!|OOO:function",
|
||||||
|
|
|
@ -879,7 +879,7 @@ int_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *x = NULL;
|
PyObject *x = NULL;
|
||||||
int base = -909;
|
int base = -909;
|
||||||
static char *kwlist[] = {"x", "base", 0};
|
static const char *kwlist[] = {"x", "base", 0};
|
||||||
|
|
||||||
if (type != &PyInt_Type)
|
if (type != &PyInt_Type)
|
||||||
return int_subtype_new(type, args, kwds); /* Wimp out */
|
return int_subtype_new(type, args, kwds); /* Wimp out */
|
||||||
|
|
|
@ -1983,7 +1983,7 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
|
||||||
PyObject *keyfunc = NULL;
|
PyObject *keyfunc = NULL;
|
||||||
int i;
|
int i;
|
||||||
PyObject *key, *value, *kvpair;
|
PyObject *key, *value, *kvpair;
|
||||||
static char *kwlist[] = {"cmp", "key", "reverse", 0};
|
static const char *kwlist[] = {"cmp", "key", "reverse", 0};
|
||||||
|
|
||||||
assert(self != NULL);
|
assert(self != NULL);
|
||||||
assert (PyList_Check(self));
|
assert (PyList_Check(self));
|
||||||
|
@ -2357,7 +2357,7 @@ static int
|
||||||
list_init(PyListObject *self, PyObject *args, PyObject *kw)
|
list_init(PyListObject *self, PyObject *args, PyObject *kw)
|
||||||
{
|
{
|
||||||
PyObject *arg = NULL;
|
PyObject *arg = NULL;
|
||||||
static char *kwlist[] = {"sequence", 0};
|
static const char *kwlist[] = {"sequence", 0};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:list", kwlist, &arg))
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:list", kwlist, &arg))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
/* Long (arbitrary precision) integer object implementation */
|
/* Long (arbitrary precision) integer object implementation */
|
||||||
|
|
||||||
/* XXX The functional organization of this file is terrible */
|
/* XXX The functional organization of this file is terrible */
|
||||||
|
@ -2922,7 +2923,7 @@ long_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *x = NULL;
|
PyObject *x = NULL;
|
||||||
int base = -909; /* unlikely! */
|
int base = -909; /* unlikely! */
|
||||||
static char *kwlist[] = {"x", "base", 0};
|
static const char *kwlist[] = {"x", "base", 0};
|
||||||
|
|
||||||
if (type != &PyLong_Type)
|
if (type != &PyLong_Type)
|
||||||
return long_subtype_new(type, args, kwds); /* Wimp out */
|
return long_subtype_new(type, args, kwds); /* Wimp out */
|
||||||
|
|
|
@ -132,7 +132,7 @@ meth_dealloc(PyCFunctionObject *m)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
meth_get__doc__(PyCFunctionObject *m, void *closure)
|
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)
|
if (doc != NULL)
|
||||||
return PyString_FromString(doc);
|
return PyString_FromString(doc);
|
||||||
|
@ -311,13 +311,13 @@ listmethodchain(PyMethodChain *chain)
|
||||||
/* Find a method in a method chain */
|
/* Find a method in a method chain */
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
Py_FindMethodInChain(PyMethodChain *chain, PyObject *self, char *name)
|
Py_FindMethodInChain(PyMethodChain *chain, PyObject *self, const char *name)
|
||||||
{
|
{
|
||||||
if (name[0] == '_' && name[1] == '_') {
|
if (name[0] == '_' && name[1] == '_') {
|
||||||
if (strcmp(name, "__methods__") == 0)
|
if (strcmp(name, "__methods__") == 0)
|
||||||
return listmethodchain(chain);
|
return listmethodchain(chain);
|
||||||
if (strcmp(name, "__doc__") == 0) {
|
if (strcmp(name, "__doc__") == 0) {
|
||||||
char *doc = self->ob_type->tp_doc;
|
const char *doc = self->ob_type->tp_doc;
|
||||||
if (doc != NULL)
|
if (doc != NULL)
|
||||||
return PyString_FromString(doc);
|
return PyString_FromString(doc);
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ Py_FindMethodInChain(PyMethodChain *chain, PyObject *self, char *name)
|
||||||
/* Find a method in a single method list */
|
/* Find a method in a single method list */
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
Py_FindMethod(PyMethodDef *methods, PyObject *self, char *name)
|
Py_FindMethod(PyMethodDef *methods, PyObject *self, const char *name)
|
||||||
{
|
{
|
||||||
PyMethodChain chain;
|
PyMethodChain chain;
|
||||||
chain.methods = methods;
|
chain.methods = methods;
|
||||||
|
|
|
@ -15,7 +15,7 @@ static PyMemberDef module_members[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyModule_New(char *name)
|
PyModule_New(const char *name)
|
||||||
{
|
{
|
||||||
PyModuleObject *m;
|
PyModuleObject *m;
|
||||||
PyObject *nameobj;
|
PyObject *nameobj;
|
||||||
|
@ -149,10 +149,10 @@ _PyModule_Clear(PyObject *m)
|
||||||
static int
|
static int
|
||||||
module_init(PyModuleObject *m, PyObject *args, PyObject *kwds)
|
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;
|
PyObject *dict, *name = Py_None, *doc = Py_None;
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "S|O:module.__init__", kwlist,
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "S|O:module.__init__",
|
||||||
&name, &doc))
|
kwlist, &name, &doc))
|
||||||
return -1;
|
return -1;
|
||||||
dict = m->md_dict;
|
dict = m->md_dict;
|
||||||
if (dict == NULL) {
|
if (dict == NULL) {
|
||||||
|
|
|
@ -663,7 +663,7 @@ static int
|
||||||
default_3way_compare(PyObject *v, PyObject *w)
|
default_3way_compare(PyObject *v, PyObject *w)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
char *vname, *wname;
|
const char *vname, *wname;
|
||||||
|
|
||||||
if (v->ob_type == w->ob_type) {
|
if (v->ob_type == w->ob_type) {
|
||||||
/* When comparing these pointers, they must be cast to
|
/* When comparing these pointers, they must be cast to
|
||||||
|
@ -1018,7 +1018,7 @@ PyObject_Hash(PyObject *v)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyObject_GetAttrString(PyObject *v, char *name)
|
PyObject_GetAttrString(PyObject *v, const char *name)
|
||||||
{
|
{
|
||||||
PyObject *w, *res;
|
PyObject *w, *res;
|
||||||
|
|
||||||
|
@ -1033,7 +1033,7 @@ PyObject_GetAttrString(PyObject *v, char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PyObject_HasAttrString(PyObject *v, char *name)
|
PyObject_HasAttrString(PyObject *v, const char *name)
|
||||||
{
|
{
|
||||||
PyObject *res = PyObject_GetAttrString(v, name);
|
PyObject *res = PyObject_GetAttrString(v, name);
|
||||||
if (res != NULL) {
|
if (res != NULL) {
|
||||||
|
@ -1045,7 +1045,7 @@ PyObject_HasAttrString(PyObject *v, char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PyObject_SetAttrString(PyObject *v, char *name, PyObject *w)
|
PyObject_SetAttrString(PyObject *v, const char *name, PyObject *w)
|
||||||
{
|
{
|
||||||
PyObject *s;
|
PyObject *s;
|
||||||
int res;
|
int res;
|
||||||
|
@ -1589,7 +1589,7 @@ merge_class_dict(PyObject* dict, PyObject* aclass)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
merge_list_attr(PyObject* dict, PyObject* obj, char *attrname)
|
merge_list_attr(PyObject* dict, PyObject* obj, const char *attrname)
|
||||||
{
|
{
|
||||||
PyObject *list;
|
PyObject *list;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
|
@ -3325,7 +3325,7 @@ static PyObject *
|
||||||
string_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
string_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *x = NULL;
|
PyObject *x = NULL;
|
||||||
static char *kwlist[] = {"object", 0};
|
static const char *kwlist[] = {"object", 0};
|
||||||
|
|
||||||
if (type != &PyString_Type)
|
if (type != &PyString_Type)
|
||||||
return str_subtype_new(type, args, kwds);
|
return str_subtype_new(type, args, kwds);
|
||||||
|
|
|
@ -97,7 +97,7 @@ structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
PyObject *ob;
|
PyObject *ob;
|
||||||
PyStructSequence *res = NULL;
|
PyStructSequence *res = NULL;
|
||||||
int len, min_len, max_len, i, n_unnamed_fields;
|
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",
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:structseq",
|
||||||
kwlist, &arg, &dict))
|
kwlist, &arg, &dict))
|
||||||
|
|
|
@ -528,7 +528,7 @@ static PyObject *
|
||||||
tuple_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
tuple_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *arg = NULL;
|
PyObject *arg = NULL;
|
||||||
static char *kwlist[] = {"sequence", 0};
|
static const char *kwlist[] = {"sequence", 0};
|
||||||
|
|
||||||
if (type != &PyTuple_Type)
|
if (type != &PyTuple_Type)
|
||||||
return tuple_subtype_new(type, args, kwds);
|
return tuple_subtype_new(type, args, kwds);
|
||||||
|
|
|
@ -21,7 +21,7 @@ static PyMemberDef type_members[] = {
|
||||||
static PyObject *
|
static PyObject *
|
||||||
type_name(PyTypeObject *type, void *context)
|
type_name(PyTypeObject *type, void *context)
|
||||||
{
|
{
|
||||||
char *s;
|
const char *s;
|
||||||
|
|
||||||
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
||||||
PyHeapTypeObject* et = (PyHeapTypeObject*)type;
|
PyHeapTypeObject* et = (PyHeapTypeObject*)type;
|
||||||
|
@ -1556,7 +1556,7 @@ static PyObject *
|
||||||
type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *name, *bases, *dict;
|
PyObject *name, *bases, *dict;
|
||||||
static char *kwlist[] = {"name", "bases", "dict", 0};
|
static const char *kwlist[] = {"name", "bases", "dict", 0};
|
||||||
PyObject *slots, *tmp, *newslots;
|
PyObject *slots, *tmp, *newslots;
|
||||||
PyTypeObject *type, *base, *tmptype, *winner;
|
PyTypeObject *type, *base, *tmptype, *winner;
|
||||||
PyHeapTypeObject *et;
|
PyHeapTypeObject *et;
|
||||||
|
@ -1856,12 +1856,13 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
||||||
PyObject *doc = PyDict_GetItemString(dict, "__doc__");
|
PyObject *doc = PyDict_GetItemString(dict, "__doc__");
|
||||||
if (doc != NULL && PyString_Check(doc)) {
|
if (doc != NULL && PyString_Check(doc)) {
|
||||||
const size_t n = (size_t)PyString_GET_SIZE(doc);
|
const size_t n = (size_t)PyString_GET_SIZE(doc);
|
||||||
type->tp_doc = (char *)PyObject_MALLOC(n+1);
|
char *tp_doc = PyObject_MALLOC(n+1);
|
||||||
if (type->tp_doc == NULL) {
|
if (tp_doc == NULL) {
|
||||||
Py_DECREF(type);
|
Py_DECREF(type);
|
||||||
return NULL;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2105,7 +2106,10 @@ type_dealloc(PyTypeObject *type)
|
||||||
Py_XDECREF(type->tp_mro);
|
Py_XDECREF(type->tp_mro);
|
||||||
Py_XDECREF(type->tp_cache);
|
Py_XDECREF(type->tp_cache);
|
||||||
Py_XDECREF(type->tp_subclasses);
|
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->name);
|
||||||
Py_XDECREF(et->slots);
|
Py_XDECREF(et->slots);
|
||||||
type->ob_type->tp_free((PyObject *)type);
|
type->ob_type->tp_free((PyObject *)type);
|
||||||
|
|
|
@ -7238,7 +7238,7 @@ static PyObject *
|
||||||
unicode_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
unicode_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *x = NULL;
|
PyObject *x = NULL;
|
||||||
static char *kwlist[] = {"string", "encoding", "errors", 0};
|
static const char *kwlist[] = {"string", "encoding", "errors", 0};
|
||||||
char *encoding = NULL;
|
char *encoding = NULL;
|
||||||
char *errors = NULL;
|
char *errors = NULL;
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ gc_clear(PyWeakReference *self)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
weakref_call(PyWeakReference *self, PyObject *args, PyObject *kw)
|
weakref_call(PyWeakReference *self, PyObject *args, PyObject *kw)
|
||||||
{
|
{
|
||||||
static char *argnames[] = {NULL};
|
static const char *argnames[] = {NULL};
|
||||||
|
|
||||||
if (PyArg_ParseTupleAndKeywords(args, kw, ":__call__", argnames)) {
|
if (PyArg_ParseTupleAndKeywords(args, kw, ":__call__", argnames)) {
|
||||||
PyObject *object = PyWeakref_GET_OBJECT(self);
|
PyObject *object = PyWeakref_GET_OBJECT(self);
|
||||||
|
|
|
@ -1907,7 +1907,7 @@ builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *newlist, *v, *seq, *compare=NULL, *keyfunc=NULL, *newargs;
|
PyObject *newlist, *v, *seq, *compare=NULL, *keyfunc=NULL, *newargs;
|
||||||
PyObject *callable;
|
PyObject *callable;
|
||||||
static char *kwlist[] = {"iterable", "cmp", "key", "reverse", 0};
|
static const char *kwlist[] = {"iterable", "cmp", "key", "reverse", 0};
|
||||||
long reverse;
|
long reverse;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOi:sorted",
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOi:sorted",
|
||||||
|
|
|
@ -3434,7 +3434,7 @@ PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
PyEval_GetFuncName(PyObject *func)
|
PyEval_GetFuncName(PyObject *func)
|
||||||
{
|
{
|
||||||
if (PyMethod_Check(func))
|
if (PyMethod_Check(func))
|
||||||
|
@ -3453,7 +3453,7 @@ PyEval_GetFuncName(PyObject *func)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
PyEval_GetFuncDesc(PyObject *func)
|
PyEval_GetFuncDesc(PyObject *func)
|
||||||
{
|
{
|
||||||
if (PyMethod_Check(func))
|
if (PyMethod_Check(func))
|
||||||
|
|
|
@ -6,33 +6,33 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
||||||
int PyArg_Parse(PyObject *, char *, ...);
|
int PyArg_Parse(PyObject *, const char *, ...);
|
||||||
int PyArg_ParseTuple(PyObject *, char *, ...);
|
int PyArg_ParseTuple(PyObject *, const char *, ...);
|
||||||
int PyArg_VaParse(PyObject *, char *, va_list);
|
int PyArg_VaParse(PyObject *, const char *, va_list);
|
||||||
|
|
||||||
int PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
|
int PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
|
||||||
char *, char **, ...);
|
const char *, const char **, ...);
|
||||||
int PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
|
int PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
|
||||||
char *, char **, va_list);
|
const char *, const char **, va_list);
|
||||||
|
|
||||||
|
|
||||||
/* Forward */
|
/* Forward */
|
||||||
static int vgetargs1(PyObject *, char *, va_list *, int);
|
static int vgetargs1(PyObject *, const char *, va_list *, int);
|
||||||
static void seterror(int, char *, int *, char *, char *);
|
static void seterror(int, const char *, int *, const char *, const char *);
|
||||||
static char *convertitem(PyObject *, char **, va_list *, int *, char *,
|
static char *convertitem(PyObject *, const char **, va_list *, int *, char *,
|
||||||
size_t, PyObject **);
|
size_t, PyObject **);
|
||||||
static char *converttuple(PyObject *, char **, va_list *,
|
static char *converttuple(PyObject *, const char **, va_list *,
|
||||||
int *, char *, size_t, int, PyObject **);
|
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 **);
|
size_t, PyObject **);
|
||||||
static int convertbuffer(PyObject *, void **p, char **);
|
static int convertbuffer(PyObject *, void **p, char **);
|
||||||
|
|
||||||
static int vgetargskeywords(PyObject *, PyObject *,
|
static int vgetargskeywords(PyObject *, PyObject *,
|
||||||
char *, char **, va_list *);
|
const char *, const char **, va_list *);
|
||||||
static char *skipitem(char **, va_list *);
|
static char *skipitem(const char **, va_list *);
|
||||||
|
|
||||||
int
|
int
|
||||||
PyArg_Parse(PyObject *args, char *format, ...)
|
PyArg_Parse(PyObject *args, const char *format, ...)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
va_list va;
|
va_list va;
|
||||||
|
@ -45,7 +45,7 @@ PyArg_Parse(PyObject *args, char *format, ...)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PyArg_ParseTuple(PyObject *args, char *format, ...)
|
PyArg_ParseTuple(PyObject *args, const char *format, ...)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
va_list va;
|
va_list va;
|
||||||
|
@ -58,7 +58,7 @@ PyArg_ParseTuple(PyObject *args, char *format, ...)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PyArg_VaParse(PyObject *args, char *format, va_list va)
|
PyArg_VaParse(PyObject *args, const char *format, va_list va)
|
||||||
{
|
{
|
||||||
va_list lva;
|
va_list lva;
|
||||||
|
|
||||||
|
@ -120,17 +120,17 @@ cleanreturn(int retval, PyObject *freelist)
|
||||||
|
|
||||||
|
|
||||||
static int
|
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];
|
char msgbuf[256];
|
||||||
int levels[32];
|
int levels[32];
|
||||||
char *fname = NULL;
|
const char *fname = NULL;
|
||||||
char *message = NULL;
|
const char *message = NULL;
|
||||||
int min = -1;
|
int min = -1;
|
||||||
int max = 0;
|
int max = 0;
|
||||||
int level = 0;
|
int level = 0;
|
||||||
int endfmt = 0;
|
int endfmt = 0;
|
||||||
char *formatsave = format;
|
const char *formatsave = format;
|
||||||
int i, len;
|
int i, len;
|
||||||
char *msg;
|
char *msg;
|
||||||
PyObject *freelist = NULL;
|
PyObject *freelist = NULL;
|
||||||
|
@ -269,7 +269,8 @@ vgetargs1(PyObject *args, char *format, va_list *p_va, int compat)
|
||||||
|
|
||||||
|
|
||||||
static void
|
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];
|
char buf[512];
|
||||||
int i;
|
int i;
|
||||||
|
@ -324,12 +325,12 @@ seterror(int iarg, char *msg, int *levels, char *fname, char *message)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *
|
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)
|
char *msgbuf, size_t bufsize, int toplevel, PyObject **freelist)
|
||||||
{
|
{
|
||||||
int level = 0;
|
int level = 0;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
char *format = *p_format;
|
const char *format = *p_format;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -392,11 +393,11 @@ converttuple(PyObject *arg, char **p_format, va_list *p_va, int *levels,
|
||||||
/* Convert a single item. */
|
/* Convert a single item. */
|
||||||
|
|
||||||
static char *
|
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 *msgbuf, size_t bufsize, PyObject **freelist)
|
||||||
{
|
{
|
||||||
char *msg;
|
char *msg;
|
||||||
char *format = *p_format;
|
const char *format = *p_format;
|
||||||
|
|
||||||
if (*format == '(' /* ')' */) {
|
if (*format == '(' /* ')' */) {
|
||||||
format++;
|
format++;
|
||||||
|
@ -424,7 +425,7 @@ convertitem(PyObject *arg, char **p_format, va_list *p_va, int *levels,
|
||||||
/* Format an error message generated by convertsimple(). */
|
/* Format an error message generated by convertsimple(). */
|
||||||
|
|
||||||
static char *
|
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(expected != NULL);
|
||||||
assert(arg != NULL);
|
assert(arg != NULL);
|
||||||
|
@ -459,10 +460,10 @@ float_argument_error(PyObject *arg)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
convertsimple(PyObject *arg, char **p_format, va_list *p_va, char *msgbuf,
|
convertsimple(PyObject *arg, const char **p_format, va_list *p_va,
|
||||||
size_t bufsize, PyObject **freelist)
|
char *msgbuf, size_t bufsize, PyObject **freelist)
|
||||||
{
|
{
|
||||||
char *format = *p_format;
|
const char *format = *p_format;
|
||||||
char c = *format++;
|
char c = *format++;
|
||||||
#ifdef Py_USING_UNICODE
|
#ifdef Py_USING_UNICODE
|
||||||
PyObject *uarg;
|
PyObject *uarg;
|
||||||
|
@ -1134,8 +1135,8 @@ convertbuffer(PyObject *arg, void **p, char **errmsg)
|
||||||
int
|
int
|
||||||
PyArg_ParseTupleAndKeywords(PyObject *args,
|
PyArg_ParseTupleAndKeywords(PyObject *args,
|
||||||
PyObject *keywords,
|
PyObject *keywords,
|
||||||
char *format,
|
const char *format,
|
||||||
char **kwlist, ...)
|
const char **kwlist, ...)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
va_list va;
|
va_list va;
|
||||||
|
@ -1158,9 +1159,9 @@ PyArg_ParseTupleAndKeywords(PyObject *args,
|
||||||
|
|
||||||
int
|
int
|
||||||
PyArg_VaParseTupleAndKeywords(PyObject *args,
|
PyArg_VaParseTupleAndKeywords(PyObject *args,
|
||||||
PyObject *keywords,
|
PyObject *keywords,
|
||||||
char *format,
|
const char *format,
|
||||||
char **kwlist, va_list va)
|
const char **kwlist, va_list va)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
va_list lva;
|
va_list lva;
|
||||||
|
@ -1190,16 +1191,16 @@ PyArg_VaParseTupleAndKeywords(PyObject *args,
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
|
vgetargskeywords(PyObject *args, PyObject *keywords, const char *format,
|
||||||
char **kwlist, va_list *p_va)
|
const char **kwlist, va_list *p_va)
|
||||||
{
|
{
|
||||||
char msgbuf[512];
|
char msgbuf[512];
|
||||||
int levels[32];
|
int levels[32];
|
||||||
char *fname, *message;
|
const char *fname, *message;
|
||||||
int min, max;
|
int min, max;
|
||||||
char *formatsave;
|
const char *formatsave;
|
||||||
int i, len, nargs, nkeywords;
|
int i, len, nargs, nkeywords;
|
||||||
char *msg, **p;
|
const char *msg, **p;
|
||||||
PyObject *freelist = NULL;
|
PyObject *freelist = NULL;
|
||||||
|
|
||||||
assert(args != NULL && PyTuple_Check(args));
|
assert(args != NULL && PyTuple_Check(args));
|
||||||
|
@ -1269,7 +1270,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
|
||||||
keyword parameter in messages */
|
keyword parameter in messages */
|
||||||
if (nkeywords > 0) {
|
if (nkeywords > 0) {
|
||||||
for (i = 0; i < nargs; i++) {
|
for (i = 0; i < nargs; i++) {
|
||||||
char *thiskw = kwlist[i];
|
const char *thiskw = kwlist[i];
|
||||||
if (thiskw == NULL)
|
if (thiskw == NULL)
|
||||||
break;
|
break;
|
||||||
if (PyDict_GetItemString(keywords, thiskw)) {
|
if (PyDict_GetItemString(keywords, thiskw)) {
|
||||||
|
@ -1402,9 +1403,9 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
|
||||||
|
|
||||||
|
|
||||||
static char *
|
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++;
|
char c = *format++;
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
@ -1518,7 +1519,7 @@ err:
|
||||||
|
|
||||||
|
|
||||||
int
|
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;
|
int i, l;
|
||||||
PyObject **o;
|
PyObject **o;
|
||||||
|
@ -1583,7 +1584,7 @@ PyArg_UnpackTuple(PyObject *args, char *name, int min, int max, ...)
|
||||||
* not emtpy, returns 1 otherwise
|
* not emtpy, returns 1 otherwise
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
_PyArg_NoKeywords(char *funcname, PyObject *kw)
|
_PyArg_NoKeywords(const char *funcname, PyObject *kw)
|
||||||
{
|
{
|
||||||
if (kw == NULL)
|
if (kw == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1598,6 +1599,3 @@ _PyArg_NoKeywords(char *funcname, PyObject *kw)
|
||||||
funcname);
|
funcname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -555,7 +555,7 @@ _PyImport_FindExtension(char *name, char *filename)
|
||||||
'NEW' REFERENCE! */
|
'NEW' REFERENCE! */
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyImport_AddModule(char *name)
|
PyImport_AddModule(const char *name)
|
||||||
{
|
{
|
||||||
PyObject *modules = PyImport_GetModuleDict();
|
PyObject *modules = PyImport_GetModuleDict();
|
||||||
PyObject *m;
|
PyObject *m;
|
||||||
|
@ -1875,7 +1875,7 @@ PyImport_ImportFrozenModule(char *name)
|
||||||
its module object WITH INCREMENTED REFERENCE COUNT */
|
its module object WITH INCREMENTED REFERENCE COUNT */
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyImport_ImportModule(char *name)
|
PyImport_ImportModule(const char *name)
|
||||||
{
|
{
|
||||||
PyObject *pname;
|
PyObject *pname;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
|
@ -26,7 +26,7 @@ static char api_version_warning[] =
|
||||||
This Python has API version %d, module %.100s has version %d.";
|
This Python has API version %d, module %.100s has version %d.";
|
||||||
|
|
||||||
PyObject *
|
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 *passthrough, int module_api_version)
|
||||||
{
|
{
|
||||||
PyObject *m, *d, *v, *n;
|
PyObject *m, *d, *v, *n;
|
||||||
|
@ -99,7 +99,7 @@ Py_InitModule4(char *name, PyMethodDef *methods, char *doc,
|
||||||
/* Helper for mkvalue() to scan the length of a format */
|
/* Helper for mkvalue() to scan the length of a format */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
countformat(char *format, int endchar)
|
countformat(const char *format, int endchar)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int level = 0;
|
int level = 0;
|
||||||
|
@ -142,14 +142,14 @@ countformat(char *format, int endchar)
|
||||||
/* Generic function to create a value -- the inverse of getargs() */
|
/* Generic function to create a value -- the inverse of getargs() */
|
||||||
/* After an original idea and first implementation by Steven Miale */
|
/* After an original idea and first implementation by Steven Miale */
|
||||||
|
|
||||||
static PyObject *do_mktuple(char**, va_list *, int, int);
|
static PyObject *do_mktuple(const char**, va_list *, int, int);
|
||||||
static PyObject *do_mklist(char**, va_list *, int, int);
|
static PyObject *do_mklist(const char**, va_list *, int, int);
|
||||||
static PyObject *do_mkdict(char**, va_list *, int, int);
|
static PyObject *do_mkdict(const char**, va_list *, int, int);
|
||||||
static PyObject *do_mkvalue(char**, va_list *);
|
static PyObject *do_mkvalue(const char**, va_list *);
|
||||||
|
|
||||||
|
|
||||||
static PyObject *
|
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;
|
PyObject *d;
|
||||||
int i;
|
int i;
|
||||||
|
@ -195,7 +195,7 @@ do_mkdict(char **p_format, va_list *p_va, int endchar, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
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;
|
PyObject *v;
|
||||||
int i;
|
int i;
|
||||||
|
@ -242,7 +242,7 @@ _ustrlen(Py_UNICODE *u)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static PyObject *
|
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;
|
PyObject *v;
|
||||||
int i;
|
int i;
|
||||||
|
@ -278,7 +278,7 @@ do_mktuple(char **p_format, va_list *p_va, int endchar, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
do_mkvalue(char **p_format, va_list *p_va)
|
do_mkvalue(const char **p_format, va_list *p_va)
|
||||||
{
|
{
|
||||||
for (;;) {
|
for (;;) {
|
||||||
switch (*(*p_format)++) {
|
switch (*(*p_format)++) {
|
||||||
|
@ -454,7 +454,7 @@ do_mkvalue(char **p_format, va_list *p_va)
|
||||||
|
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
Py_BuildValue(char *format, ...)
|
Py_BuildValue(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
PyObject* retval;
|
PyObject* retval;
|
||||||
|
@ -465,9 +465,9 @@ Py_BuildValue(char *format, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
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');
|
int n = countformat(f, '\0');
|
||||||
va_list lva;
|
va_list lva;
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ Py_VaBuildValue(char *format, va_list va)
|
||||||
|
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyEval_CallFunction(PyObject *obj, char *format, ...)
|
PyEval_CallFunction(PyObject *obj, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list vargs;
|
va_list vargs;
|
||||||
PyObject *args;
|
PyObject *args;
|
||||||
|
@ -516,7 +516,7 @@ PyEval_CallFunction(PyObject *obj, char *format, ...)
|
||||||
|
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyEval_CallMethod(PyObject *obj, char *methodname, char *format, ...)
|
PyEval_CallMethod(PyObject *obj, const char *methodname, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list vargs;
|
va_list vargs;
|
||||||
PyObject *meth;
|
PyObject *meth;
|
||||||
|
@ -545,7 +545,7 @@ PyEval_CallMethod(PyObject *obj, char *methodname, char *format, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
|
PyModule_AddObject(PyObject *m, const char *name, PyObject *o)
|
||||||
{
|
{
|
||||||
PyObject *dict;
|
PyObject *dict;
|
||||||
if (!PyModule_Check(m)) {
|
if (!PyModule_Check(m)) {
|
||||||
|
@ -574,13 +574,13 @@ PyModule_AddObject(PyObject *m, char *name, PyObject *o)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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));
|
return PyModule_AddObject(m, name, PyInt_FromLong(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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));
|
return PyModule_AddObject(m, name, PyString_FromString(value));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue