[PATCH] inotify extension: make proper use of Python API to get object size
Nicolas Dumazet
nicdumz at gmail.com
Sat Jul 10 22:42:09 CDT 2010
Hello!
On Wed, 16 Jun 2010 19:55:41 -0300
Renato Cunha <renatoc at gmail.com> wrote:
> # HG changeset patch
> # User Renato Cunha <renatoc at gmail.com>
> # Date 1276728887 10800
> # Node ID 4d7562a192b5cb87f0d79954282fef19353bdafa
> # Parent 0044193a1c45790bb3ab1ad998799244b70df1a2
> inotify extension: make proper use of Python API to get object size.
Sorry, looks like we forgot about this one :)
If I'm right, the patch has nothing to do with object size?
What about
inotify: fix tp_free C API access for Python >=2.5
?
>
> 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);
The strict equivalent should be Py_TYPE(*evt)->tp_free(evt);
Are you implying this was a bug? =)
Regards,
> }
>
> static PyObject *event_repr(struct event *evt)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
--
Nicolas Dumazet — NicDumZ
More information about the Mercurial-devel
mailing list