1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-31 20:22:15 +03:00

py: Properly increase the reference counter of Py_None.

This commit is contained in:
Jelmer Vernooij
2009-01-06 04:13:57 +01:00
parent 1f8b6238dd
commit d2c70d24e1
14 changed files with 98 additions and 98 deletions

View File

@ -61,7 +61,7 @@ static TDB_DATA PyString_AsTDB_DATA(PyObject *data)
static PyObject *PyString_FromTDB_DATA(TDB_DATA data) static PyObject *PyString_FromTDB_DATA(TDB_DATA data)
{ {
if (data.dptr == NULL && data.dsize == 0) { if (data.dptr == NULL && data.dsize == 0) {
return Py_None; Py_RETURN_NONE;
} else { } else {
PyObject *ret = PyString_FromStringAndSize((const char *)data.dptr, PyObject *ret = PyString_FromStringAndSize((const char *)data.dptr,
data.dsize); data.dsize);
@ -103,74 +103,74 @@ static PyObject *obj_transaction_cancel(PyTdbObject *self)
{ {
int ret = tdb_transaction_cancel(self->ctx); int ret = tdb_transaction_cancel(self->ctx);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *obj_transaction_commit(PyTdbObject *self) static PyObject *obj_transaction_commit(PyTdbObject *self)
{ {
int ret = tdb_transaction_commit(self->ctx); int ret = tdb_transaction_commit(self->ctx);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *obj_transaction_recover(PyTdbObject *self) static PyObject *obj_transaction_recover(PyTdbObject *self)
{ {
int ret = tdb_transaction_recover(self->ctx); int ret = tdb_transaction_recover(self->ctx);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *obj_transaction_start(PyTdbObject *self) static PyObject *obj_transaction_start(PyTdbObject *self)
{ {
int ret = tdb_transaction_start(self->ctx); int ret = tdb_transaction_start(self->ctx);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *obj_reopen(PyTdbObject *self) static PyObject *obj_reopen(PyTdbObject *self)
{ {
int ret = tdb_reopen(self->ctx); int ret = tdb_reopen(self->ctx);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *obj_lockall(PyTdbObject *self) static PyObject *obj_lockall(PyTdbObject *self)
{ {
int ret = tdb_lockall(self->ctx); int ret = tdb_lockall(self->ctx);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *obj_unlockall(PyTdbObject *self) static PyObject *obj_unlockall(PyTdbObject *self)
{ {
int ret = tdb_unlockall(self->ctx); int ret = tdb_unlockall(self->ctx);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *obj_lockall_read(PyTdbObject *self) static PyObject *obj_lockall_read(PyTdbObject *self)
{ {
int ret = tdb_lockall_read(self->ctx); int ret = tdb_lockall_read(self->ctx);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *obj_unlockall_read(PyTdbObject *self) static PyObject *obj_unlockall_read(PyTdbObject *self)
{ {
int ret = tdb_unlockall_read(self->ctx); int ret = tdb_unlockall_read(self->ctx);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *obj_close(PyTdbObject *self) static PyObject *obj_close(PyTdbObject *self)
{ {
int ret; int ret;
if (self->closed) if (self->closed)
return Py_None; Py_RETURN_NONE;
ret = tdb_close(self->ctx); ret = tdb_close(self->ctx);
self->closed = true; self->closed = true;
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *obj_get(PyTdbObject *self, PyObject *args) static PyObject *obj_get(PyTdbObject *self, PyObject *args)
@ -198,7 +198,7 @@ static PyObject *obj_append(PyTdbObject *self, PyObject *args)
ret = tdb_append(self->ctx, key, data); ret = tdb_append(self->ctx, key, data);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *obj_firstkey(PyTdbObject *self) static PyObject *obj_firstkey(PyTdbObject *self)
@ -229,7 +229,7 @@ static PyObject *obj_delete(PyTdbObject *self, PyObject *args)
key = PyString_AsTDB_DATA(py_key); key = PyString_AsTDB_DATA(py_key);
ret = tdb_delete(self->ctx, key); ret = tdb_delete(self->ctx, key);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *obj_has_key(PyTdbObject *self, PyObject *args) static PyObject *obj_has_key(PyTdbObject *self, PyObject *args)
@ -264,7 +264,7 @@ static PyObject *obj_store(PyTdbObject *self, PyObject *args)
ret = tdb_store(self->ctx, key, value, flag); ret = tdb_store(self->ctx, key, value, flag);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
@ -316,7 +316,7 @@ static PyObject *obj_clear(PyTdbObject *self)
{ {
int ret = tdb_wipe_all(self->ctx); int ret = tdb_wipe_all(self->ctx);
PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyMethodDef tdb_object_methods[] = { static PyMethodDef tdb_object_methods[] = {

View File

@ -35,7 +35,7 @@ static PyObject *py_set_default_backend(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s", &name)) if (!PyArg_ParseTuple(args, "s", &name))
return NULL; return NULL;
tevent_set_default_backend(name); tevent_set_default_backend(name);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_backend_list(PyObject *self) static PyObject *py_backend_list(PyObject *self)

View File

@ -363,7 +363,7 @@ static PyObject *py_nbt_name_refresh(PyObject *self, PyObject *args, PyObject *k
static PyObject *py_nbt_name_release(PyObject *self, PyObject *args, PyObject *kwargs) static PyObject *py_nbt_name_release(PyObject *self, PyObject *args, PyObject *kwargs)
{ {
return Py_None; /* FIXME */ Py_RETURN_NONE; /* FIXME */
} }
static PyMethodDef py_nbt_methods[] = { static PyMethodDef py_nbt_methods[] = {

View File

@ -283,7 +283,7 @@ sub PythonStruct($$$$$$)
$self->deindent; $self->deindent;
$self->pidl("}"); $self->pidl("}");
$self->pidl(""); $self->pidl("");
$self->pidl("return Py_None;"); $self->pidl("Py_RETURN_NONE;");
$self->deindent; $self->deindent;
$self->pidl("}"); $self->pidl("}");
$self->pidl(""); $self->pidl("");

View File

@ -37,7 +37,7 @@ struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj)
static PyObject *PyString_FromStringOrNULL(const char *str) static PyObject *PyString_FromStringOrNULL(const char *str)
{ {
if (str == NULL) if (str == NULL)
return Py_None; Py_RETURN_NONE;
return PyString_FromString(str); return PyString_FromString(str);
} }
@ -144,7 +144,7 @@ static PyObject *py_creds_is_anonymous(py_talloc_Object *self)
static PyObject *py_creds_set_anonymous(py_talloc_Object *self) static PyObject *py_creds_set_anonymous(py_talloc_Object *self)
{ {
cli_credentials_set_anonymous(self->ptr); cli_credentials_set_anonymous(self->ptr);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_creds_authentication_requested(py_talloc_Object *self) static PyObject *py_creds_authentication_requested(py_talloc_Object *self)
@ -170,7 +170,7 @@ static PyObject *py_creds_parse_string(py_talloc_Object *self, PyObject *args)
return NULL; return NULL;
cli_credentials_parse_string(self->ptr, newval, obt); cli_credentials_parse_string(self->ptr, newval, obt);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_creds_get_nt_hash(py_talloc_Object *self) static PyObject *py_creds_get_nt_hash(py_talloc_Object *self)
@ -187,7 +187,7 @@ static PyObject *py_creds_set_kerberos_state(py_talloc_Object *self, PyObject *a
return NULL; return NULL;
cli_credentials_set_kerberos_state(self->ptr, state); cli_credentials_set_kerberos_state(self->ptr, state);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_creds_guess(py_talloc_Object *self, PyObject *args) static PyObject *py_creds_guess(py_talloc_Object *self, PyObject *args)
@ -203,7 +203,7 @@ static PyObject *py_creds_guess(py_talloc_Object *self, PyObject *args)
cli_credentials_guess(self->ptr, lp_ctx); cli_credentials_guess(self->ptr, lp_ctx);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_creds_set_machine_account(py_talloc_Object *self, PyObject *args) static PyObject *py_creds_set_machine_account(py_talloc_Object *self, PyObject *args)
@ -221,7 +221,7 @@ static PyObject *py_creds_set_machine_account(py_talloc_Object *self, PyObject *
status = cli_credentials_set_machine_account(self->ptr, lp_ctx); status = cli_credentials_set_machine_account(self->ptr, lp_ctx);
PyErr_NTSTATUS_IS_ERR_RAISE(status); PyErr_NTSTATUS_IS_ERR_RAISE(status);
return Py_None; Py_RETURN_NONE;
} }
static PyMethodDef py_creds_methods[] = { static PyMethodDef py_creds_methods[] = {

View File

@ -56,7 +56,7 @@ static PyObject *py_get_class_object(PyObject *self, PyObject *args)
/* FIXME: Magic, integrate with stubs generated by pidl. */ /* FIXME: Magic, integrate with stubs generated by pidl. */
return Py_None; Py_RETURN_NONE;
} }
static struct PyMethodDef com_methods[] = { static struct PyMethodDef com_methods[] = {

View File

@ -101,7 +101,7 @@ static PyObject *PyLdbResult_FromResult(struct ldb_result *result)
PyObject *ret; PyObject *ret;
int i; int i;
if (result == NULL) { if (result == NULL) {
return Py_None; Py_RETURN_NONE;
} }
ret = PyList_New(result->count); ret = PyList_New(result->count);
for (i = 0; i < result->count; i++) { for (i = 0; i < result->count; i++) {
@ -370,7 +370,7 @@ static PyObject *py_ldb_set_debug(PyLdbObject *self, PyObject *args)
/* FIXME: Where do we DECREF cb ? */ /* FIXME: Where do we DECREF cb ? */
PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_set_debug(self->ldb_ctx, py_ldb_debug, cb), PyLdb_AsLdbContext(self)); PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_set_debug(self->ldb_ctx, py_ldb_debug, cb), PyLdb_AsLdbContext(self));
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_set_create_perms(PyTypeObject *self, PyObject *args) static PyObject *py_ldb_set_create_perms(PyTypeObject *self, PyObject *args)
@ -381,7 +381,7 @@ static PyObject *py_ldb_set_create_perms(PyTypeObject *self, PyObject *args)
ldb_set_create_perms(PyLdb_AsLdbContext(self), perms); ldb_set_create_perms(PyLdb_AsLdbContext(self), perms);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_set_modules_dir(PyTypeObject *self, PyObject *args) static PyObject *py_ldb_set_modules_dir(PyTypeObject *self, PyObject *args)
@ -392,31 +392,31 @@ static PyObject *py_ldb_set_modules_dir(PyTypeObject *self, PyObject *args)
ldb_set_modules_dir(PyLdb_AsLdbContext(self), modules_dir); ldb_set_modules_dir(PyLdb_AsLdbContext(self), modules_dir);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_transaction_start(PyLdbObject *self) static PyObject *py_ldb_transaction_start(PyLdbObject *self)
{ {
PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_start(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self)); PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_start(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_transaction_commit(PyLdbObject *self) static PyObject *py_ldb_transaction_commit(PyLdbObject *self)
{ {
PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_commit(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self)); PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_commit(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_transaction_cancel(PyLdbObject *self) static PyObject *py_ldb_transaction_cancel(PyLdbObject *self)
{ {
PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_cancel(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self)); PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_cancel(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_setup_wellknown_attributes(PyLdbObject *self) static PyObject *py_ldb_setup_wellknown_attributes(PyLdbObject *self)
{ {
PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_setup_wellknown_attributes(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self)); PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_setup_wellknown_attributes(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_repr(PyLdbObject *self) static PyObject *py_ldb_repr(PyLdbObject *self)
@ -428,7 +428,7 @@ static PyObject *py_ldb_get_root_basedn(PyLdbObject *self)
{ {
struct ldb_dn *dn = ldb_get_root_basedn(PyLdb_AsLdbContext(self)); struct ldb_dn *dn = ldb_get_root_basedn(PyLdb_AsLdbContext(self));
if (dn == NULL) if (dn == NULL)
return Py_None; Py_RETURN_NONE;
return PyLdbDn_FromDn(dn); return PyLdbDn_FromDn(dn);
} }
@ -437,7 +437,7 @@ static PyObject *py_ldb_get_schema_basedn(PyLdbObject *self)
{ {
struct ldb_dn *dn = ldb_get_schema_basedn(PyLdb_AsLdbContext(self)); struct ldb_dn *dn = ldb_get_schema_basedn(PyLdb_AsLdbContext(self));
if (dn == NULL) if (dn == NULL)
return Py_None; Py_RETURN_NONE;
return PyLdbDn_FromDn(dn); return PyLdbDn_FromDn(dn);
} }
@ -446,7 +446,7 @@ static PyObject *py_ldb_get_config_basedn(PyLdbObject *self)
{ {
struct ldb_dn *dn = ldb_get_config_basedn(PyLdb_AsLdbContext(self)); struct ldb_dn *dn = ldb_get_config_basedn(PyLdb_AsLdbContext(self));
if (dn == NULL) if (dn == NULL)
return Py_None; Py_RETURN_NONE;
return PyLdbDn_FromDn(dn); return PyLdbDn_FromDn(dn);
} }
@ -455,7 +455,7 @@ static PyObject *py_ldb_get_default_basedn(PyLdbObject *self)
{ {
struct ldb_dn *dn = ldb_get_default_basedn(PyLdb_AsLdbContext(self)); struct ldb_dn *dn = ldb_get_default_basedn(PyLdb_AsLdbContext(self));
if (dn == NULL) if (dn == NULL)
return Py_None; Py_RETURN_NONE;
return PyLdbDn_FromDn(dn); return PyLdbDn_FromDn(dn);
} }
@ -560,7 +560,7 @@ static PyObject *py_ldb_connect(PyLdbObject *self, PyObject *args, PyObject *kwa
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self)); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self));
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_modify(PyLdbObject *self, PyObject *args) static PyObject *py_ldb_modify(PyLdbObject *self, PyObject *args)
@ -578,7 +578,7 @@ static PyObject *py_ldb_modify(PyLdbObject *self, PyObject *args)
ret = ldb_modify(PyLdb_AsLdbContext(self), PyLdbMessage_AsMessage(py_msg)); ret = ldb_modify(PyLdb_AsLdbContext(self), PyLdbMessage_AsMessage(py_msg));
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self)); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self));
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_add(PyLdbObject *self, PyObject *args) static PyObject *py_ldb_add(PyLdbObject *self, PyObject *args)
@ -635,7 +635,7 @@ static PyObject *py_ldb_add(PyLdbObject *self, PyObject *args)
ret = ldb_add(PyLdb_AsLdbContext(self), msg); ret = ldb_add(PyLdb_AsLdbContext(self), msg);
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self)); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self));
return Py_None; Py_RETURN_NONE;
} }
@ -657,7 +657,7 @@ static PyObject *py_ldb_delete(PyLdbObject *self, PyObject *args)
ret = ldb_delete(ldb, dn); ret = ldb_delete(ldb, dn);
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_rename(PyLdbObject *self, PyObject *args) static PyObject *py_ldb_rename(PyLdbObject *self, PyObject *args)
@ -679,7 +679,7 @@ static PyObject *py_ldb_rename(PyLdbObject *self, PyObject *args)
ret = ldb_rename(ldb, dn1, dn2); ret = ldb_rename(ldb, dn1, dn2);
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_schema_attribute_remove(PyLdbObject *self, PyObject *args) static PyObject *py_ldb_schema_attribute_remove(PyLdbObject *self, PyObject *args)
@ -690,7 +690,7 @@ static PyObject *py_ldb_schema_attribute_remove(PyLdbObject *self, PyObject *arg
ldb_schema_attribute_remove(PyLdb_AsLdbContext(self), name); ldb_schema_attribute_remove(PyLdb_AsLdbContext(self), name);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_schema_attribute_add(PyLdbObject *self, PyObject *args) static PyObject *py_ldb_schema_attribute_add(PyLdbObject *self, PyObject *args)
@ -705,13 +705,13 @@ static PyObject *py_ldb_schema_attribute_add(PyLdbObject *self, PyObject *args)
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self)); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self));
return Py_None; Py_RETURN_NONE;
} }
static PyObject *ldb_ldif_to_pyobject(struct ldb_ldif *ldif) static PyObject *ldb_ldif_to_pyobject(struct ldb_ldif *ldif)
{ {
if (ldif == NULL) { if (ldif == NULL) {
return Py_None; Py_RETURN_NONE;
} else { } else {
/* We don't want this attached to the 'ldb' any more */ /* We don't want this attached to the 'ldb' any more */
talloc_steal(NULL, ldif); talloc_steal(NULL, ldif);
@ -758,12 +758,12 @@ static PyObject *py_ldb_schema_format_value(PyLdbObject *self, PyObject *args)
a = ldb_schema_attribute_by_name(PyLdb_AsLdbContext(self), element_name); a = ldb_schema_attribute_by_name(PyLdb_AsLdbContext(self), element_name);
if (a == NULL) { if (a == NULL) {
return Py_None; Py_RETURN_NONE;
} }
if (a->syntax->ldif_write_fn(PyLdb_AsLdbContext(self), mem_ctx, &old_val, &new_val) != 0) { if (a->syntax->ldif_write_fn(PyLdb_AsLdbContext(self), mem_ctx, &old_val, &new_val) != 0) {
talloc_free(mem_ctx); talloc_free(mem_ctx);
return Py_None; Py_RETURN_NONE;
} }
ret = PyString_FromStringAndSize((const char *)new_val.data, new_val.length); ret = PyString_FromStringAndSize((const char *)new_val.data, new_val.length);
@ -862,7 +862,7 @@ static PyObject *py_ldb_get_opaque(PyLdbObject *self, PyObject *args)
data = ldb_get_opaque(PyLdb_AsLdbContext(self), name); data = ldb_get_opaque(PyLdb_AsLdbContext(self), name);
if (data == NULL) if (data == NULL)
return Py_None; Py_RETURN_NONE;
/* FIXME: More interpretation */ /* FIXME: More interpretation */
@ -881,7 +881,7 @@ static PyObject *py_ldb_set_opaque(PyLdbObject *self, PyObject *args)
ldb_set_opaque(PyLdb_AsLdbContext(self), name, data); ldb_set_opaque(PyLdb_AsLdbContext(self), name, data);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_modules(PyLdbObject *self) static PyObject *py_ldb_modules(PyLdbObject *self)
@ -1077,19 +1077,19 @@ static PyObject *py_ldb_module_str(PyLdbModuleObject *self)
static PyObject *py_ldb_module_start_transaction(PyLdbModuleObject *self) static PyObject *py_ldb_module_start_transaction(PyLdbModuleObject *self)
{ {
PyLdbModule_AsModule(self)->ops->start_transaction(PyLdbModule_AsModule(self)); PyLdbModule_AsModule(self)->ops->start_transaction(PyLdbModule_AsModule(self));
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_module_end_transaction(PyLdbModuleObject *self) static PyObject *py_ldb_module_end_transaction(PyLdbModuleObject *self)
{ {
PyLdbModule_AsModule(self)->ops->end_transaction(PyLdbModule_AsModule(self)); PyLdbModule_AsModule(self)->ops->end_transaction(PyLdbModule_AsModule(self));
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_module_del_transaction(PyLdbModuleObject *self) static PyObject *py_ldb_module_del_transaction(PyLdbModuleObject *self)
{ {
PyLdbModule_AsModule(self)->ops->del_transaction(PyLdbModule_AsModule(self)); PyLdbModule_AsModule(self)->ops->del_transaction(PyLdbModule_AsModule(self));
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_module_search(PyLdbModuleObject *self, PyObject *args, PyObject *kwargs) static PyObject *py_ldb_module_search(PyLdbModuleObject *self, PyObject *args, PyObject *kwargs)
@ -1138,7 +1138,7 @@ static PyObject *py_ldb_module_add(PyLdbModuleObject *self, PyObject *args)
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, mod->ldb); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, mod->ldb);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_module_modify(PyLdbModuleObject *self, PyObject *args) static PyObject *py_ldb_module_modify(PyLdbModuleObject *self, PyObject *args)
@ -1160,7 +1160,7 @@ static PyObject *py_ldb_module_modify(PyLdbModuleObject *self, PyObject *args)
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, mod->ldb); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, mod->ldb);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_module_delete(PyLdbModuleObject *self, PyObject *args) static PyObject *py_ldb_module_delete(PyLdbModuleObject *self, PyObject *args)
@ -1180,7 +1180,7 @@ static PyObject *py_ldb_module_delete(PyLdbModuleObject *self, PyObject *args)
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_module_rename(PyLdbModuleObject *self, PyObject *args) static PyObject *py_ldb_module_rename(PyLdbModuleObject *self, PyObject *args)
@ -1202,7 +1202,7 @@ static PyObject *py_ldb_module_rename(PyLdbModuleObject *self, PyObject *args)
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL);
return Py_None; Py_RETURN_NONE;
} }
static PyMethodDef py_ldb_module_methods[] = { static PyMethodDef py_ldb_module_methods[] = {
@ -1295,7 +1295,7 @@ static PyObject *py_ldb_msg_element_get(PyLdbMessageElementObject *self, PyObjec
if (!PyArg_ParseTuple(args, "i", &i)) if (!PyArg_ParseTuple(args, "i", &i))
return NULL; return NULL;
if (i < 0 || i >= PyLdbMessageElement_AsMessageElement(self)->num_values) if (i < 0 || i >= PyLdbMessageElement_AsMessageElement(self)->num_values)
return Py_None; Py_RETURN_NONE;
return PyObject_FromLdbValue(NULL, PyLdbMessageElement_AsMessageElement(self), return PyObject_FromLdbValue(NULL, PyLdbMessageElement_AsMessageElement(self),
&(PyLdbMessageElement_AsMessageElement(self)->values[i])); &(PyLdbMessageElement_AsMessageElement(self)->values[i]));
@ -1434,7 +1434,7 @@ static PyObject *py_ldb_msg_element_str(PyLdbMessageElementObject *self)
if (el->num_values == 1) if (el->num_values == 1)
return PyString_FromStringAndSize((char *)el->values[0].data, el->values[0].length); return PyString_FromStringAndSize((char *)el->values[0].data, el->values[0].length);
else else
return Py_None; Py_RETURN_NONE;
} }
static void py_ldb_msg_element_dealloc(PyLdbMessageElementObject *self) static void py_ldb_msg_element_dealloc(PyLdbMessageElementObject *self)
@ -1465,7 +1465,7 @@ static PyObject *py_ldb_msg_remove_attr(PyLdbMessageObject *self, PyObject *args
ldb_msg_remove_attr(self->msg, name); ldb_msg_remove_attr(self->msg, name);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_msg_keys(PyLdbMessageObject *self) static PyObject *py_ldb_msg_keys(PyLdbMessageObject *self)
@ -1516,7 +1516,7 @@ static PyObject *py_ldb_msg_get(PyLdbMessageObject *self, PyObject *args)
ret = py_ldb_msg_getitem_helper(self, name); ret = py_ldb_msg_getitem_helper(self, name);
if (ret == NULL) if (ret == NULL)
return Py_None; Py_RETURN_NONE;
return ret; return ret;
} }
@ -1980,7 +1980,7 @@ static PyObject *py_register_module(PyObject *module, PyObject *args)
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_timestring(PyObject *module, PyObject *args) static PyObject *py_timestring(PyObject *module, PyObject *args)

View File

@ -152,7 +152,7 @@ static PyObject *py_messaging_send(PyObject *self, PyObject *args, PyObject *kwa
return NULL; return NULL;
} }
return Py_None; Py_RETURN_NONE;
} }
static void py_msg_callback_wrapper(struct messaging_context *msg, void *private, static void py_msg_callback_wrapper(struct messaging_context *msg, void *private,
@ -214,7 +214,7 @@ static PyObject *py_messaging_deregister(PyObject *self, PyObject *args, PyObjec
Py_DECREF(callback); Py_DECREF(callback);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_messaging_add_name(PyObject *self, PyObject *args, PyObject *kwargs) static PyObject *py_messaging_add_name(PyObject *self, PyObject *args, PyObject *kwargs)
@ -235,7 +235,7 @@ static PyObject *py_messaging_add_name(PyObject *self, PyObject *args, PyObject
return NULL; return NULL;
} }
return Py_None; Py_RETURN_NONE;
} }
@ -252,7 +252,7 @@ static PyObject *py_messaging_remove_name(PyObject *self, PyObject *args, PyObje
irpc_remove_name(iface->msg_ctx, name); irpc_remove_name(iface->msg_ctx, name);
return Py_None; Py_RETURN_NONE;
} }
static PyMethodDef py_messaging_methods[] = { static PyMethodDef py_messaging_methods[] = {

View File

@ -60,7 +60,7 @@ static PyObject *py_key_del_abs(PyObject *self, PyObject *args)
result = reg_key_del_abs(ctx, path); result = reg_key_del_abs(ctx, path);
PyErr_WERROR_IS_ERR_RAISE(result); PyErr_WERROR_IS_ERR_RAISE(result);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_get_predefined_key(PyObject *self, PyObject *args) static PyObject *py_get_predefined_key(PyObject *self, PyObject *args)
@ -90,7 +90,7 @@ static PyObject *py_diff_apply(PyObject *self, PyObject *args)
result = reg_diff_apply(ctx, py_iconv_convenience(NULL), filename); result = reg_diff_apply(ctx, py_iconv_convenience(NULL), filename);
PyErr_WERROR_IS_ERR_RAISE(result); PyErr_WERROR_IS_ERR_RAISE(result);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_mount_hive(PyObject *self, PyObject *args) static PyObject *py_mount_hive(PyObject *self, PyObject *args)
@ -123,7 +123,7 @@ static PyObject *py_mount_hive(PyObject *self, PyObject *args)
result = reg_mount_hive(ctx, py_talloc_get_ptr(py_hivekey), hkey, elements); result = reg_mount_hive(ctx, py_talloc_get_ptr(py_hivekey), hkey, elements);
PyErr_WERROR_IS_ERR_RAISE(result); PyErr_WERROR_IS_ERR_RAISE(result);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *registry_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) static PyObject *registry_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@ -172,7 +172,7 @@ static PyObject *py_hive_key_del(PyObject *self, PyObject *args)
PyErr_WERROR_IS_ERR_RAISE(result); PyErr_WERROR_IS_ERR_RAISE(result);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_hive_key_flush(PyObject *self) static PyObject *py_hive_key_flush(PyObject *self)
@ -183,7 +183,7 @@ static PyObject *py_hive_key_flush(PyObject *self)
result = hive_key_flush(key); result = hive_key_flush(key);
PyErr_WERROR_IS_ERR_RAISE(result); PyErr_WERROR_IS_ERR_RAISE(result);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_hive_key_del_value(PyObject *self, PyObject *args) static PyObject *py_hive_key_del_value(PyObject *self, PyObject *args)
@ -199,7 +199,7 @@ static PyObject *py_hive_key_del_value(PyObject *self, PyObject *args)
PyErr_WERROR_IS_ERR_RAISE(result); PyErr_WERROR_IS_ERR_RAISE(result);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_hive_key_set_value(PyObject *self, PyObject *args) static PyObject *py_hive_key_set_value(PyObject *self, PyObject *args)
@ -220,7 +220,7 @@ static PyObject *py_hive_key_set_value(PyObject *self, PyObject *args)
PyErr_WERROR_IS_ERR_RAISE(result); PyErr_WERROR_IS_ERR_RAISE(result);
return Py_None; Py_RETURN_NONE;
} }
static PyMethodDef hive_key_methods[] = { static PyMethodDef hive_key_methods[] = {
@ -238,7 +238,7 @@ static PyMethodDef hive_key_methods[] = {
static PyObject *hive_open(PyTypeObject *type, PyObject *args, PyObject *kwargs) static PyObject *hive_open(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{ {
/* reg_open_hive */ /* reg_open_hive */
return Py_None; Py_RETURN_NONE;
} }
PyTypeObject PyHiveKey = { PyTypeObject PyHiveKey = {
@ -383,7 +383,7 @@ static PyObject *py_get_predef_name(PyObject *self, PyObject *args)
str = reg_get_predef_name(hkey); str = reg_get_predef_name(hkey);
if (str == NULL) if (str == NULL)
return Py_None; Py_RETURN_NONE;
return PyString_FromString(str); return PyString_FromString(str);
} }

View File

@ -100,7 +100,7 @@ static PyObject *py_descriptor_sacl_add(PyObject *self, PyObject *args)
ace = py_talloc_get_ptr(py_ace); ace = py_talloc_get_ptr(py_ace);
status = security_descriptor_sacl_add(desc, ace); status = security_descriptor_sacl_add(desc, ace);
PyErr_NTSTATUS_IS_ERR_RAISE(status); PyErr_NTSTATUS_IS_ERR_RAISE(status);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_descriptor_dacl_add(PyObject *self, PyObject *args) static PyObject *py_descriptor_dacl_add(PyObject *self, PyObject *args)
@ -117,7 +117,7 @@ static PyObject *py_descriptor_dacl_add(PyObject *self, PyObject *args)
status = security_descriptor_dacl_add(desc, ace); status = security_descriptor_dacl_add(desc, ace);
PyErr_NTSTATUS_IS_ERR_RAISE(status); PyErr_NTSTATUS_IS_ERR_RAISE(status);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_descriptor_dacl_del(PyObject *self, PyObject *args) static PyObject *py_descriptor_dacl_del(PyObject *self, PyObject *args)
@ -133,7 +133,7 @@ static PyObject *py_descriptor_dacl_del(PyObject *self, PyObject *args)
sid = py_talloc_get_ptr(py_sid); sid = py_talloc_get_ptr(py_sid);
status = security_descriptor_dacl_del(desc, sid); status = security_descriptor_dacl_del(desc, sid);
PyErr_NTSTATUS_IS_ERR_RAISE(status); PyErr_NTSTATUS_IS_ERR_RAISE(status);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_descriptor_sacl_del(PyObject *self, PyObject *args) static PyObject *py_descriptor_sacl_del(PyObject *self, PyObject *args)
@ -149,7 +149,7 @@ static PyObject *py_descriptor_sacl_del(PyObject *self, PyObject *args)
sid = py_talloc_get_ptr(py_sid); sid = py_talloc_get_ptr(py_sid);
status = security_descriptor_sacl_del(desc, sid); status = security_descriptor_sacl_del(desc, sid);
PyErr_NTSTATUS_IS_ERR_RAISE(status); PyErr_NTSTATUS_IS_ERR_RAISE(status);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_descriptor_new(PyTypeObject *self, PyObject *args, PyObject *kwargs) static PyObject *py_descriptor_new(PyTypeObject *self, PyObject *args, PyObject *kwargs)
@ -252,7 +252,7 @@ static PyObject *py_token_set_privilege(PyObject *self, PyObject *args)
return NULL; return NULL;
security_token_set_privilege(token, priv); security_token_set_privilege(token, priv);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_token_new(PyTypeObject *self, PyObject *args, PyObject *kwargs) static PyObject *py_token_new(PyTypeObject *self, PyObject *args, PyObject *kwargs)

View File

@ -144,7 +144,7 @@ static PyObject *py_iface_server_name(PyObject *obj, void *closure)
server_name = dcerpc_server_name(iface->pipe); server_name = dcerpc_server_name(iface->pipe);
if (server_name == NULL) if (server_name == NULL)
return Py_None; Py_RETURN_NONE;
return PyString_FromString(server_name); return PyString_FromString(server_name);
} }
@ -284,7 +284,7 @@ static PyObject *py_iface_alter_context(PyObject *self, PyObject *args, PyObject
return NULL; return NULL;
} }
return Py_None; Py_RETURN_NONE;
} }
PyObject *py_dcerpc_interface_init_helper(PyTypeObject *type, PyObject *args, PyObject *kwargs, const struct ndr_interface_table *table) PyObject *py_dcerpc_interface_init_helper(PyTypeObject *type, PyObject *args, PyObject *kwargs, const struct ndr_interface_table *table)

View File

@ -150,7 +150,7 @@ static PyObject *py_lp_ctx_load(py_talloc_Object *self, PyObject *args)
PyErr_Format(PyExc_RuntimeError, "Unable to load file %s", filename); PyErr_Format(PyExc_RuntimeError, "Unable to load file %s", filename);
return NULL; return NULL;
} }
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_lp_ctx_load_default(py_talloc_Object *self) static PyObject *py_lp_ctx_load_default(py_talloc_Object *self)
@ -162,7 +162,7 @@ static PyObject *py_lp_ctx_load_default(py_talloc_Object *self)
PyErr_SetString(PyExc_RuntimeError, "Unable to load default file"); PyErr_SetString(PyExc_RuntimeError, "Unable to load default file");
return NULL; return NULL;
} }
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_lp_ctx_get(py_talloc_Object *self, PyObject *args) static PyObject *py_lp_ctx_get(py_talloc_Object *self, PyObject *args)
@ -175,7 +175,7 @@ static PyObject *py_lp_ctx_get(py_talloc_Object *self, PyObject *args)
ret = py_lp_ctx_get_helper(self->ptr, section_name, param_name); ret = py_lp_ctx_get_helper(self->ptr, section_name, param_name);
if (ret == NULL) if (ret == NULL)
return Py_None; Py_RETURN_NONE;
return ret; return ret;
} }
@ -210,7 +210,7 @@ static PyObject *py_lp_ctx_set(py_talloc_Object *self, PyObject *args)
return NULL; return NULL;
} }
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_lp_ctx_private_path(py_talloc_Object *self, PyObject *args) static PyObject *py_lp_ctx_private_path(py_talloc_Object *self, PyObject *args)

View File

@ -88,7 +88,7 @@ static PyObject *py_ldb_set_credentials(PyObject *self, PyObject *args)
ldb_set_opaque(ldb, "credentials", creds); ldb_set_opaque(ldb, "credentials", creds);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_set_loadparm(PyObject *self, PyObject *args) static PyObject *py_ldb_set_loadparm(PyObject *self, PyObject *args)
@ -109,7 +109,7 @@ static PyObject *py_ldb_set_loadparm(PyObject *self, PyObject *args)
ldb_set_opaque(ldb, "loadparm", lp_ctx); ldb_set_opaque(ldb, "loadparm", lp_ctx);
return Py_None; Py_RETURN_NONE;
} }
@ -131,7 +131,7 @@ static PyObject *py_ldb_set_session_info(PyObject *self, PyObject *args)
ldb_set_opaque(ldb, "sessionInfo", info); ldb_set_opaque(ldb, "sessionInfo", info);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_samdb_set_domain_sid(PyLdbObject *self, PyObject *args) static PyObject *py_samdb_set_domain_sid(PyLdbObject *self, PyObject *args)
@ -153,7 +153,7 @@ static PyObject *py_samdb_set_domain_sid(PyLdbObject *self, PyObject *args)
PyErr_SetString(PyExc_RuntimeError, "set_domain_sid failed"); PyErr_SetString(PyExc_RuntimeError, "set_domain_sid failed");
return NULL; return NULL;
} }
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_ldb_register_samba_handlers(PyObject *self, PyObject *args) static PyObject *py_ldb_register_samba_handlers(PyObject *self, PyObject *args)
@ -169,7 +169,7 @@ static PyObject *py_ldb_register_samba_handlers(PyObject *self, PyObject *args)
ret = ldb_register_samba_handlers(ldb); ret = ldb_register_samba_handlers(ldb);
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_dsdb_set_ntds_invocation_id(PyObject *self, PyObject *args) static PyObject *py_dsdb_set_ntds_invocation_id(PyObject *self, PyObject *args)
@ -189,7 +189,7 @@ static PyObject *py_dsdb_set_ntds_invocation_id(PyObject *self, PyObject *args)
PyErr_SetString(PyExc_RuntimeError, "set_ntds_invocation_id failed"); PyErr_SetString(PyExc_RuntimeError, "set_ntds_invocation_id failed");
return NULL; return NULL;
} }
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_dsdb_set_global_schema(PyObject *self, PyObject *args) static PyObject *py_dsdb_set_global_schema(PyObject *self, PyObject *args)
@ -205,7 +205,7 @@ static PyObject *py_dsdb_set_global_schema(PyObject *self, PyObject *args)
ret = dsdb_set_global_schema(ldb); ret = dsdb_set_global_schema(ldb);
PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb); PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb);
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_dsdb_attach_schema_from_ldif_file(PyObject *self, PyObject *args) static PyObject *py_dsdb_attach_schema_from_ldif_file(PyObject *self, PyObject *args)
@ -223,7 +223,7 @@ static PyObject *py_dsdb_attach_schema_from_ldif_file(PyObject *self, PyObject *
result = dsdb_attach_schema_from_ldif_file(ldb, pf, df); result = dsdb_attach_schema_from_ldif_file(ldb, pf, df);
PyErr_WERROR_IS_ERR_RAISE(result); PyErr_WERROR_IS_ERR_RAISE(result);
return Py_None; Py_RETURN_NONE;
} }
static PyMethodDef py_misc_methods[] = { static PyMethodDef py_misc_methods[] = {

View File

@ -90,7 +90,7 @@ static PyObject *start_response(PyObject *self, PyObject *args, PyObject *kwargs
websrv_output_headers(web, status, headers); websrv_output_headers(web, status, headers);
return Py_None; Py_RETURN_NONE;
} }
static PyMethodDef web_request_methods[] = { static PyMethodDef web_request_methods[] = {
@ -114,7 +114,7 @@ typedef struct {
static PyObject *py_error_flush(PyObject *self, PyObject *args, PyObject *kwargs) static PyObject *py_error_flush(PyObject *self, PyObject *args, PyObject *kwargs)
{ {
/* Nothing to do here */ /* Nothing to do here */
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_error_write(PyObject *self, PyObject *args, PyObject *kwargs) static PyObject *py_error_write(PyObject *self, PyObject *args, PyObject *kwargs)
@ -128,7 +128,7 @@ static PyObject *py_error_write(PyObject *self, PyObject *args, PyObject *kwargs
DEBUG(0, ("WSGI App: %s", str)); DEBUG(0, ("WSGI App: %s", str));
return Py_None; Py_RETURN_NONE;
} }
static PyObject *py_error_writelines(PyObject *self, PyObject *args, PyObject *kwargs) static PyObject *py_error_writelines(PyObject *self, PyObject *args, PyObject *kwargs)
@ -146,7 +146,7 @@ static PyObject *py_error_writelines(PyObject *self, PyObject *args, PyObject *k
DEBUG(0, ("WSGI App: %s", str)); DEBUG(0, ("WSGI App: %s", str));
} }
return Py_None; Py_RETURN_NONE;
} }
static PyMethodDef error_Stream_methods[] = { static PyMethodDef error_Stream_methods[] = {