Message7120

Author ajdavis
Recipients ajdavis, fwierzbicki
Date 2012-05-21.15:58:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAL+CuuRLqCsdeMxsjOso1eGfJPbJ0EaXB+ceMfBGso3hTUsGiw@mail.gmail.com>
In-reply-to <1334102215.72.0.408615484151.issue1854@psf.upfronthosting.co.za>
Content
I see that in 2.7a1 you've added a 'synchronized' to Pyset.set_pop(),
I think that fixes the bug. I notice that, predictably, I had a bug in
my test script: I didn't join all the threads before asserting the set
was empty. So with this test script, 2.5.2 often fails and 2.7a1
always passes:

import threading
nthreads = 200
s = set(range(nthreads))
threads = [threading.Thread(target=s.pop) for i in range(nthreads)]
for t in threads: t.start()
for t in threads: t.join()
assert not len(s), "%d items left over" % len(s)

On Tue, Apr 10, 2012 at 7:56 PM, A. Jesse Jiryu Davis
<report@bugs.jython.org> wrote:
>
> A. Jesse Jiryu Davis <jesse@10gen.com> added the comment:
>
> $ cat jython-set-screw.py
> import threading
> nthreads = 200
> s = set(range(200))
> threads = [threading.Thread(target=s.pop) for i in range(nthreads)]
> for t in threads: t.start()
> assert not len(s), "%d items left over" % len(s)
>
> $ python --version
> Python 2.7.1
> $ python jython-set-screw.py
> $ ./jython2.5.2/bin/jython --version
> Jython 2.5.2
> $ ./jython2.5.2/bin/jython jython-set-screw.py
> Traceback (most recent call last):
>  File "jython-set-screw.py", line 6, in <module>
>    assert not len(s), "%d items left over" % len(s)
> AssertionError: 2 items left over
>
> _______________________________________
> Jython tracker <report@bugs.jython.org>
> <http://bugs.jython.org/issue1854>
> _______________________________________
History
Date User Action Args
2012-05-21 15:58:56ajdavissetrecipients: + ajdavis, fwierzbicki
2012-05-21 15:58:56ajdavislinkissue1854 messages
2012-05-21 15:58:55ajdaviscreate