cPickle segfault with nested dicts in threaded env

Kenneth Dombrowski kdombrowski at gmail.com
Wed Sep 8 20:58:22 CEST 2010

Hi all,

Before creating an issue @ bugs.python.org I wanted to run the
following by everyone

We are having a difficult time with what looks like a cPickle issue
when given a data structure containing >15 nested dictionaries, but
only when threading is involved

Environment is FreeBSD 8, Python 2.5.5

The following diff contains an addition for
which reproduces the issue

kenneth at kenneth0 Python-2.5.5 $ cat
> import copy
> import threading
>     def test_nested_dicts_in_threaded_env(self):
>         # segfaults on python2.5.5/FreeBSD 8.0-RELEASE-p2
>         def threadloop():
>             x = {}
>             for i in range(16):
>                 x = {i:copy.copy(x)}
>             cPickle.dumps(x, 2)
>         t = threading.Thread(target=threadloop)
>         t.start()

Any thoughts will be appreciated, thanks for looking,

More information about the Python-list mailing list