本文整理汇总了C++中PyErr_SetNone函数的典型用法代码示例。如果您正苦于以下问题:C++ PyErr_SetNone函数的具体用法?C++ PyErr_SetNone怎么用?C++ PyErr_SetNone使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PyErr_SetNone函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PyErr_NoMemory
PyObject *
PyErr_NoMemory(void)
{
if (Py_TYPE(PyExc_MemoryError) == NULL) {
/* PyErr_NoMemory() has been called before PyExc_MemoryError has been
initialized by _PyExc_Init() */
Py_FatalError("Out of memory and PyExc_MemoryError is not "
"initialized yet");
}
PyErr_SetNone(PyExc_MemoryError);
return NULL;
}
示例2: PyErr_SetNone
static PyObject *bpy_bmeditseliter_next(BPy_BMEditSelIter *self)
{
BMEditSelection *ese = self->ese;
if (ese == NULL) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
else {
self->ese = ese->next;
return (PyObject *)BPy_BMElem_CreatePyObject(self->bm, &ese->ele->head);
}
}
示例3: PyErr_SetNone
static PyObject *orientedViewEdgeIterator_iternext(BPy_orientedViewEdgeIterator *self)
{
ViewVertex::directedViewEdge *dve;
if (self->reversed) {
if (self->ove_it->isBegin()) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
self->ove_it->decrement();
dve = self->ove_it->operator->();
}
else {
if (self->ove_it->isEnd()) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
dve = self->ove_it->operator->();
self->ove_it->increment();
}
return BPy_directedViewEdge_from_directedViewEdge(*dve);
}
示例4: PyErr_SetNone
static PyObject *StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self)
{
StrokeVertex *sv;
if (self->reversed) {
if (self->sv_it->isBegin()) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
self->sv_it->decrement();
sv = self->sv_it->operator->();
}
else {
if (self->sv_it->isEnd()) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
sv = self->sv_it->operator->();
self->sv_it->increment();
}
return BPy_StrokeVertex_from_StrokeVertex(*sv);
}
示例5: PyErr_SetNone
static PyObject *Interface0DIterator_iternext(BPy_Interface0DIterator *self)
{
Interface0D *if0D;
if (self->reversed) {
if (self->if0D_it->isBegin()) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
self->if0D_it->decrement();
if0D = self->if0D_it->operator->();
}
else {
if (self->if0D_it->isEnd()) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
if0D = self->if0D_it->operator->();
self->if0D_it->increment();
}
return Any_BPy_Interface0D_from_Interface0D(*if0D);
}
示例6: channel_iternext
static PyObject *
channel_iternext(PyChannelObject *self)
{
STACKLESS_GETARG();
if (self->flags.closing && self->balance <= 0) {
/* signal the end of the iteration */
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
STACKLESS_PROMOTE_ALL();
return impl_channel_receive(self);
}
示例7: pyMessageWithCallbacks_delCallback
static PyObject* pyMessageWithCallbacks_delCallback(pyMessageWithCallbacks* self, PyObject* args) {
Py_ssize_t idx;
if (!PyArg_ParseTuple(args, "n", &idx)) {
PyErr_SetString(PyExc_TypeError, "delCallback expects an int");
return NULL;
}
if (size_t(idx) >= self->fThis->getCallbacks().size()) {
PyErr_SetNone(PyExc_IndexError);
return NULL;
}
self->fThis->delCallback((size_t)idx);
Py_INCREF(Py_None);
return Py_None;
}
示例8: uwsgi_Input_getline
PyObject *uwsgi_Input_next(PyObject* self) {
PyObject *line = uwsgi_Input_getline((uwsgi_Input *)self, 0);
if (!line) return NULL;
if (PyString_Size(line) == 0) {
Py_DECREF(line);
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
return line;
}
示例9: STATUS_CALL
static PyObject *t_collationelementiterator_iter_next(t_collationelementiterator *self)
{
int n;
STATUS_CALL(n = self->object->next(status));
if (n == CollationElementIterator::NULLORDER)
{
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
return PyInt_FromLong(n);
}
示例10: IO_iternext
static PyObject *
IO_iternext(Iobject *self)
{
PyObject *next;
next = IO_readline((IOobject *)self, NULL);
if (!next)
return NULL;
if (!PyString_GET_SIZE(next)) {
Py_DECREF(next);
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
return next;
}
示例11: STATUS_CALL
static PyObject *t_searchiterator_iter_next(t_searchiterator *self)
{
int32_t offset;
STATUS_CALL(offset = self->object->next(status));
if (offset == USEARCH_DONE)
{
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
return PyInt_FromLong(offset);
}
示例12: branch_cb
JSBool
branch_cb(JSContext* jscx, JSScript* script)
{
Context* pycx = (Context*) JS_GetContextPrivate(jscx);
time_t now = time(NULL);
if(pycx == NULL)
{
JS_ReportError(jscx, "Failed to find Python context.");
return JS_FALSE;
}
// Get out quick if we don't have any quotas.
if(pycx->max_time == 0 && pycx->max_heap == 0)
{
return JS_TRUE;
}
// Only check occasionally for resource usage.
pycx->branch_count++;
if((pycx->branch_count > 0x3FFF) != 1)
{
return JS_TRUE;
}
pycx->branch_count = 0;
if(pycx->max_heap > 0 && jscx->runtime->gcBytes > pycx->max_heap)
{
// First see if garbage collection gets under the threshold.
JS_GC(jscx);
if(jscx->runtime->gcBytes > pycx->max_heap)
{
PyErr_NoMemory();
return JS_FALSE;
}
}
if(
pycx->max_time > 0
&& pycx->start_time > 0
&& pycx->max_time < now - pycx->start_time
)
{
PyErr_SetNone(PyExc_SystemError);
return JS_FALSE;
}
return JS_TRUE;
}
示例13: PyErr_SetNone
static PyObject *StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self)
{
/* Because Freestyle iterators for which it.isEnd() holds true have no valid object
* (referencing it.object in this case leads to a crash), we must check if it.object
* is valid after incrementing, to prevent crashes in Python.
* Additionally, the at_start attribute is used to keep Freestyle iterator objects
* and Python for loops in sync. */
if (self->reversed) {
if (self->sv_it->isBegin()) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
self->sv_it->decrement();
}
else {
if (self->sv_it->isEnd()) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
/* if at the start of the iterator, only return the object
* and don't increment, to keep for-loops in sync */
if (self->at_start)
self->at_start = false;
/* after incrementing, check if the iterator is at its end
* exit the loop if it is. not doing so will result in a crash */
else {
self->sv_it->increment();
if (self->sv_it->isEnd()) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
}
}
StrokeVertex *sv = self->sv_it->operator->();
return BPy_StrokeVertex_from_StrokeVertex(*sv);
}
示例14: handle_bio_errors
/*
* Handle errors raised by BIO functions.
*
* Arguments: bio - The BIO object
* ret - The return value of the BIO_ function.
* Returns: None, the calling function should return NULL;
*/
static void
handle_bio_errors(BIO* bio, int ret)
{
if (BIO_should_retry(bio)) {
if (BIO_should_read(bio)) {
PyErr_SetNone(ssl_WantReadError);
} else if (BIO_should_write(bio)) {
PyErr_SetNone(ssl_WantWriteError);
} else if (BIO_should_io_special(bio)) {
/*
* It's somewhat unclear what this means. From the OpenSSL source,
* it seems like it should not be triggered by the memory BIO, so
* for the time being, this case shouldn't come up. The SSL BIO
* (which I think should be named the socket BIO) may trigger this
* case if its socket is not yet connected or it is busy doing
* something related to x509.
*/
PyErr_SetString(PyExc_ValueError, "BIO_should_io_special");
} else {
/*
* I hope this is dead code. The BIO documentation suggests that
* one of the above three checks should always be true.
*/
PyErr_SetString(PyExc_ValueError, "unknown bio failure");
}
} else {
/*
* If we aren't to retry, it's really an error, so fall back to the
* normal error reporting code. However, the BIO interface does not
* specify a uniform error reporting mechanism. We can only hope that
* the code which triggered the error also kindly pushed something onto
* the error stack.
*/
exception_from_error_queue(ssl_Error);
}
}
示例15: PyUNFO_ObjListIter_iternext
PyObject* PyUNFO_ObjListIter_iternext(PyObject *self) {
PyObject *ret;
if (((PyUNFO_ObjListIter*)self)->it) {
ret = pyobjlist_getitem(((PyUNFO_ObjListIter*)self)->seq,
((PyUNFO_ObjListIter*)self)->pos);
}
if (((PyUNFO_ObjListIter*)self)->it) {
((PyUNFO_ObjListIter*)self)->it = ((PyUNFO_ObjListIter*)self)->it->next;
((PyUNFO_ObjListIter*)self)->pos += 1;
} else {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
return ret;
}