Commit e896d20f authored by Nikita Nemkin's avatar Nikita Nemkin Committed by Robert Bradshaw

Fixed explicit coercion of ctypedef'ed C types.

parent 5b8cccd2
...@@ -295,9 +295,9 @@ def create_typedef_type(name, base_type, cname, is_external=0): ...@@ -295,9 +295,9 @@ def create_typedef_type(name, base_type, cname, is_external=0):
class CTypedefType(BaseType): class CTypedefType(BaseType):
# #
# Pseudo-type defined with a ctypedef statement in a # Pseudo-type defined with a ctypedef statement in a
# 'cdef extern from' block. Delegates most attribute # 'cdef extern from' block.
# lookups to the base type. ANYTHING NOT DEFINED # Delegates most attribute lookups to the base type.
# HERE IS DELEGATED! # (Anything not defined here or in the BaseType is delegated.)
# #
# qualified_name string # qualified_name string
# typedef_name string # typedef_name string
...@@ -439,6 +439,9 @@ class CTypedefType(BaseType): ...@@ -439,6 +439,9 @@ class CTypedefType(BaseType):
def py_type_name(self): def py_type_name(self):
return self.typedef_base_type.py_type_name() return self.typedef_base_type.py_type_name()
def can_coerce_to_pyobject(self, env):
return self.typedef_base_type.can_coerce_to_pyobject(env)
class MemoryViewSliceType(PyrexType): class MemoryViewSliceType(PyrexType):
...@@ -774,10 +777,9 @@ class MemoryViewSliceType(PyrexType): ...@@ -774,10 +777,9 @@ class MemoryViewSliceType(PyrexType):
class BufferType(BaseType): class BufferType(BaseType):
# #
# Delegates most attribute # Delegates most attribute lookups to the base type.
# lookups to the base type. ANYTHING NOT DEFINED # (Anything not defined here or in the BaseType is delegated.)
# HERE IS DELEGATED! #
# dtype PyrexType # dtype PyrexType
# ndim int # ndim int
# mode str # mode str
......
ctypedef char* LPSTR
def typedef_delegation():
"""
>>> typedef_delegation()
"""
cdef LPSTR c_str = b"ascii"
assert <bytes>c_str == b"ascii"
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