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.

classification
Title: printing a list releases the GIL carelessly
Type: crash Stage: resolved
Components: Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pitrou Nosy List: pitrou, scott.dial
Priority: normal Keywords: patch

Created on 2009-10-08 21:35 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
list_print.py pitrou, 2009-10-08 21:35
list_print-r75317.patch scott.dial, 2009-10-11 00:44 guard from the crash by grabbing a reference before releasing the GIL
Messages (4)
msg93764 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-08 21:35
Function list_print() in listobject.c releases the GIL before calling
fprintf() but doesn't check the list size again when it gets the GIL
back. If another thread truncated the list, a crash can ensue. The
attached script crashes reliably here.
msg93846 - (view) Author: Scott Dial (scott.dial) Date: 2009-10-11 00:44
I've attached a patch that fixes this issue by grabbing a reference to
the item to be printed just before releasing the GIL.
msg93875 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-11 21:05
Thank you! The patch has been committed in trunk in r75367. I am waiting
for the 2.6 branch to unfreeze before backporting it.
msg94557 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-27 13:10
Backported to 2.6 in r75750.
History
Date User Action Args
2022-04-11 14:56:53adminsetgithub: 51333
2009-10-27 13:10:15pitrousetstatus: pending -> closed
resolution: accepted -> fixed
messages: + msg94557
2009-10-11 21:05:52pitrousetstatus: open -> pending
versions: - Python 2.7
messages: + msg93875

assignee: pitrou
resolution: accepted
stage: needs patch -> resolved
2009-10-11 00:44:41scott.dialsetfiles: + list_print-r75317.patch

nosy: + scott.dial
messages: + msg93846

keywords: + patch
2009-10-08 21:35:07pitroucreate