Commit 9db5c060 authored by Robert Bradshaw's avatar Robert Bradshaw

Use struct type rather than its name in conversion utility code.

This fixes #1739.
parent 5528995c
...@@ -3204,7 +3204,7 @@ class CStructOrUnionType(CType): ...@@ -3204,7 +3204,7 @@ class CStructOrUnionType(CType):
return False return False
context = dict( context = dict(
struct_name=self.name, struct_type=self,
var_entries=self.scope.var_entries, var_entries=self.scope.var_entries,
funcname=self.from_py_function, funcname=self.from_py_function,
) )
......
...@@ -8,8 +8,8 @@ cdef extern from *: ...@@ -8,8 +8,8 @@ cdef extern from *:
object PyErr_Format(exc, const char *format, ...) object PyErr_Format(exc, const char *format, ...)
@cname("{{funcname}}") @cname("{{funcname}}")
cdef {{struct_name}} {{funcname}}(obj) except *: cdef {{struct_type}} {{funcname}}(obj) except *:
cdef {{struct_name}} result cdef {{struct_type}} result
if not PyMapping_Check(obj): if not PyMapping_Check(obj):
PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)
...@@ -33,8 +33,8 @@ cdef extern from *: ...@@ -33,8 +33,8 @@ cdef extern from *:
object PyErr_Format(exc, const char *format, ...) object PyErr_Format(exc, const char *format, ...)
@cname("{{funcname}}") @cname("{{funcname}}")
cdef {{struct_name}} {{funcname}}(obj) except *: cdef {{struct_type}} {{funcname}}(obj) except *:
cdef {{struct_name}} result cdef {{struct_type}} result
cdef Py_ssize_t length cdef Py_ssize_t length
if not PyMapping_Check(obj): if not PyMapping_Check(obj):
PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)
......
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