possible. Patch is writen with Coccinelle.
#endif /* !WITH_THREAD */
PyBuffer_Release(&buf);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
#endif /* !WITH_THREAD */
PyBuffer_Release(&buf);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
get_nullchar_as_None(Py_UCS4 c)
{
if (c == '\0') {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
else
return PyUnicode_FromOrdinal(c);
Py_DECREF(row_iter);
if (PyErr_Occurred())
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static struct PyMethodDef Writer_methods[] = {
return NULL;
}
Py_DECREF(dialect);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
{
if (PyDict_DelItem(_csvstate_global->dialects, name_obj) < 0)
return PyErr_Format(_csvstate_global->error_obj, "unknown dialect");
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
Py_CLEAR(self->key);
Py_CLEAR(self->dict);
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyTypeObject DictRemover_Type = {
if (-1 == PyDict_SetItemString((PyObject *)dict, "_type_", type))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *_byref(PyObject *);
PyObject *as_parameter;
int res;
if (value == Py_None) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
if (PyUnicode_Check(value)) {
PyCArgObject *parg;
PyObject *as_parameter;
int res;
if (value == Py_None) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
if (PyBytes_Check(value)) {
PyCArgObject *parg;
/* None */
if (value == Py_None) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/* Should probably allow buffer interface as well */
/* int, long */
Py_DECREF(mydict);
if (res == -1)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*
return result;
} else if (value == Py_None && PyCPointerTypeObject_Check(type)) {
*(void **)ptr = NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
} else {
PyErr_Format(PyExc_TypeError,
"expected %s instance, got %s",
Py_INCREF(self->errcheck);
return self->errcheck;
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static int
Py_INCREF(dict->restype);
return dict->restype;
} else {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
}
Py_INCREF(dict->argtypes);
return dict->argtypes;
} else {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
}
int i;
if (!PyArg_ParseTuple(args, "si", &name, &i))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
EXPORT(void) _py_func_si(char *s, int i)
PyObject *py_func(PyObject *self, PyObject *args)
{
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
EXPORT(void) _py_func(void)
return PyLong_FromLong(*(int *)result);
if (restype == Py_None) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
dict = PyType_stgdict(restype);
return NULL;
if (!FreeLibrary((HMODULE)hMod))
return PyErr_SetFromWindowsErr(GetLastError());
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static const char copy_com_pointer_doc[] =
ctypes_dlerror());
return NULL;
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *py_dl_sym(PyObject *self, PyObject *args)
obj->b_size = size;
}
done:
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
return PyBytes_FromStringAndSize(*(char **)ptr,
strlen(*(char **)ptr));
} else {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
}
#else
*(wchar_t **)ptr = (wchar_t *)PyLong_AsUnsignedLongMask(value);
#endif
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
if (!PyUnicode_Check(value)) {
PyErr_Format(PyExc_TypeError,
if (p) {
return PyUnicode_FromWideChar(p, wcslen(p));
} else {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
}
#endif
/* Hm, it seems NULL pointer and zero length string are the
same in BSTR, see Don Box, p 81
*/
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
}
#endif
P_get(void *ptr, Py_ssize_t size)
{
if (*(void **)ptr == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
return PyLong_FromVoidPtr(*(void **)ptr);
}
PyCursesCheckERR(int code, const char *fname)
{
if (code != ERR) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
} else {
if (fname == NULL) {
PyErr_SetString(_curses_panelstate_global->PyCursesError, catchall_ERR);
#define Panel_NoArgTrueFalseFunction(X) \
static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self) \
{ \
- if (X (self->pan) == FALSE) { Py_INCREF(Py_False); return Py_False; } \
- else { Py_INCREF(Py_True); return Py_True; } }
+ if (X (self->pan) == FALSE) { Py_RETURN_FALSE; } \
+ else { Py_RETURN_TRUE; } }
#define Panel_TwoArgNoReturnFunction(X, TYPE, PARSESTR) \
static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self, PyObject *args) \
if (pan == NULL) { /* valid output, it means the calling panel
is on top of the stack */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
po = find_po(pan);
if (po == NULL) {
if (pan == NULL) { /* valid output, it means the calling panel
is on the bottom of the stack */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
po = find_po(pan);
if (po == NULL) {
}
Py_INCREF(temp);
Py_SETREF(po->wo, temp);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
if (pan == NULL) { /* valid output, it means
there's no panel at all */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
po = find_po(pan);
if (po == NULL) {
if (pan == NULL) { /* valid output, it means
there's no panel at all */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
po = find_po(pan);
if (po == NULL) {
{
PyCursesInitialised;
update_panels();
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyCursesCheckERR(int code, const char *fname)
{
if (code != ERR) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
} else {
if (fname == NULL) {
PyErr_SetString(PyCursesError, catchall_ERR);
static PyObject * PyCursesWindow_ ## X \
(PyCursesWindowObject *self) \
{ \
- if (X (self->win) == FALSE) { Py_INCREF(Py_False); return Py_False; } \
- else { Py_INCREF(Py_True); return Py_True; } }
+ if (X (self->win) == FALSE) { Py_RETURN_FALSE; } \
+ else { Py_RETURN_TRUE; } }
#define Window_NoArgNoReturnVoidFunction(X) \
static PyObject * PyCursesWindow_ ## X \
(PyCursesWindowObject *self) \
{ \
- X(self->win); Py_INCREF(Py_None); return Py_None; }
+ X(self->win); Py_RETURN_NONE; }
#define Window_NoArg2TupleReturnFunction(X, TYPE, ERGSTR) \
static PyObject * PyCursesWindow_ ## X \
{ \
TYPE arg1; \
if (!PyArg_ParseTuple(args, PARSESTR, &arg1)) return NULL; \
- X(self->win,arg1); Py_INCREF(Py_None); return Py_None; }
+ X(self->win,arg1); Py_RETURN_NONE; }
#define Window_OneArgNoReturnFunction(X, TYPE, PARSESTR) \
static PyObject * PyCursesWindow_ ## X \
wborder(self->win,
ch[0], ch[1], ch[2], ch[3],
ch[4], ch[5], ch[6], ch[7]);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
return NULL;
}
box(self->win,ch1,ch2);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#if defined(HAVE_NCURSES_H) || defined(MVWDELCH_IS_EXPRESSION)
return NULL;
} else
if (erg == FALSE) {
- Py_INCREF(Py_False);
- return Py_False;
+ Py_RETURN_FALSE;
} else {
- Py_INCREF(Py_True);
- return Py_True;
+ Py_RETURN_TRUE;
}
}
/* not checking for PyCursesInitialised here since filter() must
be called before initscr() */
filter();
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
if (!PyArg_ParseTuple(args,"i",&ch)) return NULL;
if (has_key(ch) == FALSE) {
- Py_INCREF(Py_False);
- return Py_False;
+ Py_RETURN_FALSE;
}
- Py_INCREF(Py_True);
- return Py_True;
+ Py_RETURN_TRUE;
}
#endif /* STRICT_SYSV_CURSES */
initialised_setupterm = TRUE;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
return NULL;
result = is_term_resized(lines, columns);
if (result == TRUE) {
- Py_INCREF(Py_True);
- return Py_True;
+ Py_RETURN_TRUE;
} else {
- Py_INCREF(Py_False);
- return Py_False;
+ Py_RETURN_FALSE;
}
}
#endif /* HAVE_CURSES_IS_TERM_RESIZED */
switch(PyTuple_Size(args)) {
case 0:
qiflush();
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
case 1:
if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL;
if (flag) qiflush();
else noqiflush();
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
default:
PyErr_SetString(PyExc_TypeError, "qiflush requires 0 or 1 arguments");
return NULL;
setsyx(y,x);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
return NULL;
PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp);
Py_DECREF(cp);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
} else {
PyErr_SetString(PyCursesError, "start_color() returned ERR");
return NULL;
capname = tigetstr( capname );
if (capname == 0 || capname == (char*) -1) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
return PyBytes_FromString( capname );
}
return NULL;
}
use_env(flag);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#ifndef STRICT_SYSV_CURSES
code = use_default_colors();
if (code != ERR) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
} else {
PyErr_SetString(PyCursesError, "use_default_colors() returned ERR");
return NULL;
if (self->di_dbm)
dbm_close(self->di_dbm);
self->di_dbm = NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
if (self->di_dbm)
gdbm_close(self->di_dbm);
self->di_dbm = NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/* XXX Should return a set or a set view */
return v;
}
else {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
}
return v;
}
else {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
}
PyErr_SetString(DbmError, gdbm_strerror(gdbm_errno));
return NULL;
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
{
check_dbmobject_open(self);
gdbm_sync(self->di_dbm);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
return res;
}
Py_DECREF(res);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
remaining -= r;
written += r;
return res;
}
Py_DECREF(res);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
if (remaining > r) {
memcpy(out + written, self->buffer + self->pos, r);
return NULL;
PyEval_SetProfile(profiler_callback, (PyObject*)self);
self->flags |= POF_ENABLED;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static void
flush_unmatched(self);
if (pending_exception(self))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(clear_doc, "\
profiler_clear(ProfilerObject *pObj, PyObject* noarg)
{
clearEntries(pObj);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static void
}
self->index = (int)index;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
proxyDict = SCDynamicStoreCopyProxies(NULL);
if (!proxyDict) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
result = PyDict_New();
}
PyBuffer_Release(&buf);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
if (PyErr_Occurred()) {
return NULL;
} else {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
}
if (PyErr_Occurred()) {
return NULL;
} else {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
}
if (PyErr_Occurred()) {
return NULL;
} else {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
}
/* want empty string */
i = j = 0;
else {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
} else {
i = STATE_OFFSET(state, state->mark[index]);
{
if (self->lastindex >= 0)
return PyLong_FromSsize_t(self->lastindex);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
return result;
PyErr_Clear();
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
} else if (status == 0) {
/* no match */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PySSL_END_ALLOW_THREADS
self->handshake_done = 1;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
error:
Py_XDECREF(sock);
buf += written;
len -= written;
} while (len);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
#undef CHECK_SIZEOF
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject*
Py_DECREF(list);
#undef NLIST
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static int
}
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject*
return raiseTestError("test_long_and_overflow",
"overflow was not cleared");
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/* Test the PyLong_AsLongLongAndOverflow API. General conversion to
return raiseTestError("test_long_long_and_overflow",
"overflow was not cleared");
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/* Test the PyLong_As{Size,Ssize}_t API. At present this just tests that
"L code returned wrong value for int 42");
Py_DECREF(tuple);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
"k code returned wrong value for long -0xFFF..000042");
Py_DECREF(tuple);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
"u# code returned wrong values for u'test'");
Py_DECREF(tuple);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/* Test Z and Z# codes for PyArg_ParseTuple */
return raiseTestError("test_long_numbits",
"wrong result for _PyLong_Sign");
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/* Example passing NULLs to PyObject_Str(NULL). */
if (r<0) {
Py_DECREF(callable); /* unsuccessful add, destroy the extra reference */
- Py_INCREF(Py_False);
- return Py_False;
+ Py_RETURN_FALSE;
}
- Py_INCREF(Py_True);
- return Py_True;
+ Py_RETURN_TRUE;
}
#endif
Py_DECREF(op1);
print_delta(7, &start, &stop);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#endif
Py_INCREF(o);
return o;
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyThread_release_lock(self->lock_lock);
self->locked = 0;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(release_doc,
thread_PyThread_interrupt_main(PyObject * self)
{
PyErr_SetInterrupt();
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(interrupt_doc,
{
if (ins1(self, where, v) != 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
if (cmp > 0) {
if (array_del_slice(self, i, i+1) != 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
else if (cmp < 0)
return NULL;
{
if (array_do_extend(self, bb) == -1)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
"don't know how to byteswap this array type");
return NULL;
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
}
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
}
done:
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
}
}
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
buffer->buf, n * itemsize);
}
PyBuffer_Release(buffer);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
faulthandler_disable_py(PyObject *self)
{
if (!fatal_error.enabled) {
- Py_INCREF(Py_False);
- return Py_False;
+ Py_RETURN_FALSE;
}
faulthandler_disable();
- Py_INCREF(Py_True);
- return Py_True;
+ Py_RETURN_TRUE;
}
static PyObject*
/* Do any architecture-specific one-time only initialization here. */
fpe_reset(sigfpe_handler);
- Py_INCREF (Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static void fpe_reset(Sigfunc *handler)
#else
fputs("Operation not implemented\n", stderr);
#endif
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static void sigfpe_handler(int signo)
r = nest2(2, 2.0);
printerr(r);
- Py_INCREF (Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static void printerr(double r)
gc_enable(PyObject *self, PyObject *noargs)
{
enabled = 1;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(gc_disable__doc__,
gc_disable(PyObject *self, PyObject *noargs)
{
enabled = 0;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(gc_isenabled__doc__,
if (!PyArg_ParseTuple(args, "i:set_debug", &debug))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(gc_get_debug__doc__,
generations[i].threshold = generations[2].threshold;
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(gc_get_thresh__doc__,
md5_process(&self->hash_state, buf.buf, buf.len);
PyBuffer_Release(&buf);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyMethodDef MD5_methods[] = {
}
#endif
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#ifdef MS_WINDOWS
if (self->pos < self->size) {
self->data[self->pos++] = value;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
else {
PyErr_SetString(PyExc_ValueError, "write byte out of range");
new_size);
if (self->data != NULL) {
self->size = new_size;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
} else {
dwErrCode = GetLastError();
CloseHandle(self->map_handle);
}
self->data = newmap;
self->size = new_size;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
#endif /* HAVE_MREMAP */
#endif /* UNIX */
}
if (where > self->size || where < 0)
goto onoutofrange;
self->pos = where;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
onoutofrange:
memmove(&self->data[dest], &self->data[src], cnt);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
bounds:
PyErr_SetString(PyExc_ValueError,
if (rv == -1)
return PyErr_SetFromErrno(PyExc_IOError);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
mode once we're in non-blocking mode! */
if (ioctl(self->fd, SNDCTL_DSP_NONBLOCK, NULL) == -1)
return PyErr_SetFromErrno(PyExc_IOError);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
cp += rv;
}
PyBuffer_Release(&data);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
Py_END_ALLOW_THREADS
self->fd = -1;
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
close(self->fd);
self->fd = -1;
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
PyObject *result = NULL, *w;
if (n == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
if (ISNONTERMINAL(TYPE(n))) {
/* Return old value */
return PyBool_FromLong(_stat_float_times);
_stat_float_times = newval;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *billion = NULL;
if (res == -1)
return PyErr_SetFromErrno(PyExc_OSError);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#endif /* HAVE_INITGROUPS */
if (setpgrp() < 0)
#endif /* SETPGRP_HAVE_ARG */
return posix_error();
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#endif /* HAVE_SETPGRP */
if (setreuid(ruid, euid) < 0) {
return posix_error();
} else {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
}
#endif /* HAVE_SETREUID */
if (setgroups(len, grouplist) < 0)
return posix_error();
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#endif /* HAVE_SETGROUPS */
and hence in UTF-8. */
/* UTF-8 from Expat, Unicode desired */
if (str == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
return PyUnicode_DecodeUTF8(str, strlen(str), "strict");
}
and hence in UTF-8. */
/* UTF-8 from Expat, Unicode desired */
if (str == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
return PyUnicode_DecodeUTF8((const char *)str, len, "strict");
}
if (rc != XML_ERROR_NONE) {
return set_error(self, rc);
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#endif
return get_pybool((long) self->specified_attributes);
if (_PyUnicode_EqualToASCIIString(nameobj, "intern")) {
if (self->intern == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
else {
Py_INCREF(self->intern);
self->ufd_uptodate = 0;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(poll_modify_doc,
self->ufd_uptodate = 0;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
Py_DECREF(key);
self->ufd_uptodate = 0;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(poll_poll_doc,
sha1_process(&self->hash_state, buf.buf, buf.len);
PyBuffer_Release(&buf);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyMethodDef SHA1_methods[] = {
sha_update(self, buf.buf, buf.len);
PyBuffer_Release(&buf);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyMethodDef SHA_methods[] = {
sha512_update(self, buf.buf, buf.len);
PyBuffer_Release(&buf);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
dump buffer
{
if (addrlen == 0) {
/* No address -- may be recvfrom() from known socket */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
switch (addr->sa_family) {
sock_gettimeout(PySocketSockObject *s)
{
if (s->sock_timeout < 0) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
else {
double seconds = _PyTime_AsSecondsDouble(s->sock_timeout);
Py_END_ALLOW_THREADS
if (res < 0)
return s->errorhandler();
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(bind_doc,
return s->errorhandler();
}
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(close_doc,
Py_END_ALLOW_THREADS
if (res < 0)
return s->errorhandler();
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(listen_doc,
Py_END_ALLOW_THREADS
if (res < 0)
return s->errorhandler();
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(shutdown_doc,
socket_getdefaulttimeout(PyObject *self)
{
if (defaulttimeout < 0) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
else {
double seconds = _PyTime_AsSecondsDouble(defaulttimeout);
defaulttimeout = timeout;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(setdefaulttimeout_doc,
openlog(ident, logopt, facility);
S_log_open = 1;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
Py_CLEAR(S_ident_o);
S_log_open = 0;
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
if (tcsetattr(fd, when, &mode) == -1)
return PyErr_SetFromErrno(TermiosError);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(termios_tcsendbreak__doc__,
if (tcsendbreak(fd, duration) == -1)
return PyErr_SetFromErrno(TermiosError);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(termios_tcdrain__doc__,
if (tcdrain(fd) == -1)
return PyErr_SetFromErrno(TermiosError);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(termios_tcflush__doc__,
if (tcflush(fd, queue) == -1)
return PyErr_SetFromErrno(TermiosError);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(termios_tcflow__doc__,
if (tcflow(fd, action) == -1)
return PyErr_SetFromErrno(TermiosError);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyMethodDef termios_methods[] =
}
if (pysleep(secs) != 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(sleep_doc,
if (PyErr_Occurred())
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(tzset_doc,
}
/* we have the module, but no source */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(doc_find_module,
PySys_FormatStderr("# %R has bad magic\n",
pathname);
}
- Py_INCREF(Py_None);
- return Py_None; /* signal caller to try alternative */
+ Py_RETURN_NONE; /* signal caller to try alternative */
}
if (mtime != 0 && !eq_mtime(get_uint32(buf + 4), mtime)) {
PySys_FormatStderr("# %R has bad mtime\n",
pathname);
}
- Py_INCREF(Py_None);
- return Py_None; /* signal caller to try alternative */
+ Py_RETURN_NONE; /* signal caller to try alternative */
}
/* XXX the pyc's size field is ignored; timestamp collisions are probably
member_get_doc(PyMemberDescrObject *descr, void *closure)
{
if (descr->d_member->doc == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
return PyUnicode_FromString(descr->d_member->doc);
}
getset_get_doc(PyGetSetDescrObject *descr, void *closure)
{
if (descr->d_getset->doc == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
return PyUnicode_FromString(descr->d_getset->doc);
}
BaseException_get_args(PyBaseExceptionObject *self)
{
if (self->args == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
Py_INCREF(self->args);
return self->args;
BaseException_get_tb(PyBaseExceptionObject *self)
{
if (self->traceback == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
Py_INCREF(self->traceback);
return self->traceback;
static PyObject *
get_closed(PyStdPrinter_Object *self, void *closure)
{
- Py_INCREF(Py_False);
- return Py_False;
+ Py_RETURN_FALSE;
}
static PyObject *
func_get_defaults(PyFunctionObject *op)
{
if (op->func_defaults == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
Py_INCREF(op->func_defaults);
return op->func_defaults;
func_get_kwdefaults(PyFunctionObject *op)
{
if (op->func_kwdefaults == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
Py_INCREF(op->func_kwdefaults);
return op->func_kwdefaults;
if (PyErr_ExceptionMatches(PyExc_StopIteration)
|| PyErr_ExceptionMatches(PyExc_GeneratorExit)) {
PyErr_Clear(); /* ignore these errors */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
return NULL;
}
/* We have an item that differs -- shortcuts for EQ/NE */
if (op == Py_EQ) {
- Py_INCREF(Py_False);
- return Py_False;
+ Py_RETURN_FALSE;
}
if (op == Py_NE) {
- Py_INCREF(Py_True);
- return Py_True;
+ Py_RETURN_TRUE;
}
/* Compare the final item again using the proper operator */
/* We have an item that differs -- shortcuts for EQ/NE */
if (op == Py_EQ) {
- Py_INCREF(Py_False);
- return Py_False;
+ Py_RETURN_FALSE;
}
if (op == Py_NE) {
- Py_INCREF(Py_True);
- return Py_True;
+ Py_RETURN_TRUE;
}
/* Compare the final item again using the proper operator */
const char *doc = _PyType_DocWithoutSignature(name, internal_doc);
if (!doc || *doc == '\0') {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
return PyUnicode_FromString(doc);
else
end = NULL;
if (!end) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/* back "end" up until it points just past the final ')' */
type_dict(PyTypeObject *type, void *context)
{
if (type->tp_dict == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
return PyDictProxy_New(type->tp_dict);
}
res = (*func)(self, i, value);
if (res == -1 && PyErr_Occurred())
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
res = (*func)(self, i, NULL);
if (res == -1 && PyErr_Occurred())
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/* XXX objobjproc is a misnomer; should be objargpred */
res = (*func)(self, key, value);
if (res == -1 && PyErr_Occurred())
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
res = (*func)(self, key, NULL);
if (res == -1 && PyErr_Occurred())
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/* Helper to check for object.__setattr__ or __delattr__ applied to a type.
res = (*func)(self, name, value);
if (res < 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
res = (*func)(self, name, NULL);
if (res < 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
ret = (*func)(self, obj, value);
if (ret < 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
ret = (*func)(self, obj, NULL);
if (ret < 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
if (func(self, args, kwds) < 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
if (PyErr_ExceptionMatches(PyExc_LookupError)) {
/* No mapping found means: mapping is undefined. */
PyErr_Clear();
- x = Py_None;
- Py_INCREF(x);
- return x;
+ Py_RETURN_NONE;
} else
return NULL;
}
if (!FCIDestroy(hfci))
goto err;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
err:
if(erf.fError)
PyErr_Format(PyExc_ValueError, "FCI error %d", erf.erfOper); /* XXX better error type */
{
MsiCloseHandle(msidb->h);
msidb->h = 0;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject*
if (status != ERROR_SUCCESS)
return msierror(status);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject*
if ((status = MsiRecordSetStringW(record->h, field, data)) != ERROR_SUCCESS)
return msierror(status);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject*
if ((status = MsiRecordSetStreamW(record->h, field, data)) != ERROR_SUCCESS)
return msierror(status);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject*
if ((status = MsiRecordSetInteger(record->h, field, data)) != ERROR_SUCCESS)
return msierror(status);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
if (status != ERROR_SUCCESS)
return msierror(status);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
status = MsiSummaryInfoPersist(si->h);
if (status != ERROR_SUCCESS)
return msierror(status);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyMethodDef summary_methods[] = {
if (status != ERROR_SUCCESS)
return msierror(status);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject*
if ((status = MsiViewModify(view->h, kind, ((msiobj*)data)->h)) != ERROR_SUCCESS)
return msierror(status);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject*
if ((status = MsiViewClose(view->h)) != ERROR_SUCCESS)
return msierror(status);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyMethodDef view_methods[] = {
if ((status = MsiDatabaseCommit(msidb->h)) != ERROR_SUCCESS)
return msierror(status);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject*
mod_ty o = (mod_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
switch (o->kind) {
stmt_ty o = (stmt_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
switch (o->kind) {
expr_ty o = (expr_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
switch (o->kind) {
slice_ty o = (slice_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
switch (o->kind) {
comprehension_ty o = (comprehension_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
result = PyType_GenericNew(comprehension_type, NULL, NULL);
excepthandler_ty o = (excepthandler_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
switch (o->kind) {
arguments_ty o = (arguments_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
result = PyType_GenericNew(arguments_type, NULL, NULL);
arg_ty o = (arg_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
result = PyType_GenericNew(arg_type, NULL, NULL);
keyword_ty o = (keyword_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
result = PyType_GenericNew(keyword_type, NULL, NULL);
alias_ty o = (alias_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
result = PyType_GenericNew(alias_type, NULL, NULL);
withitem_ty o = (withitem_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
result = PyType_GenericNew(withitem_type, NULL, NULL);
{
if (PyObject_SetAttr(obj, name, value) != 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
{
if (PyObject_SetAttr(obj, name, (PyObject *)NULL) != 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#ifdef WITH_THREAD
_PyImport_AcquireLock();
#endif
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
return NULL;
}
#endif
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
void
if (ret < 0)
return NULL;
if (ret == 0) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
m = PyImport_AddModuleObject(name);
Py_XINCREF(m);
if (n < 0)
return NULL;
if (n == 0) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
va_copy(lva, va);
if (n == 1) {
/* After printing, also assign to '_' */
/* Before, set '_' to None to avoid recursion */
if (o == Py_None) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
if (_PyObject_SetAttrId(builtins, &PyId__, Py_None) != 0)
return NULL;
return NULL;
if (_PyObject_SetAttrId(builtins, &PyId__, o) != 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(displayhook_doc,
if (!PyArg_UnpackTuple(args, "excepthook", 3, 3, &exc, &value, &tb))
return NULL;
PyErr_Display(exc, value, tb);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(excepthook_doc,
PyEval_SetTrace(NULL, NULL);
else
PyEval_SetTrace(trace_trampoline, args);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(settrace_doc,
PyEval_SetProfile(NULL, NULL);
else
PyEval_SetProfile(profile_trampoline, args);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(setprofile_doc,
return NULL;
if (!PyArg_ParseTuple(args, "i:setcheckinterval", &_check_interval))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(setcheckinterval_doc,
return NULL;
}
_PyEval_SetSwitchInterval((unsigned long) (1e6 * d));
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(setswitchinterval_doc,
}
Py_SetRecursionLimit(new_limit);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
if (!tstate)
return NULL;
tstate->interp->dlopenflags = new_val;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(setdlopenflags_doc,
if (!PyArg_ParseTuple(args, "i:mdebug", &flag))
return NULL;
mallopt(M_DEBUG, flag);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#endif /* USE_MALLOPT */