Message165253
| 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: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 |
|