Commit 0c584f69 authored by Stefan Behnel's avatar Stefan Behnel

safety fix for ticket 461: prevent imported extension types from becoming...

safety fix for ticket 461: prevent imported extension types from becoming spanning types - use PyObject instead
parent 1830d1e7
......@@ -2030,8 +2030,15 @@ def spanning_type(type1, type2):
elif type1.is_pyobject ^ type2.is_pyobject:
return py_object_type
elif type1.assignable_from(type2):
if type1.is_extension_type and type1.typeobj_is_imported():
# external types are unsafe, so we use PyObject instead
return py_object_type
return type1
elif type2.assignable_from(type1):
elif type2.assignable_from(type1) and \
not (type2.is_typedef and type2.typedef_is_external):
if type2.is_extension_type and type2.typeobj_is_imported():
# external types are unsafe, so we use PyObject instead
return py_object_type
return type2
else:
return py_object_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