Commit 862e14d9 authored by Stefan Behnel's avatar Stefan Behnel

set is_string flag also for ctypedef'ed charptr types

parent bd50b09a
...@@ -2141,8 +2141,10 @@ class CArrayType(CType): ...@@ -2141,8 +2141,10 @@ class CArrayType(CType):
def __init__(self, base_type, size): def __init__(self, base_type, size):
self.base_type = base_type self.base_type = base_type
self.size = size self.size = size
if base_type in (c_char_type, c_uchar_type, c_schar_type): for char_type in (c_char_type, c_uchar_type, c_schar_type):
self.is_string = 1 if base_type.same_as(char_type):
self.is_string = 1
break
def __repr__(self): def __repr__(self):
return "<CArrayType %s %s>" % (self.size, repr(self.base_type)) return "<CArrayType %s %s>" % (self.size, repr(self.base_type))
...@@ -2188,6 +2190,10 @@ class CPtrType(CType): ...@@ -2188,6 +2190,10 @@ class CPtrType(CType):
def __init__(self, base_type): def __init__(self, base_type):
self.base_type = base_type self.base_type = base_type
for char_type in (c_char_type, c_uchar_type, c_schar_type):
if base_type.same_as(char_type):
self.is_string = 1
break
def __repr__(self): def __repr__(self):
return "<CPtrType %s>" % repr(self.base_type) return "<CPtrType %s>" % repr(self.base_type)
...@@ -3218,6 +3224,8 @@ RANK_FLOAT = _rank_to_type_name.index('float') ...@@ -3218,6 +3224,8 @@ RANK_FLOAT = _rank_to_type_name.index('float')
UNSIGNED = 0 UNSIGNED = 0
SIGNED = 2 SIGNED = 2
error_type = ErrorType()
unspecified_type = UnspecifiedType()
py_object_type = PyObjectType() py_object_type = PyObjectType()
...@@ -3309,9 +3317,6 @@ cython_memoryview_ptr_type = CPtrType(cython_memoryview_type) ...@@ -3309,9 +3317,6 @@ cython_memoryview_ptr_type = CPtrType(cython_memoryview_type)
memoryviewslice_type = CStructOrUnionType("memoryviewslice", "struct", memoryviewslice_type = CStructOrUnionType("memoryviewslice", "struct",
None, 1, "__Pyx_memviewslice") None, 1, "__Pyx_memviewslice")
error_type = ErrorType()
unspecified_type = UnspecifiedType()
modifiers_and_name_to_type = { modifiers_and_name_to_type = {
#(signed, longness, name) : type #(signed, longness, name) : type
(0, 0, "char"): c_uchar_type, (0, 0, "char"): c_uchar_type,
......
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