diff --git a/python/src/addons/CompletionDictionaryCompiler.pyx b/python/src/addons/CompletionDictionaryCompiler.pyx index d225ebec3..350d20a56 100644 --- a/python/src/addons/CompletionDictionaryCompiler.pyx +++ b/python/src/addons/CompletionDictionaryCompiler.pyx @@ -20,9 +20,4 @@ cdef void* callback = args[0] with nogil: - self.inst.get().Compile(callback_wrapper, callback) - - -# definition for all compilers -cdef void callback_wrapper(size_t a, size_t b, void* py_callback) with gil: - (py_callback)(a, b) + self.inst.get().Compile(progress_compiler_callback, callback) diff --git a/python/src/addons/FloatVectorDictionaryCompiler.pyx b/python/src/addons/FloatVectorDictionaryCompiler.pyx index 77c6a2969..dce891d8a 100644 --- a/python/src/addons/FloatVectorDictionaryCompiler.pyx +++ b/python/src/addons/FloatVectorDictionaryCompiler.pyx @@ -20,5 +20,5 @@ cdef void* callback = args[0] with nogil: - self.inst.get().Compile(callback_wrapper, callback) + self.inst.get().Compile(progress_compiler_callback, callback) diff --git a/python/src/addons/IntDictionaryCompiler.pyx b/python/src/addons/IntDictionaryCompiler.pyx index 77c6a2969..dce891d8a 100644 --- a/python/src/addons/IntDictionaryCompiler.pyx +++ b/python/src/addons/IntDictionaryCompiler.pyx @@ -20,5 +20,5 @@ cdef void* callback = args[0] with nogil: - self.inst.get().Compile(callback_wrapper, callback) + self.inst.get().Compile(progress_compiler_callback, callback) diff --git a/python/src/addons/IntDictionaryCompilerSmallData.pyx b/python/src/addons/IntDictionaryCompilerSmallData.pyx index 77c6a2969..dce891d8a 100644 --- a/python/src/addons/IntDictionaryCompilerSmallData.pyx +++ b/python/src/addons/IntDictionaryCompilerSmallData.pyx @@ -20,5 +20,5 @@ cdef void* callback = args[0] with nogil: - self.inst.get().Compile(callback_wrapper, callback) + self.inst.get().Compile(progress_compiler_callback, callback) diff --git a/python/src/addons/JsonDictionaryCompiler.pyx b/python/src/addons/JsonDictionaryCompiler.pyx index bc8607fd6..0faa6fa7d 100644 --- a/python/src/addons/JsonDictionaryCompiler.pyx +++ b/python/src/addons/JsonDictionaryCompiler.pyx @@ -20,5 +20,5 @@ cdef void* callback = args[0] with nogil: - self.inst.get().Compile(callback_wrapper, callback) + self.inst.get().Compile(progress_compiler_callback, callback) diff --git a/python/src/addons/JsonDictionaryCompilerSmallData.pyx b/python/src/addons/JsonDictionaryCompilerSmallData.pyx index 96b5d32df..2b89ba5f2 100644 --- a/python/src/addons/JsonDictionaryCompilerSmallData.pyx +++ b/python/src/addons/JsonDictionaryCompilerSmallData.pyx @@ -35,5 +35,5 @@ cdef void* callback = args[0] with nogil: - self.inst.get().Compile(callback_wrapper, callback) + self.inst.get().Compile(progress_compiler_callback, callback) diff --git a/python/src/addons/KeyOnlyDictionaryCompiler.pyx b/python/src/addons/KeyOnlyDictionaryCompiler.pyx index 77c6a2969..dce891d8a 100644 --- a/python/src/addons/KeyOnlyDictionaryCompiler.pyx +++ b/python/src/addons/KeyOnlyDictionaryCompiler.pyx @@ -20,5 +20,5 @@ cdef void* callback = args[0] with nogil: - self.inst.get().Compile(callback_wrapper, callback) + self.inst.get().Compile(progress_compiler_callback, callback) diff --git a/python/src/addons/StringDictionaryCompiler.pyx b/python/src/addons/StringDictionaryCompiler.pyx index 77c6a2969..dce891d8a 100644 --- a/python/src/addons/StringDictionaryCompiler.pyx +++ b/python/src/addons/StringDictionaryCompiler.pyx @@ -20,5 +20,5 @@ cdef void* callback = args[0] with nogil: - self.inst.get().Compile(callback_wrapper, callback) + self.inst.get().Compile(progress_compiler_callback, callback) diff --git a/python/src/addons/autwrap_workarounds.pyx b/python/src/addons/autwrap_workarounds.pyx index 5fddf9896..117c72e07 100644 --- a/python/src/addons/autwrap_workarounds.pyx +++ b/python/src/addons/autwrap_workarounds.pyx @@ -33,3 +33,8 @@ def get_interpreter_executable(): executable = executable.encode('utf-8') return executable + + +# definition for all compilers +cdef void progress_compiler_callback(size_t a, size_t b, void* py_callback) noexcept with gil: + (py_callback)(a, b) diff --git a/python/src/pxds/match.pxd b/python/src/pxds/match.pxd index 22f58b513..038eb5d24 100644 --- a/python/src/pxds/match.pxd +++ b/python/src/pxds/match.pxd @@ -17,7 +17,7 @@ cdef extern from "keyvi/dictionary/match.h" namespace "keyvi::dictionary": void SetScore(float score) libcpp_utf8_output_string GetMatchedString() void SetMatchedString (libcpp_utf8_string matched_string) - PyObject* GetAttributePy(libcpp_utf8_string) nogil except + # wrap-ignore + PyObject* GetAttributePy(libcpp_utf8_string) except + nogil # wrap-ignore libcpp_utf8_output_string GetValueAsString() except + libcpp_string GetRawValueAsString() except + libcpp_string GetMsgPackedValueAsString() except + # wrap-ignore