[PATCH 5 of 7] inotify extension: make proper use of Python API to get object size
Renato Cunha
renatoc at gmail.com
Fri Jul 2 14:59:55 CDT 2010
# HG changeset patch
# User Renato Cunha <renatoc at gmail.com>
# Date 1278098502 10800
# Node ID 2421c6e9c6f2785a6032402ab634c12aac50e463
# Parent d51e5b0db099c8ca9df6afe21a7ad831e24b1460
inotify extension: 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.
diff --git a/hgext/inotify/linux/_inotify.c b/hgext/inotify/linux/_inotify.c
--- a/hgext/inotify/linux/_inotify.c
+++ b/hgext/inotify/linux/_inotify.c
@@ -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)
More information about the Mercurial-devel
mailing list