[PyKDE] PATCH: sip can't allocate more than 258 objectsM }5

Pieter Nagel pieter at nagel.co.za
Thu Jan 27 14:37:11 GMT 2000


siplib will freeze in an infinite loop when you try to allocate more
than 258 sip-wrapped objects. To reproduce the bug, try:

	import qt

	foo = []
	for e in range(0, 300):
		foo.append(qt.QObject())

Here's a patch that fixes the problem. No need to recompile PyQt
afterwards.

--- sip-0.10.1/siplib/objmap.cpp.orig	Thu Jan 27 11:59:34 2000
+++ sip-0.10.1/siplib/objmap.cpp	Thu Jan 27 12:00:03 2000
@@ -209,7 +209,7 @@
 
 	size = hash_primes[++primeIdx];
 	hash_array = new HashEntry[size];
-	neverUsed = size;
+	neverUsed += size - old_size;
 
 	for (i = 0; i < old_size; i++)
 		if (!old_entries[i].isFree())


-- 
     ,_
     /_)              /| /
    /   i e t e r    / |/ a g e l








More information about the PyQt mailing list