Commit cea380ed authored by Gerion Entrup's avatar Gerion Entrup Committed by Stefan Behnel

Utility/CppConvert: fix Cython warning (GH-3108)

When compiling to C++ code and using automatic conversion from Python
str to C++ string, Cython inserts this function template but generates the warning:
warning: string.from_py:15:63: local variable 'length' might be referenced before assignment
parent 532d22ef
......@@ -11,7 +11,7 @@ cdef extern from *:
@cname("{{cname}}")
cdef string {{cname}}(object o) except *:
cdef Py_ssize_t length
cdef Py_ssize_t length = 0
cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
return string(data, length)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment