diff options
author | Robert Bradshaw <robertwb@gmail.com> | 2016-03-10 23:50:43 -0800 |
---|---|---|
committer | Robert Bradshaw <robertwb@gmail.com> | 2016-03-10 23:50:43 -0800 |
commit | b74b9630530cf6e85644904b260a0f12b5f59a44 (patch) | |
tree | 262319d46999f6f3400a2050ecd564f5ecf88172 | |
parent | 364695bd2871a4fc25f6fb82b3df79e6a9031d7a (diff) | |
download | cython-b74b9630530cf6e85644904b260a0f12b5f59a44.tar.gz |
Fix for stl conversions with default template params.
-rw-r--r-- | Cython/Compiler/PyrexTypes.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index c20484621..6c425f3d0 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -3393,10 +3393,16 @@ class CStructOrUnionType(CType): cpp_string_conversions = ("std::string",) -builtin_cpp_conversions = ("std::pair", - "std::vector", "std::list", - "std::set", "std::unordered_set", - "std::map", "std::unordered_map") +builtin_cpp_conversions = { + # type element template params + "std::pair": 2, + "std::vector": 1, + "std::list": 1, + "std::set": 1, + "std::unordered_set": 1, + "std::map": 2, + "std::unordered_map": 2, +} class CppClassType(CType): # name string @@ -3445,6 +3451,8 @@ class CppClassType(CType): tags = [] declarations = ["cdef extern from *:"] for ix, T in enumerate(self.templates or []): + if ix >= builtin_cpp_conversions[self.cname]: + break if T.is_pyobject or not T.create_from_py_utility_code(env): return False tags.append(T.specialization_name()) @@ -3507,6 +3515,8 @@ class CppClassType(CType): tags = [] declarations = ["cdef extern from *:"] for ix, T in enumerate(self.templates or []): + if ix >= builtin_cpp_conversions[self.cname]: + break if not T.create_to_py_utility_code(env): return False tags.append(T.specialization_name()) |