[PyKDE] ANNOUNCE: SIP/PyQt v2.4pre1

Phil Thompson phil at river-bank.demon.co.uk
Tue Mar 6 10:21:28 GMT 2001


SIP and PyQt v2.4pre1 is in the usual place at
http://www.river-bank.demon.co.uk/software/private/. The main
enhancements are support for Python v2.1b1 and Qt v2.3.0-beta1.

QObject.connect() now uses the weak references introduced in Python v2.1
to manage Python slots. Before, if you didn't keep a reference to the
slot object alive (usually a class instance) and the slot was called
then you often got a seg fault. Now you don't. However, this protection
doesn't apply if the slot is a lambda function. The attached patch to
Python fixes that - hopefully this will be included in the final release
of Python v2.1.

Phil
-------------- next part --------------
diff -ruN Python-2.1b1.orig/Include/funcobject.h Python-2.1b1/Include/funcobject.h
--- Python-2.1b1.orig/Include/funcobject.h	Thu Jan 25 20:06:58 2001
+++ Python-2.1b1/Include/funcobject.h	Mon Mar  5 13:00:58 2001
@@ -16,6 +16,7 @@
     PyObject *func_doc;
     PyObject *func_name;
     PyObject *func_dict;
+    PyObject *func_weakreflist;
 } PyFunctionObject;
 
 extern DL_IMPORT(PyTypeObject) PyFunction_Type;
diff -ruN Python-2.1b1.orig/Objects/funcobject.c Python-2.1b1/Objects/funcobject.c
--- Python-2.1b1.orig/Objects/funcobject.c	Thu Mar  1 06:06:37 2001
+++ Python-2.1b1/Objects/funcobject.c	Mon Mar  5 13:39:37 2001
@@ -245,6 +245,8 @@
 static void
 func_dealloc(PyFunctionObject *op)
 {
+	PyObject_ClearWeakRefs((PyObject *) op);
+
 	PyObject_GC_Fini(op);
 	Py_DECREF(op->func_code);
 	Py_DECREF(op->func_globals);
@@ -336,4 +338,7 @@
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /*tp_flags*/
 	0,		/* tp_doc */
 	(traverseproc)func_traverse,	/* tp_traverse */
+	0,		/* tp_clear */
+	0,		/* tp_richcompare */
+	offsetof(PyFunctionObject, func_weakreflist)	/* tp_weaklistoffset */
 };



More information about the PyQt mailing list