inotify: make proper use of Python API to get object size.
authorRenato Cunha <renatoc@gmail.com>
Fri, 02 Jul 2010 16:21:42 -0300
changeset 11547 36a6aeb679da
parent 11535 09cb56b760b4
child 11548 dd2f356e1f6f
inotify: make proper use of Python API to get object size. In older python versions, it was ok to access an object's type by accessing its ob_type "member". With python 2.6+, the proper way of accessing it is via Py_TYPE(object). This patch implements the correct call for the inotify extension. When under python < 2.6, this macro is defined in mercurial's util.h.
hgext/inotify/linux/_inotify.c
--- a/hgext/inotify/linux/_inotify.c	Fri Jul 02 16:21:40 2010 -0300
+++ b/hgext/inotify/linux/_inotify.c	Fri Jul 02 16:21:42 2010 -0300
@@ -327,7 +327,7 @@
 	Py_XDECREF(evt->cookie);
 	Py_XDECREF(evt->name);
 
-	(*evt->ob_type->tp_free)(evt);
+	Py_TYPE(evt)->tp_free(evt);
 }
 
 static PyObject *event_repr(struct event *evt)