← Back to team overview

dulwich-users team mailing list archive

[PATCH 2/2] _diff_tree.c: fix Py_SIZE implementation for python 2.5.x users

 

Neither the Py_Size nor Py_SIZE macros are implemented in python 2.5.x,
so the current implementation (aliasing Py_SIZE to Py_Size) does not
work. Simply provide the 2.6 implementation here for python 2.5.x
users.
---
 dulwich/_diff_tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dulwich/_diff_tree.c b/dulwich/_diff_tree.c
index aaefb46..4c06af6 100644
--- a/dulwich/_diff_tree.c
+++ b/dulwich/_diff_tree.c
@@ -25,7 +25,7 @@ typedef int Py_ssize_t;
 #endif
 
 #if (PY_VERSION_HEX < 0x02060000)
-#define Py_SIZE(x) Py_Size(x)
+#define Py_SIZE(ob)             (((PyVarObject*)(ob))->ob_size)
 #endif
 
 static PyObject *tree_entry_cls, *null_entry;
-- 
1.7.3.2.msysgit.0




References