diff options
author | Gerion Entrup <32870336+gerion0@users.noreply.github.com> | 2019-08-28 21:01:07 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2019-09-10 18:10:44 +0100 |
commit | cea380edcd63121b136266b4e3265ba464276671 (patch) | |
tree | 8a859981f4c02496456f00b82e29ea67651841c4 | |
parent | 532d22ef90f1775968406a30f18b4fd7549ca145 (diff) | |
download | cython-cea380edcd63121b136266b4e3265ba464276671.tar.gz |
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
-rw-r--r-- | Cython/Utility/CppConvert.pyx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Cython/Utility/CppConvert.pyx b/Cython/Utility/CppConvert.pyx index 6efa0e272..03360e510 100644 --- a/Cython/Utility/CppConvert.pyx +++ b/Cython/Utility/CppConvert.pyx @@ -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) |