On Fri March/31/2000, 19:09:02 +0100, Phil Thompson wrote:
> Gey-Hong Gweon wrote:
> >
> > Dear Phil,
> >
> > Today, I have upgraded PyKDE to 0.11, and it seems to solve the parent()
> > and children() problem I once reported. However, I was having a more
> > subtle problem this time. Instead of posting a clueless question, I
> > decided to chase this problem a little bit, so here I report what I
> > found so far. I hope you will fix the problem, if you think I found a
> > bug indeed.
> >
> > The subtle problem I had was this: children() method would return
> > perfectly sensible return values when my program started but then "after
> > a while" it would return completely wrong values.
> >
> > By inserting a few lines in the source codes for PyQt and sip, I noticed
> > that this happens exactly when the table size of "cppPyMap" (siplib.c)
> > increases from 131 to 257. At the same time, completely wrong values
> > were returned by sipMapCppToSelf().
> >
> > After a little bit more chasing, I discovered that the problem lies in
> > the hash code (objmap.c) used to access cppPyMap. The table size has
> > increased, but the hash code is still computed as cpp_address %
> > table_size, which is not the same as cpp_address % old_table_size, the
> > correct code for the entries that already existed before the table size
> > increased.
>
> Do you have a short script that demonstrates the problem? Do you have
> patches to SIP that show the problem occuring?
>
> Phil
>
> _______________________________________________
> PyKDE mailing list [EMAIL PROTECTED]
> http://mats.gmd.de/mailman/listinfo/pykde
Sure. I attach 4 files: siplib.c.diff, objmap.c.diff, test.py,
test.py.out. Patch siplib.c and objmap.c with diff files, and do "python
test.py > test.py.out.2". test.py.out.2 should be similar to test.py.out
which is what I get on my machine. Look at line 244. Right there, the
hash table size increases from 131 to 257 and things go wrong.
Basically, the macro hash_1 (hash_2) in objmap.c needs to be rewritten
(I don't know how at the moment), to be valid for changing hash table
size.
--
Gey-Hong Gweon
The University of Michigan, Physics Department, Ann Arbor, MI 48109
(734) 647-9434 (Office), 763-3417 (Lab), 763-9694 (Fax)
siplib.c patch
objmap.c patch
test.py
test.py.out