This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, chris.jerdonek, pitrou
Date 2012-07-11.11:44:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342007072.23.0.733577158771.issue15320@psf.upfronthosting.co.za>
In-reply-to
Content
I was about to say "yes, listiter.__next__ is atomic" (it should, really), but that's not true (Hint: there is a Py_DECREF in the code...).

The script below crashes with:
    Fatal Python error: Objects/listobject.c:2774 object at 0x7f66b7a6c600 has negative ref count -1
Attached patch fixes it.


import threading
class C:
    def __del__(self):
        print("DEL")
ITER = iter([C() for x in range(100)])
def f():
    for obj in ITER:
        pass
for x in range(10):
    t = threading.Thread(target=f)
    t.start()
History
Date User Action Args
2012-07-11 11:44:32amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, pitrou, chris.jerdonek
2012-07-11 11:44:32amaury.forgeotdarcsetmessageid: <1342007072.23.0.733577158771.issue15320@psf.upfronthosting.co.za>
2012-07-11 11:44:31amaury.forgeotdarclinkissue15320 messages
2012-07-11 11:44:31amaury.forgeotdarccreate