MCPcopy Create free account
hub / github.com/chokkan/crfsuite / SwigPySequence_Ref

Class SwigPySequence_Ref

swig/python/export_wrap.cpp:4581–4614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4579{
4580 template <class T>
4581 struct SwigPySequence_Ref
4582 {
4583 SwigPySequence_Ref(PyObject* seq, int index)
4584 : _seq(seq), _index(index)
4585 {
4586 }
4587
4588 operator T () const
4589 {
4590 swig::SwigVar_PyObject item = PySequence_GetItem(_seq, _index);
4591 try {
4592 return swig::as<T>(item, true);
4593 } catch (std::exception& e) {
4594 char msg[1024];
4595 sprintf(msg, "in sequence element %d ", _index);
4596 if (!PyErr_Occurred()) {
4597 ::SWIG_Error(SWIG_TypeError, swig::type_name<T>());
4598 }
4599 SWIG_Python_AddErrorMsg(msg);
4600 SWIG_Python_AddErrorMsg(e.what());
4601 throw;
4602 }
4603 }
4604
4605 SwigPySequence_Ref& operator=(const T& v)
4606 {
4607 PySequence_SetItem(_seq, _index, swig::from<T>(v));
4608 return *this;
4609 }
4610
4611 private:
4612 PyObject* _seq;
4613 int _index;
4614 };
4615
4616 template <class T>
4617 struct SwigPySequence_ArrowProxy

Callers

nothing calls this directly

Calls 1

SWIG_Python_AddErrorMsgFunction · 0.85

Tested by

no test coverage detected