wlav / cppyy

Other
384 stars 38 forks source link

Releasing the GIL when calling a template function #242

Open marktsuchida opened 1 month ago

marktsuchida commented 1 month ago

With a non-template function overload set f(), I can set cppyy.gbl.f.__release_gil__ = True.

With a function template g<T>(), both cppyy.gbl.g and cppyy.gbl.g["int"] are of type cppyy.TemplateProxy, which does not have any of the special variables such as __release_gil__.

Is there a way to release the GIL when calling g?

(It would be super-nice if I could do cppyy.gbl.g.__release_gil__ = True and have it apply to all specializations of g.)

My last resort will be to cppdef a non-template wrapper around g, but I was wondering if there is (or could be) any simpler way.