Rev 4737: (jam) Some python2.4 fixes for the StaticTuple code. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Oct 12 23:36:42 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4737 [merge]
revision-id: pqm at pqm.ubuntu.com-20091012223642-0seiqhjw7sa587dm
parent: pqm at pqm.ubuntu.com-20091012195159-n0de3utv1q92agvg
parent: john at arbash-meinel.com-20091012214427-zddi1kmc2jlf7v31
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2009-10-12 23:36:42 +0100
message:
(jam) Some python2.4 fixes for the StaticTuple code.
modified:
bzrlib/_export_c_api.h _export_c_api.h-20091001213208-3r023fkye2e8ki8s-1
bzrlib/_import_c_api.h _import_c_api.h-20091001213208-3r023fkye2e8ki8s-2
bzrlib/_static_tuple_c.c _keys_type_c.c-20090908204220-aa346ccw4l37jzt7-1
bzrlib/python-compat.h pythoncompat.h-20080924041409-9kvi0fgtuuqp743j-1
=== modified file 'bzrlib/_export_c_api.h'
--- a/bzrlib/_export_c_api.h 2009-10-02 02:21:12 +0000
+++ b/bzrlib/_export_c_api.h 2009-10-12 21:44:27 +0000
@@ -45,14 +45,17 @@
PyObject *d = NULL;
PyObject *c_obj = NULL;
- d = PyObject_GetAttrString(module, _C_API_NAME);
+ /* (char *) is because python2.4 declares this api as 'char *' rather than
+ * const char* which it really is.
+ */
+ d = PyObject_GetAttrString(module, (char *)_C_API_NAME);
if (!d) {
PyErr_Clear();
d = PyDict_New();
if (!d)
goto bad;
Py_INCREF(d);
- if (PyModule_AddObject(module, _C_API_NAME, d) < 0)
+ if (PyModule_AddObject(module, (char *)_C_API_NAME, d) < 0)
goto bad;
}
c_obj = PyCObject_FromVoidPtrAndDesc(func, signature, 0);
=== modified file 'bzrlib/_import_c_api.h'
--- a/bzrlib/_import_c_api.h 2009-10-01 21:34:36 +0000
+++ b/bzrlib/_import_c_api.h 2009-10-12 21:44:27 +0000
@@ -47,7 +47,10 @@
PyObject *c_obj = NULL;
const char *desc = NULL;
- d = PyObject_GetAttrString(module, _C_API_NAME);
+ /* (char *) because Python2.4 defines this as (char *) rather than
+ * (const char *)
+ */
+ d = PyObject_GetAttrString(module, (char *)_C_API_NAME);
if (!d) {
// PyObject_GetAttrString sets an appropriate exception
goto bad;
@@ -94,7 +97,7 @@
{
PyObject *type = NULL;
- type = PyObject_GetAttrString(module, class_name);
+ type = PyObject_GetAttrString(module, (char *)class_name);
if (!type) {
goto bad;
}
@@ -149,7 +152,7 @@
struct type_description *cur_type;
int ret_code;
- module = PyImport_ImportModule(module_name);
+ module = PyImport_ImportModule((char *)module_name);
if (!module)
goto bad;
if (functions != NULL) {
=== modified file 'bzrlib/_static_tuple_c.c'
--- a/bzrlib/_static_tuple_c.c 2009-10-12 19:05:34 +0000
+++ b/bzrlib/_static_tuple_c.c 2009-10-12 21:44:27 +0000
@@ -20,6 +20,9 @@
*/
#define STATIC_TUPLE_MODULE
+#include <Python.h>
+#include "python-compat.h"
+
#include "_static_tuple_c.h"
#include "_export_c_api.h"
@@ -31,8 +34,6 @@
#define import__simple_set_pyx import_bzrlib___simple_set_pyx
#include "_simple_set_pyx_api.h"
-#include "python-compat.h"
-
#if defined(__GNUC__)
# define inline __inline__
#elif defined(_MSC_VER)
@@ -689,7 +690,7 @@
static int
-_workaround_pyrex_096()
+_workaround_pyrex_096(void)
{
/* Work around an incompatibility in how pyrex 0.9.6 exports a module,
* versus how pyrex 0.9.8 and cython 0.11 export it.
=== modified file 'bzrlib/python-compat.h'
--- a/bzrlib/python-compat.h 2009-10-12 18:59:22 +0000
+++ b/bzrlib/python-compat.h 2009-10-12 21:44:27 +0000
@@ -28,6 +28,9 @@
/* http://www.python.org/dev/peps/pep-0353/ */
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
typedef int Py_ssize_t;
+ typedef Py_ssize_t (*lenfunc)(PyObject *);
+ typedef PyObject * (*ssizeargfunc)(PyObject *, Py_ssize_t);
+ typedef PyObject * (*ssizessizeargfunc)(PyObject *, Py_ssize_t, Py_ssize_t);
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
More information about the bazaar-commits
mailing list