/libs/python/patches/const-methods.patch
https://github.com/gdw2/pycorn · Patch · 206 lines · 177 code · 29 blank · 0 comment · 0 complexity · ade5cbf98a8f34807d630ae53a9b4e71 MD5 · raw file
- Index: Python-2.5.5/Include/methodobject.h
- ===================================================================
- --- Python-2.5.5.orig/Include/methodobject.h 2010-04-26 23:36:53.374633085 +0100
- +++ Python-2.5.5/Include/methodobject.h 2010-04-26 23:37:11.095741063 +0100
- @@ -46,7 +46,7 @@
- PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *);
-
- #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
- -PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
- +PyAPI_FUNC(PyObject *) PyCFunction_NewEx(const PyMethodDef *, PyObject *,
- PyObject *);
-
- /* Flag passed to newmethodobject */
- @@ -80,7 +80,7 @@
-
- typedef struct {
- PyObject_HEAD
- - PyMethodDef *m_ml; /* Description of the C function to call */
- + const PyMethodDef *m_ml; /* Description of the C function to call */
- PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */
- PyObject *m_module; /* The __module__ attribute, can be anything */
- } PyCFunctionObject;
- Index: Python-2.5.5/Include/modsupport.h
- ===================================================================
- --- Python-2.5.5.orig/Include/modsupport.h 2010-04-26 23:36:53.390634754 +0100
- +++ Python-2.5.5/Include/modsupport.h 2010-04-26 23:37:11.103738267 +0100
- @@ -113,7 +113,8 @@
- #endif
- #endif
-
- -PyAPI_FUNC(PyObject *) Py_InitModule4(const char *name, PyMethodDef *methods,
- +PyAPI_FUNC(PyObject *) Py_InitModule4(const char *name,
- + const PyMethodDef *methods,
- const char *doc, PyObject *self,
- int apiver);
-
- Index: Python-2.5.5/Objects/methodobject.c
- ===================================================================
- --- Python-2.5.5.orig/Objects/methodobject.c 2010-04-26 23:36:53.486641844 +0100
- +++ Python-2.5.5/Objects/methodobject.c 2010-04-26 23:37:11.103738267 +0100
- @@ -7,7 +7,7 @@
- static PyCFunctionObject *free_list = NULL;
-
- PyObject *
- -PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)
- +PyCFunction_NewEx(const PyMethodDef *ml, PyObject *self, PyObject *module)
- {
- PyCFunctionObject *op;
- op = free_list;
- Index: Python-2.5.5/Python/modsupport.c
- ===================================================================
- --- Python-2.5.5.orig/Python/modsupport.c 2010-04-26 23:36:53.470641589 +0100
- +++ Python-2.5.5/Python/modsupport.c 2010-04-26 23:37:11.103738267 +0100
- @@ -29,11 +29,11 @@
- This Python has API version %d, module %.100s has version %d.";
-
- PyObject *
- -Py_InitModule4(const char *name, PyMethodDef *methods, const char *doc,
- +Py_InitModule4(const char *name, const PyMethodDef *methods, const char *doc,
- PyObject *passthrough, int module_api_version)
- {
- PyObject *m, *d, *v, *n;
- - PyMethodDef *ml;
- + const PyMethodDef *ml;
- if (!Py_IsInitialized())
- Py_FatalError("Interpreter not initialized (version mismatch?)");
- if (module_api_version != PYTHON_API_VERSION) {
- Index: Python-2.5.5/Include/descrobject.h
- ===================================================================
- --- Python-2.5.5.orig/Include/descrobject.h 2010-04-26 23:36:53.438638816 +0100
- +++ Python-2.5.5/Include/descrobject.h 2010-04-26 23:37:11.124552248 +0100
- @@ -48,12 +48,12 @@
-
- typedef struct {
- PyDescr_COMMON;
- - PyMethodDef *d_method;
- + const PyMethodDef *d_method;
- } PyMethodDescrObject;
-
- typedef struct {
- PyDescr_COMMON;
- - struct PyMemberDef *d_member;
- + const struct PyMemberDef *d_member;
- } PyMemberDescrObject;
-
- typedef struct {
- @@ -69,10 +69,11 @@
-
- PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
-
- -PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
- -PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
- +PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, const PyMethodDef *);
- +PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *,
- + const PyMethodDef *);
- PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
- - struct PyMemberDef *);
- + const struct PyMemberDef *);
- PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
- struct PyGetSetDef *);
- PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
- Index: Python-2.5.5/Include/object.h
- ===================================================================
- --- Python-2.5.5.orig/Include/object.h 2010-04-26 23:36:53.422635629 +0100
- +++ Python-2.5.5/Include/object.h 2010-04-26 23:37:11.124552248 +0100
- @@ -314,8 +314,8 @@
- iternextfunc tp_iternext;
-
- /* Attribute descriptor and subclassing stuff */
- - struct PyMethodDef *tp_methods;
- - struct PyMemberDef *tp_members;
- + const struct PyMethodDef *tp_methods;
- + const struct PyMemberDef *tp_members;
- struct PyGetSetDef *tp_getset;
- struct _typeobject *tp_base;
- PyObject *tp_dict;
- Index: Python-2.5.5/Include/structmember.h
- ===================================================================
- --- Python-2.5.5.orig/Include/structmember.h 2010-04-26 23:36:53.402636104 +0100
- +++ Python-2.5.5/Include/structmember.h 2010-04-26 23:37:11.124552248 +0100
- @@ -83,8 +83,8 @@
- PyAPI_FUNC(int) PyMember_Set(char *, struct memberlist *, const char *, PyObject *);
-
- /* Current API, use this */
- -PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *);
- -PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *);
- +PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, const struct PyMemberDef *);
- +PyAPI_FUNC(int) PyMember_SetOne(char *, const struct PyMemberDef *, PyObject *);
-
-
- #ifdef __cplusplus
- Index: Python-2.5.5/Objects/descrobject.c
- ===================================================================
- --- Python-2.5.5.orig/Objects/descrobject.c 2010-04-26 23:36:53.502642858 +0100
- +++ Python-2.5.5/Objects/descrobject.c 2010-04-26 23:37:11.124552248 +0100
- @@ -591,7 +591,7 @@
- }
-
- PyObject *
- -PyDescr_NewMethod(PyTypeObject *type, PyMethodDef *method)
- +PyDescr_NewMethod(PyTypeObject *type, const PyMethodDef *method)
- {
- PyMethodDescrObject *descr;
-
- @@ -603,7 +603,7 @@
- }
-
- PyObject *
- -PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method)
- +PyDescr_NewClassMethod(PyTypeObject *type, const PyMethodDef *method)
- {
- PyMethodDescrObject *descr;
-
- @@ -615,7 +615,7 @@
- }
-
- PyObject *
- -PyDescr_NewMember(PyTypeObject *type, PyMemberDef *member)
- +PyDescr_NewMember(PyTypeObject *type, const PyMemberDef *member)
- {
- PyMemberDescrObject *descr;
-
- Index: Python-2.5.5/Objects/typeobject.c
- ===================================================================
- --- Python-2.5.5.orig/Objects/typeobject.c 2010-04-26 23:36:53.522643557 +0100
- +++ Python-2.5.5/Objects/typeobject.c 2010-04-26 23:37:11.131742301 +0100
- @@ -2931,7 +2931,7 @@
- /* Initialize the __dict__ in a type object */
-
- static int
- -add_methods(PyTypeObject *type, PyMethodDef *meth)
- +add_methods(PyTypeObject *type, const PyMethodDef *meth)
- {
- PyObject *dict = type->tp_dict;
-
- @@ -2968,7 +2968,7 @@
- }
-
- static int
- -add_members(PyTypeObject *type, PyMemberDef *memb)
- +add_members(PyTypeObject *type, const PyMemberDef *memb)
- {
- PyObject *dict = type->tp_dict;
-
- Index: Python-2.5.5/Python/structmember.c
- ===================================================================
- --- Python-2.5.5.orig/Python/structmember.c 2010-04-26 23:36:53.454639426 +0100
- +++ Python-2.5.5/Python/structmember.c 2010-04-26 23:37:11.160727992 +0100
- @@ -51,7 +51,7 @@
- }
-
- PyObject *
- -PyMember_GetOne(const char *addr, PyMemberDef *l)
- +PyMember_GetOne(const char *addr, const PyMemberDef *l)
- {
- PyObject *v;
- if ((l->flags & READ_RESTRICTED) &&
- @@ -154,7 +154,7 @@
- }
-
- int
- -PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
- +PyMember_SetOne(char *addr, const PyMemberDef *l, PyObject *v)
- {
- PyObject *oldv;