[Python-Dev] Segmentation fault in collections.defaultdict

Kevin Jacobs <jacobs@bioinformed.com> bioinformed at gmail.com
Sun Jun 11 15:23:02 CEST 2006


On 6/11/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
>
> Kevin Jacobs <jacobs at bioinformed.com> wrote:
> > Try this at home:
> > import collections
> > d=collections.defaultdict(int)
> > d.iterkeys().next()  # Seg fault
> > d.iteritems().next() # Seg fault
> > d.itervalues().next() # Fine and dandy
>
> This all worked fine for me in rev 46739 and 46849 (Kubuntu 6.06, gcc
> 4.0.3).
>
> > Python version:
> > Python 2.5a2 (trunk:46822M, Jun 10 2006, 13:14:15)
> > [GCC 4.0.2 20050901 (prerelease) (SUSE Linux)] on linux2
>
> Either something got broken and then fixed again between the two revs I
> tried,
> there's a problem specific to GCC 4.0.2, or there's a problem with
> whatever
> local modifications you have in your working copy :)
>


Looks like pilot error on this one.  I'm working on a 64 bit system and did
not do a distclean after my svn update.  Tim updated dictobject's mask from
an int to Py_ssize_t in rev 46594 (
http://svn.python.org/view?rev=46594&view=rev), which changed the memory
layout of dictionaries.  I can only assume that collectionsmodule.c was not
recompiled to reflect this change and the dict iterator was using a garbled
mask.

Resolution: Always run distclean when updating from the trunk.

Sorry for the noise,
-Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060611/f8dae397/attachment-0001.htm 


More information about the Python-Dev mailing list