i trying utilize cython provide wrapper c++ utilities. 1 such function trying make accessible accessor returns enum based on file type.
here how re-define function in cython:
cdef extern "reader.h" namespace "magic_number": enum mcr_magic_number_t: mdi = 0 eot rv unknown
and in reader.pxd
file have
cpdef mcr_magic_number_t magic_number(self)
and in reader.pyx
file have
cpdef mcr_magic_number_t magic_number(self): """ :return: magic_number enum :rtype: mcr_magic_number_t """ return self.thisptr.magic_number()
now, when go compile this, warning
warning: ‘__pyx_r’ may used uninitialized in function
anyone know how best around this? tried searching solutions on google got pages of other people reporting same __pyx_r warning. maybe there way set default value or make sure initialized within cython?
try checking self.thisptr non-null value:
if <void*>self.thisptr != null: return self.thisptr.magic_number()
Comments
Post a Comment