After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 162623 - Use new python 2.4 API to avoid the need to call gobject.threads_init()
Use new python 2.4 API to avoid the need to call gobject.threads_init()
Status: RESOLVED OBSOLETE
Product: pygobject
Classification: Bindings
Component: gobject
2.9.0
Other Linux
: Normal enhancement
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2004-12-31 15:27 UTC by Gustavo Carneiro
Modified: 2010-09-23 16:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to call PyEval_InitThreads() (4.42 KB, patch)
2004-12-31 15:28 UTC, Gustavo Carneiro
none Details | Review
patch to call PyEval_InitThreads(), revised (4.45 KB, patch)
2004-12-31 20:15 UTC, Gustavo Carneiro
needs-work Details | Review

Description Gustavo Carneiro 2004-12-31 15:27:31 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
Comment 1 Gustavo Carneiro 2004-12-31 15:28:52 UTC
Created attachment 35323 [details] [review]
patch to call PyEval_InitThreads()
Comment 2 John Ehresman 2004-12-31 19:19:20 UTC
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.
Comment 3 Gustavo Carneiro 2004-12-31 20:15:17 UTC
Created attachment 35329 [details] [review]
patch to call PyEval_InitThreads(), revised

Agreed.
Comment 4 Gustavo Carneiro 2005-01-10 23:43:49 UTC
I had to revert the patch due to bug 163612.  No idea yet why it fails.
Comment 5 Johan (not receiving bugmail) Dahlin 2005-01-23 19:33:27 UTC
Comment on attachment 35329 [details] [review]
patch to call PyEval_InitThreads(), revised

Marking patch as needs-work
Comment 6 Gustavo Carneiro 2005-05-03 23:48:07 UTC
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 7 Johan (not receiving bugmail) Dahlin 2005-06-14 22:51:53 UTC
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?
Comment 8 Gustavo Carneiro 2006-01-14 16:56:02 UTC
Candidate for 2.9?
Comment 9 johnp 2010-09-23 16:23:59 UTC
Over 4 years old.  closing