PageRenderTime 53ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/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
Possible License(s): GPL-3.0
  1. Index: Python-2.5.5/Include/methodobject.h
  2. ===================================================================
  3. --- Python-2.5.5.orig/Include/methodobject.h 2010-04-26 23:36:53.374633085 +0100
  4. +++ Python-2.5.5/Include/methodobject.h 2010-04-26 23:37:11.095741063 +0100
  5. @@ -46,7 +46,7 @@
  6. PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *);
  7. #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
  8. -PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
  9. +PyAPI_FUNC(PyObject *) PyCFunction_NewEx(const PyMethodDef *, PyObject *,
  10. PyObject *);
  11. /* Flag passed to newmethodobject */
  12. @@ -80,7 +80,7 @@
  13. typedef struct {
  14. PyObject_HEAD
  15. - PyMethodDef *m_ml; /* Description of the C function to call */
  16. + const PyMethodDef *m_ml; /* Description of the C function to call */
  17. PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */
  18. PyObject *m_module; /* The __module__ attribute, can be anything */
  19. } PyCFunctionObject;
  20. Index: Python-2.5.5/Include/modsupport.h
  21. ===================================================================
  22. --- Python-2.5.5.orig/Include/modsupport.h 2010-04-26 23:36:53.390634754 +0100
  23. +++ Python-2.5.5/Include/modsupport.h 2010-04-26 23:37:11.103738267 +0100
  24. @@ -113,7 +113,8 @@
  25. #endif
  26. #endif
  27. -PyAPI_FUNC(PyObject *) Py_InitModule4(const char *name, PyMethodDef *methods,
  28. +PyAPI_FUNC(PyObject *) Py_InitModule4(const char *name,
  29. + const PyMethodDef *methods,
  30. const char *doc, PyObject *self,
  31. int apiver);
  32. Index: Python-2.5.5/Objects/methodobject.c
  33. ===================================================================
  34. --- Python-2.5.5.orig/Objects/methodobject.c 2010-04-26 23:36:53.486641844 +0100
  35. +++ Python-2.5.5/Objects/methodobject.c 2010-04-26 23:37:11.103738267 +0100
  36. @@ -7,7 +7,7 @@
  37. static PyCFunctionObject *free_list = NULL;
  38. PyObject *
  39. -PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)
  40. +PyCFunction_NewEx(const PyMethodDef *ml, PyObject *self, PyObject *module)
  41. {
  42. PyCFunctionObject *op;
  43. op = free_list;
  44. Index: Python-2.5.5/Python/modsupport.c
  45. ===================================================================
  46. --- Python-2.5.5.orig/Python/modsupport.c 2010-04-26 23:36:53.470641589 +0100
  47. +++ Python-2.5.5/Python/modsupport.c 2010-04-26 23:37:11.103738267 +0100
  48. @@ -29,11 +29,11 @@
  49. This Python has API version %d, module %.100s has version %d.";
  50. PyObject *
  51. -Py_InitModule4(const char *name, PyMethodDef *methods, const char *doc,
  52. +Py_InitModule4(const char *name, const PyMethodDef *methods, const char *doc,
  53. PyObject *passthrough, int module_api_version)
  54. {
  55. PyObject *m, *d, *v, *n;
  56. - PyMethodDef *ml;
  57. + const PyMethodDef *ml;
  58. if (!Py_IsInitialized())
  59. Py_FatalError("Interpreter not initialized (version mismatch?)");
  60. if (module_api_version != PYTHON_API_VERSION) {
  61. Index: Python-2.5.5/Include/descrobject.h
  62. ===================================================================
  63. --- Python-2.5.5.orig/Include/descrobject.h 2010-04-26 23:36:53.438638816 +0100
  64. +++ Python-2.5.5/Include/descrobject.h 2010-04-26 23:37:11.124552248 +0100
  65. @@ -48,12 +48,12 @@
  66. typedef struct {
  67. PyDescr_COMMON;
  68. - PyMethodDef *d_method;
  69. + const PyMethodDef *d_method;
  70. } PyMethodDescrObject;
  71. typedef struct {
  72. PyDescr_COMMON;
  73. - struct PyMemberDef *d_member;
  74. + const struct PyMemberDef *d_member;
  75. } PyMemberDescrObject;
  76. typedef struct {
  77. @@ -69,10 +69,11 @@
  78. PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
  79. -PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
  80. -PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
  81. +PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, const PyMethodDef *);
  82. +PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *,
  83. + const PyMethodDef *);
  84. PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
  85. - struct PyMemberDef *);
  86. + const struct PyMemberDef *);
  87. PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
  88. struct PyGetSetDef *);
  89. PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
  90. Index: Python-2.5.5/Include/object.h
  91. ===================================================================
  92. --- Python-2.5.5.orig/Include/object.h 2010-04-26 23:36:53.422635629 +0100
  93. +++ Python-2.5.5/Include/object.h 2010-04-26 23:37:11.124552248 +0100
  94. @@ -314,8 +314,8 @@
  95. iternextfunc tp_iternext;
  96. /* Attribute descriptor and subclassing stuff */
  97. - struct PyMethodDef *tp_methods;
  98. - struct PyMemberDef *tp_members;
  99. + const struct PyMethodDef *tp_methods;
  100. + const struct PyMemberDef *tp_members;
  101. struct PyGetSetDef *tp_getset;
  102. struct _typeobject *tp_base;
  103. PyObject *tp_dict;
  104. Index: Python-2.5.5/Include/structmember.h
  105. ===================================================================
  106. --- Python-2.5.5.orig/Include/structmember.h 2010-04-26 23:36:53.402636104 +0100
  107. +++ Python-2.5.5/Include/structmember.h 2010-04-26 23:37:11.124552248 +0100
  108. @@ -83,8 +83,8 @@
  109. PyAPI_FUNC(int) PyMember_Set(char *, struct memberlist *, const char *, PyObject *);
  110. /* Current API, use this */
  111. -PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *);
  112. -PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *);
  113. +PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, const struct PyMemberDef *);
  114. +PyAPI_FUNC(int) PyMember_SetOne(char *, const struct PyMemberDef *, PyObject *);
  115. #ifdef __cplusplus
  116. Index: Python-2.5.5/Objects/descrobject.c
  117. ===================================================================
  118. --- Python-2.5.5.orig/Objects/descrobject.c 2010-04-26 23:36:53.502642858 +0100
  119. +++ Python-2.5.5/Objects/descrobject.c 2010-04-26 23:37:11.124552248 +0100
  120. @@ -591,7 +591,7 @@
  121. }
  122. PyObject *
  123. -PyDescr_NewMethod(PyTypeObject *type, PyMethodDef *method)
  124. +PyDescr_NewMethod(PyTypeObject *type, const PyMethodDef *method)
  125. {
  126. PyMethodDescrObject *descr;
  127. @@ -603,7 +603,7 @@
  128. }
  129. PyObject *
  130. -PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method)
  131. +PyDescr_NewClassMethod(PyTypeObject *type, const PyMethodDef *method)
  132. {
  133. PyMethodDescrObject *descr;
  134. @@ -615,7 +615,7 @@
  135. }
  136. PyObject *
  137. -PyDescr_NewMember(PyTypeObject *type, PyMemberDef *member)
  138. +PyDescr_NewMember(PyTypeObject *type, const PyMemberDef *member)
  139. {
  140. PyMemberDescrObject *descr;
  141. Index: Python-2.5.5/Objects/typeobject.c
  142. ===================================================================
  143. --- Python-2.5.5.orig/Objects/typeobject.c 2010-04-26 23:36:53.522643557 +0100
  144. +++ Python-2.5.5/Objects/typeobject.c 2010-04-26 23:37:11.131742301 +0100
  145. @@ -2931,7 +2931,7 @@
  146. /* Initialize the __dict__ in a type object */
  147. static int
  148. -add_methods(PyTypeObject *type, PyMethodDef *meth)
  149. +add_methods(PyTypeObject *type, const PyMethodDef *meth)
  150. {
  151. PyObject *dict = type->tp_dict;
  152. @@ -2968,7 +2968,7 @@
  153. }
  154. static int
  155. -add_members(PyTypeObject *type, PyMemberDef *memb)
  156. +add_members(PyTypeObject *type, const PyMemberDef *memb)
  157. {
  158. PyObject *dict = type->tp_dict;
  159. Index: Python-2.5.5/Python/structmember.c
  160. ===================================================================
  161. --- Python-2.5.5.orig/Python/structmember.c 2010-04-26 23:36:53.454639426 +0100
  162. +++ Python-2.5.5/Python/structmember.c 2010-04-26 23:37:11.160727992 +0100
  163. @@ -51,7 +51,7 @@
  164. }
  165. PyObject *
  166. -PyMember_GetOne(const char *addr, PyMemberDef *l)
  167. +PyMember_GetOne(const char *addr, const PyMemberDef *l)
  168. {
  169. PyObject *v;
  170. if ((l->flags & READ_RESTRICTED) &&
  171. @@ -154,7 +154,7 @@
  172. }
  173. int
  174. -PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
  175. +PyMember_SetOne(char *addr, const PyMemberDef *l, PyObject *v)
  176. {
  177. PyObject *oldv;