You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a C++ templated function has more than one template argument, it cannot be used inside a "with nogil:" block, at least in 0.21.1, the version in debian sid. I have attached a MWE:
cythonside1.pyx does not use nogil, compiles and runs fine.
cythonside2.pyx uses nogil, fails to compile with the following error:
Error compiling Cython file:
------------------------------------------------------------
...
def test():
cdef int arg
with nogil:
fun[&arg)
^
------------------------------------------------------------
cythonside2.pyx:9:7: Constructing Python tuple not allowed without gil
* cside.cpp:
template<typename A, typename B> void fun(A *arg1, B *arg2) {
printf("In fun\n");
}
template void fun(int *arg1, int *arg2);
* cside.cppcythonside1.pyx:
cdef extern from "cside.hpp" nogil:
void fun[A,B](int,int](&arg,)(A *arg1, B *arg2)
def test():
cdef int arg
fun[&arg)
* cside.cppcythonside2.pyx:
cdef extern from "cside.hpp" nogil:
void fun[A,B](int,int](&arg,)(A *arg1, B *arg2)
def test():
cdef int arg
with nogil:
fun[int,int](&arg, &arg)
At 2015-04-27T19:07:27Z josedavid added attachment cythonbug.zip
If a C++ templated function has more than one template argument, it cannot be used inside a "with nogil:" block, at least in 0.21.1, the version in debian sid. I have attached a MWE:
cythonside1.pyx does not use nogil, compiles and runs fine.
cythonside2.pyx uses nogil, fails to compile with the following error:
At 2015-04-27T19:07:27Z josedavid added attachment cythonbug.zip
Migrated from http://trac.cython.org/ticket/848
The text was updated successfully, but these errors were encountered: