Fix construction from dict for std::multimap std::unordered_multimap (Python 3)
This commit is contained in:
parent
a2267a8152
commit
005ff93dbd
2 changed files with 10 additions and 2 deletions
|
|
@ -23,7 +23,11 @@
|
||||||
int res = SWIG_ERROR;
|
int res = SWIG_ERROR;
|
||||||
if (PyDict_Check(obj)) {
|
if (PyDict_Check(obj)) {
|
||||||
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
||||||
return traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
%#if PY_VERSION_HEX >= 0x03000000
|
||||||
|
/* In Python 3.x the ".items()" method returns a dict_items object */
|
||||||
|
items = PySequence_Fast(items, ".items() didn't return a sequence!");
|
||||||
|
%#endif
|
||||||
|
res = traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||||
} else {
|
} else {
|
||||||
multimap_type *p;
|
multimap_type *p;
|
||||||
swig_type_info *descriptor = swig::type_info<multimap_type>();
|
swig_type_info *descriptor = swig::type_info<multimap_type>();
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,11 @@
|
||||||
int res = SWIG_ERROR;
|
int res = SWIG_ERROR;
|
||||||
if (PyDict_Check(obj)) {
|
if (PyDict_Check(obj)) {
|
||||||
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
||||||
return traits_asptr_stdseq<std::unordered_multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
%#if PY_VERSION_HEX >= 0x03000000
|
||||||
|
/* In Python 3.x the ".items()" method returns a dict_items object */
|
||||||
|
items = PySequence_Fast(items, ".items() didn't return a sequence!");
|
||||||
|
%#endif
|
||||||
|
res = traits_asptr_stdseq<std::unordered_multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||||
} else {
|
} else {
|
||||||
unordered_multimap_type *p;
|
unordered_multimap_type *p;
|
||||||
swig_type_info *descriptor = swig::type_info<unordered_multimap_type>();
|
swig_type_info *descriptor = swig::type_info<unordered_multimap_type>();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue