GNOME Bugzilla – Bug 162623
Use new python 2.4 API to avoid the need to call gobject.threads_init()
Last modified: 2010-09-23 16:23:59 UTC
If we define pyg_thread_enabled as PyEval_ThreadsInitialized()[1], we no longer need to call gobject.threads_init() Caveat: for threads not created by python, you still need to call it. [1] http://docs.python.org/api/threads.html#l2h-842
Created attachment 35323 [details] [review] patch to call PyEval_InitThreads()
Interesting idea, though I think there's a bug if PyEval_InitThreads is called after pyg_begin_allow_threads and before the paired pyg_end_allow_threads. There's actually a problem with this now if gobject.threads_init() is called in between the two. Maybe PyEval_SaveThread / PyEval_RestoreThread should always be called.
Created attachment 35329 [details] [review] patch to call PyEval_InitThreads(), revised Agreed.
I had to revert the patch due to bug 163612. No idea yet why it fails.
Comment on attachment 35329 [details] [review] patch to call PyEval_InitThreads(), revised Marking patch as needs-work
I have tested my first patch (attachment 35323 [details] [review]), and it doesn't trigger bug 163612. I deduce then that calling PyEval_SaveThread / PyEval_RestoreThread with threads not enabled is not allowed, although not explicitly stated in the documentation. I propose we include this patch in pygtk 2.8 and just accept the limitations point out in comment #2.
Comment on attachment 35323 [details] [review] patch to call PyEval_InitThreads() Shouldn't we just clean up and deprecate the non-GIL API for 2.8?
Candidate for 2.9?
Over 4 years old. closing