Message165253
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() |
|
Date |
User |
Action |
Args |
2012-07-11 11:44:32 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, pitrou, chris.jerdonek |
2012-07-11 11:44:32 | amaury.forgeotdarc | set | messageid: <1342007072.23.0.733577158771.issue15320@psf.upfronthosting.co.za> |
2012-07-11 11:44:31 | amaury.forgeotdarc | link | issue15320 messages |
2012-07-11 11:44:31 | amaury.forgeotdarc | create | |
|