本文整理汇总了C++中PySequence_ITEM函数的典型用法代码示例。如果您正苦于以下问题:C++ PySequence_ITEM函数的具体用法?C++ PySequence_ITEM怎么用?C++ PySequence_ITEM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PySequence_ITEM函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: convertTo_QList_0100QsciStyledText
static int convertTo_QList_0100QsciStyledText(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
{
QList<QsciStyledText> **sipCppPtr = reinterpret_cast<QList<QsciStyledText> **>(sipCppPtrV);
#line 64 "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/share/sip/PyQt4/QtCore/qlist.sip"
SIP_SSIZE_T len;
// Check the type if that is all that is required.
if (sipIsErr == NULL)
{
if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
return 0;
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
bool ok = (itm && sipCanConvertToType(itm, sipType_QsciStyledText, SIP_NOT_NONE));
Py_XDECREF(itm);
if (!ok)
return 0;
}
return 1;
}
QList<QsciStyledText> *ql = new QList<QsciStyledText>;
len = PySequence_Size(sipPy);
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
int state;
QsciStyledText *t = reinterpret_cast<QsciStyledText *>(sipConvertToType(itm, sipType_QsciStyledText, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
Py_DECREF(itm);
if (*sipIsErr)
{
sipReleaseType(t, sipType_QsciStyledText, state);
delete ql;
return 0;
}
ql->append(*t);
sipReleaseType(t, sipType_QsciStyledText, state);
}
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
#line 126 "./sipQsciQList0100QsciStyledText.cpp"
}
开发者ID:kunwijik,项目名称:Spectroscopy_paper,代码行数:56,代码来源:sipQsciQList0100QsciStyledText.cpp
示例2: convertTo_QList_0100QModelIndex
static int convertTo_QList_0100QModelIndex(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
{
QList<QModelIndex> **sipCppPtr = reinterpret_cast<QList<QModelIndex> **>(sipCppPtrV);
#line 59 "/home/vikky/Desktop/DVCS/stuff/scrapy/soft/PyQt-x11-gpl-4.11.4/sip/QtCore/qlist.sip"
SIP_SSIZE_T len;
// Check the type if that is all that is required.
if (sipIsErr == NULL)
{
if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
return 0;
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
bool ok = (itm && sipCanConvertToType(itm, sipType_QModelIndex, SIP_NOT_NONE));
Py_XDECREF(itm);
if (!ok)
return 0;
}
return 1;
}
QList<QModelIndex> *ql = new QList<QModelIndex>;
len = PySequence_Size(sipPy);
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
int state;
QModelIndex *t = reinterpret_cast<QModelIndex *>(sipConvertToType(itm, sipType_QModelIndex, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
Py_DECREF(itm);
if (*sipIsErr)
{
sipReleaseType(t, sipType_QModelIndex, state);
delete ql;
return 0;
}
ql->append(*t);
sipReleaseType(t, sipType_QModelIndex, state);
}
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
#line 123 "/home/vikky/Desktop/DVCS/stuff/scrapy/soft/PyQt-x11-gpl-4.11.4/QtCore/sipQtCoreQList0100QModelIndex.cpp"
}
开发者ID:annelida,项目名称:stuff,代码行数:56,代码来源:sipQtCoreQList0100QModelIndex.cpp
示例3: convertTo_QList_0100QSize
static int convertTo_QList_0100QSize(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
{
QList<QSize> **sipCppPtr = reinterpret_cast<QList<QSize> **>(sipCppPtrV);
#line 69 "/home/tsheasha/GUC/Bachelors/android-python27/python-build/PyQt-x11-gpl-4.8/sip/QtCore/qlist.sip"
SIP_SSIZE_T len;
// Check the type if that is all that is required.
if (sipIsErr == NULL)
{
if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
return 0;
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
bool ok = (itm && sipCanConvertToType(itm, sipType_QSize, SIP_NOT_NONE));
Py_XDECREF(itm);
if (!ok)
return 0;
}
return 1;
}
QList<QSize> *ql = new QList<QSize>;
len = PySequence_Size(sipPy);
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
int state;
QSize *t = reinterpret_cast<QSize *>(sipConvertToType(itm, sipType_QSize, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
Py_DECREF(itm);
if (*sipIsErr)
{
sipReleaseType(t, sipType_QSize, state);
delete ql;
return 0;
}
ql->append(*t);
sipReleaseType(t, sipType_QSize, state);
}
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
#line 133 "sipQtGuiQList0100QSize.cpp"
}
开发者ID:ClydeMojura,项目名称:android-python27,代码行数:56,代码来源:sipQtGuiQList0100QSize.cpp
示例4: convertTo_QList_0100QSize
static int convertTo_QList_0100QSize(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
{
QList<QSize> **sipCppPtr = reinterpret_cast<QList<QSize> **>(sipCppPtrV);
#line 64 "sip/QtCore/qlist.sip"
SIP_SSIZE_T len;
// Check the type if that is all that is required.
if (sipIsErr == NULL)
{
if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
return 0;
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
bool ok = (itm && sipCanConvertToType(itm, sipType_QSize, SIP_NOT_NONE));
Py_XDECREF(itm);
if (!ok)
return 0;
}
return 1;
}
QList<QSize> *ql = new QList<QSize>;
len = PySequence_Size(sipPy);
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
int state;
QSize *t = reinterpret_cast<QSize *>(sipConvertToType(itm, sipType_QSize, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
Py_DECREF(itm);
if (*sipIsErr)
{
sipReleaseType(t, sipType_QSize, state);
delete ql;
return 0;
}
ql->append(*t);
sipReleaseType(t, sipType_QSize, state);
}
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
#line 128 "/Users/ktaylora/PLJV/tillage_likelihood_model/gui/PyQt4/QtGui/sipQtGuiQList0100QSize.cpp"
}
开发者ID:PLJV,项目名称:commodity_crop_dev_suitability_model,代码行数:56,代码来源:sipQtGuiQList0100QSize.cpp
示例5: convertTo_QList_0100QNetworkProxy
static int convertTo_QList_0100QNetworkProxy(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
{
QList<QNetworkProxy> **sipCppPtr = reinterpret_cast<QList<QNetworkProxy> **>(sipCppPtrV);
#line 64 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/sip/QtCore/qlist.sip"
SIP_SSIZE_T len;
// Check the type if that is all that is required.
if (sipIsErr == NULL)
{
if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
return 0;
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
bool ok = (itm && sipCanConvertToType(itm, sipType_QNetworkProxy, SIP_NOT_NONE));
Py_XDECREF(itm);
if (!ok)
return 0;
}
return 1;
}
QList<QNetworkProxy> *ql = new QList<QNetworkProxy>;
len = PySequence_Size(sipPy);
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
int state;
QNetworkProxy *t = reinterpret_cast<QNetworkProxy *>(sipConvertToType(itm, sipType_QNetworkProxy, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
Py_DECREF(itm);
if (*sipIsErr)
{
sipReleaseType(t, sipType_QNetworkProxy, state);
delete ql;
return 0;
}
ql->append(*t);
sipReleaseType(t, sipType_QNetworkProxy, state);
}
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
#line 128 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/QtNetwork/sipQtNetworkQList0100QNetworkProxy.cpp"
}
开发者ID:kunwijik,项目名称:Spectroscopy_paper,代码行数:56,代码来源:sipQtNetworkQList0100QNetworkProxy.cpp
示例6: convertTo_QList_0100QLocale
static int convertTo_QList_0100QLocale(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
{
QList< ::QLocale> **sipCppPtr = reinterpret_cast<QList< ::QLocale> **>(sipCppPtrV);
#line 59 "/home/thais/Faculdade/TCC/NEW/PyQt4_gpl_x11-4.12/sip/QtCore/qlist.sip"
SIP_SSIZE_T len;
// Check the type if that is all that is required.
if (sipIsErr == NULL)
{
if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
return 0;
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
bool ok = (itm && sipCanConvertToType(itm, sipType_QLocale, SIP_NOT_NONE));
Py_XDECREF(itm);
if (!ok)
return 0;
}
return 1;
}
QList<QLocale> *ql = new QList<QLocale>;
len = PySequence_Size(sipPy);
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
int state;
QLocale *t = reinterpret_cast<QLocale *>(sipConvertToType(itm, sipType_QLocale, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
Py_DECREF(itm);
if (*sipIsErr)
{
sipReleaseType(t, sipType_QLocale, state);
delete ql;
return 0;
}
ql->append(*t);
sipReleaseType(t, sipType_QLocale, state);
}
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
#line 123 "/home/thais/Faculdade/TCC/NEW/PyQt4_gpl_x11-4.12/QtCore/sipQtCoreQList0100QLocale.cpp"
}
开发者ID:thaisdb,项目名称:TCC,代码行数:56,代码来源:sipQtCoreQList0100QLocale.cpp
示例7: convertTo_QList_0101QTableWidgetItem
static int convertTo_QList_0101QTableWidgetItem(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
{
QList<QTableWidgetItem*> **sipCppPtr = reinterpret_cast<QList<QTableWidgetItem*> **>(sipCppPtrV);
#line 145 "sip/QtCore/qlist.sip"
SIP_SSIZE_T len;
// Check the type if that is all that is required.
if (sipIsErr == NULL)
{
if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
return 0;
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
bool ok = (itm && sipCanConvertToType(itm, sipType_QTableWidgetItem, 0));
Py_XDECREF(itm);
if (!ok)
return 0;
}
return 1;
}
QList<QTableWidgetItem *> *ql = new QList<QTableWidgetItem *>;
len = PySequence_Size(sipPy);
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
QTableWidgetItem *t = reinterpret_cast<QTableWidgetItem *>(sipConvertToType(itm, sipType_QTableWidgetItem, sipTransferObj, 0, 0, sipIsErr));
Py_DECREF(itm);
if (*sipIsErr)
{
delete ql;
return 0;
}
ql->append(t);
}
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
#line 118 "/home/vikky/Desktop/DVCS/stuff/scrapy/soft/PyQt-x11-gpl-4.11.4/QtGui/sipQtGuiQList0101QTableWidgetItem.cpp"
}
开发者ID:annelida,项目名称:stuff,代码行数:51,代码来源:sipQtGuiQList0101QTableWidgetItem.cpp
示例8: convertTo_QList_0101QAction
static int convertTo_QList_0101QAction(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
{
QList< ::QAction*> **sipCppPtr = reinterpret_cast<QList< ::QAction*> **>(sipCppPtrV);
#line 145 "sip/QtCore/qlist.sip"
SIP_SSIZE_T len;
// Check the type if that is all that is required.
if (sipIsErr == NULL)
{
if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
return 0;
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
bool ok = (itm && sipCanConvertToType(itm, sipType_QAction, 0));
Py_XDECREF(itm);
if (!ok)
return 0;
}
return 1;
}
QList<QAction *> *ql = new QList<QAction *>;
len = PySequence_Size(sipPy);
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
QAction *t = reinterpret_cast<QAction *>(sipConvertToType(itm, sipType_QAction, sipTransferObj, 0, 0, sipIsErr));
Py_DECREF(itm);
if (*sipIsErr)
{
delete ql;
return 0;
}
ql->append(t);
}
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
#line 118 "/home/thais/Faculdade/TCC/NEW/PyQt4_gpl_x11-4.12/QtGui/sipQtGuiQList0101QAction.cpp"
}
开发者ID:thaisdb,项目名称:TCC,代码行数:51,代码来源:sipQtGuiQList0101QAction.cpp
示例9: convertTo_QList_0101qt_gui_cpp_PluginProvider
static int convertTo_QList_0101qt_gui_cpp_PluginProvider(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
{
QList<qt_gui_cpp::PluginProvider*> **sipCppPtr = reinterpret_cast<QList<qt_gui_cpp::PluginProvider*> **>(sipCppPtrV);
#line 145 "/usr/share/sip/PyQt4/QtCore/qlist.sip"
SIP_SSIZE_T len;
// Check the type if that is all that is required.
if (sipIsErr == NULL)
{
if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
return 0;
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
bool ok = (itm && sipCanConvertToType(itm, sipType_qt_gui_cpp_PluginProvider, 0));
Py_XDECREF(itm);
if (!ok)
return 0;
}
return 1;
}
QList<qt_gui_cpp::PluginProvider *> *ql = new QList<qt_gui_cpp::PluginProvider *>;
len = PySequence_Size(sipPy);
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
qt_gui_cpp::PluginProvider *t = reinterpret_cast<qt_gui_cpp::PluginProvider *>(sipConvertToType(itm, sipType_qt_gui_cpp_PluginProvider, sipTransferObj, 0, 0, sipIsErr));
Py_DECREF(itm);
if (*sipIsErr)
{
delete ql;
return 0;
}
ql->append(t);
}
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
#line 101 "/opt/ros_catkin_ws/build_isolated/qt_gui_cpp/sip/qt_gui_cpp_sip/siplibqt_gui_cpp_sipQList0101qt_gui_cppPluginProvider.cpp"
}
开发者ID:twighk,项目名称:ROS-Pi3,代码行数:51,代码来源:siplibqt_gui_cpp_sipQList0101qt_gui_cppPluginProvider.cpp
示例10: convertTo_QList_0101QAction
static int convertTo_QList_0101QAction(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
{
QList<QAction*> **sipCppPtr = reinterpret_cast<QList<QAction*> **>(sipCppPtrV);
#line 150 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/sip/QtCore/qlist.sip"
SIP_SSIZE_T len;
// Check the type if that is all that is required.
if (sipIsErr == NULL)
{
if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
return 0;
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
bool ok = (itm && sipCanConvertToType(itm, sipType_QAction, 0));
Py_XDECREF(itm);
if (!ok)
return 0;
}
return 1;
}
QList<QAction *> *ql = new QList<QAction *>;
len = PySequence_Size(sipPy);
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(sipPy, i);
QAction *t = reinterpret_cast<QAction *>(sipConvertToType(itm, sipType_QAction, sipTransferObj, 0, 0, sipIsErr));
Py_DECREF(itm);
if (*sipIsErr)
{
delete ql;
return 0;
}
ql->append(t);
}
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
#line 123 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/QtGui/sipQtGuiQList0101QAction.cpp"
}
开发者ID:kunwijik,项目名称:Spectroscopy_paper,代码行数:51,代码来源:sipQtGuiQList0101QAction.cpp
示例11: qpycore_PySequence_AsQStringList
// Convert a Python sequence object to a QStringList. This should only be
// called after a successful call to qpycore_PySequence_Check_QStringList().
QStringList qpycore_PySequence_AsQStringList(PyObject *obj)
{
QStringList qstrlst;
SIP_SSIZE_T len = PySequence_Size(obj);
for (SIP_SSIZE_T i = 0; i < len; ++i)
{
PyObject *itm = PySequence_ITEM(obj, i);
int state, iserr = 0;
QString *qs = reinterpret_cast<QString *>(sipConvertToType(itm, sipType_QString, 0, SIP_NOT_NONE, &state, &iserr));
Py_DECREF(itm);
if (iserr)
{
// This should never happen.
sipReleaseType(qs, sipType_QString, state);
return QStringList();
}
qstrlst.append(*qs);
sipReleaseType(qs, sipType_QString, state);
}
return qstrlst;
}
开发者ID:ClydeMojura,项目名称:android-python27,代码行数:29,代码来源:qpycore_qstringlist.cpp
示例12: ColMap_construct_list
int
ColMap_construct_list(ColMap *self, PyObject *map)
{
int i = 0, len = 0;
int *lmap;
PyObject*tmp;
if(!PySequence_Check(map)){
return 0;
}
len = (int)PySequence_Size(map);
if(len<0)
return 0;
self->lmap_len = len;
lmap = PyMem_Malloc(sizeof(int) * len);
if(lmap==NULL)
return 0;
for(i=0; i<len; ++i){
tmp = PySequence_ITEM(map, (Py_ssize_t)i);
if(tmp==NULL){
return 0;
}
lmap[i] = (int)PyInt_AsLong(tmp);
}
self->lmap = lmap;
return 1;
}
开发者ID:takada-at,项目名称:logq,代码行数:27,代码来源:colmap.c
示例13: _py_build_signature
static bool
_py_build_signature(uint32_t *argc, int **signature, PyObject *co_argcount, PyObject *co_varnames, PyObject *annotations)
{
bool success = false;
assert(argc != NULL);
assert(*argc == 0);
assert(signature != NULL);
assert(*signature == NULL);
assert(co_argcount != NULL);
assert(PyLong_Check(co_argcount));
assert(co_varnames != NULL);
assert(PySequence_Check(co_varnames));
assert(annotations != NULL);
assert(PyMapping_Check(annotations));
long argcount = PyLong_AsLong(co_argcount);
if(argcount > 0)
{
PyObject *var = PySequence_ITEM(co_varnames, 0);
CallbackArgType type = _py_map_typehint(annotations, var);
Py_XDECREF(var);
if(type == CALLBACK_ARG_TYPE_STRING)
{
*argc = argcount - 1;
if(*argc)
{
*signature = utils_new(*argc, int);
}
else
{
开发者ID:20centaurifux,项目名称:efind,代码行数:35,代码来源:py-ext-backend.c
示例14: __Pyx_unpack_tuple2
static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
int is_tuple, int has_known_size, int decref_tuple) {
Py_ssize_t index;
PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
if (!is_tuple && unlikely(!PyTuple_Check(tuple))) {
iternextfunc iternext;
iter = PyObject_GetIter(tuple);
if (unlikely(!iter)) goto bad;
if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
iternext = Py_TYPE(iter)->tp_iternext;
value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
Py_DECREF(iter);
} else {
if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) {
__Pyx_UnpackTupleError(tuple, 2);
goto bad;
}
#if CYTHON_COMPILING_IN_PYPY
value1 = PySequence_ITEM(tuple, 0);
if (unlikely(!value1)) goto bad;
value2 = PySequence_ITEM(tuple, 1);
if (unlikely(!value2)) goto bad;
#else
value1 = PyTuple_GET_ITEM(tuple, 0);
value2 = PyTuple_GET_ITEM(tuple, 1);
Py_INCREF(value1);
Py_INCREF(value2);
#endif
if (decref_tuple) { Py_DECREF(tuple); }
}
*pvalue1 = value1;
*pvalue2 = value2;
return 0;
unpacking_failed:
if (!has_known_size && __Pyx_IterFinish() == 0)
__Pyx_RaiseNeedMoreValuesError(index);
bad:
Py_XDECREF(iter);
Py_XDECREF(value1);
Py_XDECREF(value2);
if (decref_tuple) { Py_XDECREF(tuple); }
return -1;
}
开发者ID:JoanesL,项目名称:montepython,代码行数:45,代码来源:ObjectHandling.c
示例15: _moo_pyobject_to_boxed_array
int
_moo_pyobject_to_boxed_array (PyObject *obj,
MooPtrArray **dest)
{
int len, i;
PyTypeObject *type;
type = moo_get_pygboxed_type();
g_return_val_if_fail(type != NULL, FALSE);
if (obj == Py_None)
{
*dest = NULL;
return TRUE;
}
if (!PySequence_Check(obj))
{
PyErr_SetString(PyExc_TypeError,
"argument must be a sequence");
return FALSE;
}
len = PySequence_Size(obj);
if (len < 0)
{
PyErr_SetString(PyExc_RuntimeError,
"got negative length of a sequence");
return FALSE;
}
for (i = 0; i < len; ++i)
{
PyObject *item = PySequence_ITEM(obj, i);
g_return_val_if_fail(item != NULL, FALSE);
// TODO: doesn't check types, will crash
if (!PyObject_TypeCheck(item, &PyGBoxed_Type))
{
PyErr_SetString(PyExc_TypeError,
"argument must be a sequence of boxed objects");
return FALSE;
}
}
*dest = _moo_pyobject_to_boxed_array_no_check(obj, len);
return TRUE;
}
开发者ID:cmotc,项目名称:medit,代码行数:51,代码来源:moopython-utils.c
示例16: __Pyx_CyFunction_init_defaults
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
int result = 0;
PyObject *res = op->defaults_getter((PyObject *) op);
if (unlikely(!res))
return -1;
// Cache result
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
Py_INCREF(op->defaults_tuple);
op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
Py_INCREF(op->defaults_kwdict);
#else
op->defaults_tuple = PySequence_ITEM(res, 0);
if (unlikely(!op->defaults_tuple)) result = -1;
else {
op->defaults_kwdict = PySequence_ITEM(res, 1);
if (unlikely(!op->defaults_kwdict)) result = -1;
}
#endif
Py_DECREF(res);
return result;
}
开发者ID:iamnik13,项目名称:catboost,代码行数:24,代码来源:CythonFunction.c
示例17: _moo_pyobject_to_object_array_no_check
static MooObjectArray *
_moo_pyobject_to_object_array_no_check (PyObject *seq,
int len)
{
int i;
MooObjectArray *ar;
ar = moo_object_array_new ();
for (i = 0; i < len; ++i)
{
PyObject *item = PySequence_ITEM (seq, i);
moo_object_array_append (ar, pygobject_get (item));
}
return ar;
}
开发者ID:cmotc,项目名称:medit,代码行数:17,代码来源:moopython-utils.c
示例18: _moo_pyobject_to_strv
int _moo_pyobject_to_strv (PyObject *obj, char ***dest)
{
int len, i;
if (obj == Py_None)
{
*dest = NULL;
return TRUE;
}
if (!PySequence_Check (obj))
{
PyErr_SetString (PyExc_TypeError,
"argument must be a sequence");
return FALSE;
}
len = PySequence_Size (obj);
if (len < 0)
{
PyErr_SetString (PyExc_RuntimeError,
"got negative length of a sequence");
return FALSE;
}
for (i = 0; i < len; ++i)
{
PyObject *item = PySequence_ITEM (obj, i);
g_return_val_if_fail (item != NULL, FALSE);
if (!PyString_Check (item))
{
PyErr_SetString (PyExc_TypeError,
"argument must be a sequence of strings");
return FALSE;
}
}
*dest = _moo_pyobject_to_strv_no_check (obj, len);
return TRUE;
}
开发者ID:cmotc,项目名称:medit,代码行数:44,代码来源:moopython-utils.c
示例19: __Pyx_Globals
static PyObject* __Pyx_Globals(void) {
Py_ssize_t i;
PyObject *names;
PyObject *globals = $moddict_cname;
Py_INCREF(globals);
names = PyObject_Dir($module_cname);
if (!names)
goto bad;
for (i = PyList_GET_SIZE(names)-1; i >= 0; i--) {
#if CYTHON_COMPILING_IN_PYPY
PyObject* name = PySequence_ITEM(names, i);
if (!name)
goto bad;
#else
PyObject* name = PyList_GET_ITEM(names, i);
#endif
if (!PyDict_Contains(globals, name)) {
PyObject* value = __Pyx_GetAttr($module_cname, name);
if (!value) {
#if CYTHON_COMPILING_IN_PYPY
Py_DECREF(name);
#endif
goto bad;
}
if (PyDict_SetItem(globals, name, value) < 0) {
#if CYTHON_COMPILING_IN_PYPY
Py_DECREF(name);
#endif
Py_DECREF(value);
goto bad;
}
}
#if CYTHON_COMPILING_IN_PYPY
Py_DECREF(name);
#endif
}
Py_DECREF(names);
return globals;
bad:
Py_XDECREF(names);
Py_XDECREF(globals);
return NULL;
}
开发者ID:iamnik13,项目名称:catboost,代码行数:43,代码来源:Builtins.c
示例20: _moo_pyobject_to_boxed_array_no_check
static MooPtrArray *
_moo_pyobject_to_boxed_array_no_check(PyObject *seq,
int len)
{
int i;
MooPtrArray *ar;
ar = moo_ptr_array_new();
moo_ptr_array_reserve(ar, len);
for (i = 0; i < len; ++i)
{
PyObject *item = PySequence_ITEM(seq, i);
gpointer elm = g_boxed_copy(((PyGBoxed*)item)->gtype, pyg_boxed_get(item, void));
moo_ptr_array_append(ar, elm);
}
return ar;
}
开发者ID:cmotc,项目名称:medit,代码行数:19,代码来源:moopython-utils.c
注:本文中的PySequence_ITEM函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论