segfault. which module to blame? (entire traceback)

Dan Parisien dan at eevolved.com
Fri Feb 16 14:54:13 EST 2001


D-Man wrote:

> On Fri, Feb 16, 2001 at 05:21:30PM +0000, Dan Parisien wrote:
> [snip]
> | segfaults before while coding normal python scripts. I think it was the
> | dictionaries because that's pretty much all I used. Could it be bad
> | reference counting in those? I would have to read the code, but could
> | there be a problem if two keys hashed to the same value in the
> | dictionary and that one is deleted before the other or something
> | similar?
> 
> I'll find out by making a class that always hashes to the same value :
> 
> class Hashable :
> ...     def __hash__( self ) :
> ...             return 5
> ...
> >>> h1 = Hashable()
> >>> h2 = Hashable()
> >>> id( h1 )
> 8185684
> >>> id( h2 )
> 8182548
> >>> d = { }
> >>> d[ h1 ] = 1
> >>> d[ h2 ] = 2
> >>> print d
> {<__main__.Hashable instance at 007CE754>: 1, <__main__.Hashable
> instance at 007CDB14>: 2}
> >>>
> >>> del d[ h1 ]
> >>> print d
> {<__main__.Hashable instance at 007CDB14>: 2}
> >>> del d[ h2 ]
> >>>
> 
> 
> It didn't crash for me (Win2k, Python 2.0) when I had 2 keys with the
> same hash value.
> 
> -D

I didn't think so :)

Just a hypothesis. One that shouldn't have made it out to the newsgroup...

Anyways, the two crashes are not related (although they are both segfaults, 
the similarity ends there)

I'm almost certain the problem is with dbm.

Dan




More information about the Python-list mailing list