functional.h: acquire GIL before calling Python function

This commit is contained in:
Wenzel Jakob 2016-04-25 09:17:28 +02:00
parent 2f6662e174
commit 17b10d7cbf

View File

@ -24,6 +24,7 @@ public:
return false; return false;
object src(src_, true); object src(src_, true);
value = [src](Args... args) -> Return { value = [src](Args... args) -> Return {
gil_scoped_acquire acq;
object retval(src.call(std::move(args)...)); object retval(src.call(std::move(args)...));
/* Visual studio 2015 parser issue: need parentheses around this expression */ /* Visual studio 2015 parser issue: need parentheses around this expression */
return (retval.template cast<Return>()); return (retval.template cast<Return>());