[Pythonmac-SIG] Python compatible with GC?

Ronald Oussoren ronaldoussoren at mac.com
Thu Mar 3 07:51:29 CET 2011


On 3 Mar, 2011, at 0:01, Kevin Walzer wrote:

> I'm trying to debug a crash in a Python/Tkinter application that I am unable to reproduce using equivalent Tcl/Tk code. I have a custom Tcl/Tk extension library that implements an NSToolbar for Tk windows (using Tk-Cocoa). In testing this extension, when I call the standard Cocoa dialog to save a file, Python then crashes with a segfault.
> 
> Ordinarily these kinds of issues are reproducible in Tk itself using Tcl/Tk itself, since the crash pertains to some bug in Tk. However, I am not able to reproduce this issue with Tcl/Tk, just with Python/Tkinter. This leads me to suspect the issue may lie somewhere within the interaction between Python and Tk.
> 
> My build of Python is 2.7.1, built as 64/32-bit, and linked to the system Tcl/Tk Cocoa frameworks (for Mac App Store compatibility). Tcl/Tk is built with garbage-collection enabled; could this cause some issue with Python, which I believe does not support Objective-C-based GC?

The python.org installer is build with GC disabled, which means GC won't be used in any extension.  This could explain some crashes due to bad refcount management, that could cause dangling references when running without GC and keep them alive with GC. Simularly for Objective-C weak references.

BTW. I'm -10 on building the python.org installer with GC enabled for anything but python 3.3, this would be a backward incompatible change for already released branches of Python. Furthermore I'd be surprised if PyObjC is compatible with GC, I've tried to code defensively w.r.t. GC but have never tested that PyObjC actually works with GC.

Ronald

> 
> Here is my crashlog below. Any advice is appreciated.
> 
> 
> 0   com.apple.AppKit              	0x00007fff8758d3d4 -[NSWindow setLevel:] + 132
> 1   com.apple.Foundation          	0x00007fff814d323c __NSFireDelayedPerform + 404
> 2   com.apple.CoreFoundation      	0x00007fff84dd9be8 __CFRunLoopRun + 6488
> 3   com.apple.CoreFoundation      	0x00007fff84dd7dbf CFRunLoopRunSpecific + 575
> 4   Tcl                           	0x0000000102da1466 Tcl_WaitForEvent + 299
> 5   Tcl                           	0x0000000102d7028a Tcl_DoOneEvent + 261
> 6   _tkinter.so                   	0x000000010184421d Tkapp_CallDeallocArgs + 8781
> 7   org.python.python             	0x00000001006bca8d PyEval_EvalFrameEx + 20797
> 8   org.python.python             	0x00000001006becd6 PyEval_EvalCodeEx + 2118
> 9   org.python.python             	0x00000001006bccb3 PyEval_EvalFrameEx + 21347
> 10  org.python.python             	0x00000001006becd6 PyEval_EvalCodeEx + 2118
> 11  org.python.python             	0x00000001006bedf6 PyEval_EvalCode + 54
> 12  org.python.python             	0x00000001006e37fe PyRun_FileExFlags + 174
> 13  org.python.python             	0x00000001006b4a9e _PyBuiltin_Init + 14894
> 14  org.python.python             	0x00000001006bca8d PyEval_EvalFrameEx + 20797
> 15  org.python.python             	0x00000001006becd6 PyEval_EvalCodeEx + 2118
> 16  org.python.python             	0x00000001006bccb3 PyEval_EvalFrameEx + 21347
> 17  org.python.python             	0x00000001006becd6 PyEval_EvalCodeEx + 2118
> 18  org.python.python             	0x00000001006bedf6 PyEval_EvalCode + 54
> 19  org.python.python             	0x00000001006e37fe PyRun_FileExFlags + 174
> 20  org.python.python             	0x00000001006e3ab9 PyRun_SimpleFileExFlags + 489
> 21  com.codebykevin.quickwho-cbk  	0x0000000100005856 start + 19074
> 22  com.codebykevin.quickwho-cbk  	0x00000001000059c8 main + 229
> 23  com.codebykevin.quickwho-cbk  	0x0000000100000e08 start + 52
> 
> --Kevin
> -- 
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.com
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG



More information about the Pythonmac-SIG mailing list