Issue 7084: printing a list releases the GIL carelessly (original) (raw)

Issue7084

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:53 admin set github: 51333
2009-10-27 13:10:15 pitrou set status: pending -> closedresolution: accepted -> fixedmessages: +
2009-10-11 21:05:52 pitrou set status: open -> pendingversions: - Python 2.7messages: + assignee: pitrouresolution: acceptedstage: needs patch -> resolved
2009-10-11 00:44:41 scott.dial set files: + list_print-r75317.patchnosy: + scott.dialmessages: + keywords: + patch
2009-10-08 21:35:07 pitrou create