| 4873 | typedef typename sequence::const_iterator const_iterator; |
| 4874 | |
| 4875 | static PyObject *from(const sequence& seq) { |
| 4876 | #ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS |
| 4877 | swig_type_info *desc = swig::type_info<sequence>(); |
| 4878 | if (desc && desc->clientdata) { |
| 4879 | return SWIG_NewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN); |
| 4880 | } |
| 4881 | #endif |
| 4882 | size_type size = seq.size(); |
| 4883 | if (size <= (size_type)INT_MAX) { |
| 4884 | PyObject *obj = PyTuple_New((int)size); |
| 4885 | int i = 0; |
| 4886 | for (const_iterator it = seq.begin(); |
| 4887 | it != seq.end(); ++it, ++i) { |
| 4888 | PyTuple_SetItem(obj,i,swig::from<value_type>(*it)); |
| 4889 | } |
| 4890 | return obj; |
| 4891 | } else { |
| 4892 | PyErr_SetString(PyExc_OverflowError,"sequence size not valid in python"); |
| 4893 | return NULL; |
| 4894 | } |
| 4895 | } |
| 4896 | }; |
| 4897 | } |
| 4898 | |