[zbar-commits] push rev [344]: fix missing python thread initialization (bug #3349199)
Status: Beta
Brought to you by:
spadix
From: <sp...@us...> - 2011-09-19 01:46:47
|
changeset: 344:cd365c1a623d user: sp...@us... date: Sun Sep 18 18:44:38 2011 -0700 details: http://zbar.hg.sourceforge.net:8000/hgroot/zbar/zbarzbar/rev/cd365c1a623d description: fix missing python thread initialization (bug #3349199) - thanks to jarekczek for reporting this problem! diffstat: ChangeLog | 2 ++ python/processor.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletions(-) diffs (28 lines): diff -r 2f457756a387 -r cd365c1a623d ChangeLog --- a/ChangeLog Sun Sep 18 18:33:24 2011 -0700 +++ b/ChangeLog Sun Sep 18 18:44:38 2011 -0700 @@ -1,4 +1,6 @@ current: + * fix missing python thread initialization (bug #3349199) + - thanks to jarekczek for reporting this problem! * fix missing configure check for Python.h (bug #3092663) - thanks to Zoltan Kovacs for reporting this problem! * fix C++ wrapper missing Symbol.quality (bug #3076524) diff -r 2f457756a387 -r cd365c1a623d python/processor.c --- a/python/processor.c Sun Sep 18 18:33:24 2011 -0700 +++ b/python/processor.c Sun Sep 18 18:44:38 2011 -0700 @@ -42,7 +42,13 @@ object_to_bool, &threaded)) return(NULL); -#ifndef WITH_THREAD +#ifdef WITH_THREAD + /* the processor creates a thread that calls back into python, + * so we must ensure that threads are initialized before attempting + * to manipulate the GIL (bug #3349199) + */ + PyEval_InitThreads(); +#else if(threaded > 0 && PyErr_WarnEx(NULL, "threading requested but not available", 1)) return(NULL); |