Date: Fri, 24 Aug 2007 18:36:15 +0800 (CST) From: Xin LI <delphij@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Cc: ports2@dclg.ca Subject: ports/115781: [PATCH] Fix py-kqueue with Python 2.5 Message-ID: <20070824103615.6A45528449@tarsier.delphij.net> Resent-Message-ID: <200708241040.l7OAe1MS067990@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 115781 >Category: ports >Synopsis: [PATCH] Fix py-kqueue with Python 2.5 >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Aug 24 10:40:01 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Xin LI >Release: FreeBSD 6.2-RELEASE-p7 i386 >Organization: The FreeBSD Project >Environment: System: FreeBSD tarsier.delphij.net 6.2-RELEASE-p7 FreeBSD 6.2-RELEASE-p7 #5: Thu Aug 2 22:09:50 CST 2007 delphij@tarsier.delphij.net:/usr/obj/usr/src/sys/TARSIER i386 >Description: With python 2.5, the Python 1.5 API has been changed, therefore, we have to reflect these changes or py-kqueue would crash. Maintainer CC'ed. This bug is critical, which makes py-kqueue unusable with Python 2.5. >How-To-Repeat: Python would crash with the following codelet: import KQueue p = KQueue.KQueue() >Fix: --- patch-py-kqueue begins here --- Index: Makefile =================================================================== RCS file: /home/ncvs/ports/devel/py-kqueue/Makefile,v retrieving revision 1.16 diff -u -p -r1.16 Makefile --- Makefile 30 Jul 2007 09:41:15 -0000 1.16 +++ Makefile 24 Aug 2007 10:31:40 -0000 @@ -7,7 +7,7 @@ PORTNAME= kqueue PORTVERSION= 1.4 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel python MASTER_SITES= http://ox.eicat.ca/~dgilbert/files/ PKGNAMEPREFIX= py- Index: files/patch-kqsyscallmodule.c =================================================================== RCS file: files/patch-kqsyscallmodule.c diff -N files/patch-kqsyscallmodule.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-kqsyscallmodule.c 24 Aug 2007 10:31:14 -0000 @@ -0,0 +1,61 @@ +--- ./kqsyscallmodule.c.orig 2001-01-29 10:59:50.000000000 +0800 ++++ ./kqsyscallmodule.c 2007-08-24 18:27:42.250897722 +0800 +@@ -42,6 +42,12 @@ + + #define MAX_KEVENTS 512 + ++#if PYTHON_API_VERSION <= 1007 ++ /* 1.5 compatibility */ ++#define PyObject_New PyObject_NEW ++#define PyObject_Del PyMem_DEL ++#endif ++ + // ---------------------------------------------------------------------- + // KQEventObject + // ---------------------------------------------------------------------- +@@ -58,8 +64,7 @@ + static KQEventObject * + newKQEventObject (PyObject *arg) + { +- // return PyObject_New (KQEventObject, &KQEvent_Type); +- return PyObject_NEW (KQEventObject, &KQEvent_Type); ++ return PyObject_New (KQEventObject, &KQEvent_Type); + } + + /* KQEvent methods */ +@@ -67,8 +72,7 @@ + static void + KQEvent_dealloc(KQEventObject *self) + { +- // PyObject_Del(self); +- PyMem_DEL (self); ++ PyObject_Del(self); + } + + // -------------------------------------------------------------------------------- +@@ -201,14 +205,14 @@ + static KQueueObject * + newKQueueObject (PyObject *arg) + { +- KQueueObject * self = PyObject_NEW (KQueueObject, &KQueue_Type); ++ KQueueObject * self = PyObject_New(KQueueObject, &KQueue_Type); + if (!self) { + PyErr_SetFromErrno (PyExc_MemoryError); + return NULL; + } else { + int kqfd = kqueue(); + if (kqfd < 0) { +- PyMem_DEL (self); ++ PyObject_Del(self); + PyErr_SetFromErrno (PyExc_OSError); + return NULL; + } else { +@@ -234,7 +238,7 @@ + KQueue_dealloc(KQueueObject *self) + { + close (self->fd); +- PyMem_DEL(self); ++ PyObject_Del(self); + } + + /* Call kevent(2) and do appropriate digestion of lists. */ --- patch-py-kqueue ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070824103615.6A45528449>