1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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. */
|