[SCM] Samba Shared Repository - branch master updated - d2c70d24e12293d9b4272eb310a6a4c4582b2d92

Jelmer Vernooij jelmer at samba.org
Tue Jan 6 03:15:07 GMT 2009


The branch, master has been updated
       via  d2c70d24e12293d9b4272eb310a6a4c4582b2d92 (commit)
      from  1f8b6238dd161d29ee92902ea006158e180fa87b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d2c70d24e12293d9b4272eb310a6a4c4582b2d92
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Tue Jan 6 04:13:57 2009 +0100

    py: Properly increase the reference counter of Py_None.

-----------------------------------------------------------------------

Summary of changes:
 lib/tdb/pytdb.c                          |   32 +++++++-------
 lib/tevent/pytevent.c                    |    2 +-
 libcli/nbt/pynbt.c                       |    2 +-
 pidl/lib/Parse/Pidl/Samba4/Python.pm     |    2 +-
 source4/auth/credentials/pycredentials.c |   12 +++---
 source4/lib/com/pycom.c                  |    2 +-
 source4/lib/ldb/pyldb.c                  |   72 +++++++++++++++---------------
 source4/lib/messaging/pymessaging.c      |    8 ++--
 source4/lib/registry/pyregistry.c        |   18 ++++----
 source4/librpc/ndr/py_security.c         |   10 ++--
 source4/librpc/rpc/pyrpc.c               |    4 +-
 source4/param/pyparam.c                  |    8 ++--
 source4/scripting/python/pyglue.c        |   16 +++---
 source4/web_server/wsgi.c                |    8 ++--
 14 files changed, 98 insertions(+), 98 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tdb/pytdb.c b/lib/tdb/pytdb.c
index b7087c4..88f6f4e 100644
--- a/lib/tdb/pytdb.c
+++ b/lib/tdb/pytdb.c
@@ -61,7 +61,7 @@ static TDB_DATA PyString_AsTDB_DATA(PyObject *data)
 static PyObject *PyString_FromTDB_DATA(TDB_DATA data)
 {
 	if (data.dptr == NULL && data.dsize == 0) {
-		return Py_None;
+		Py_RETURN_NONE;
 	} else {
 		PyObject *ret = PyString_FromStringAndSize((const char *)data.dptr, 
 												   data.dsize);
@@ -103,74 +103,74 @@ static PyObject *obj_transaction_cancel(PyTdbObject *self)
 {
 	int ret = tdb_transaction_cancel(self->ctx);
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *obj_transaction_commit(PyTdbObject *self)
 {
 	int ret = tdb_transaction_commit(self->ctx);
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *obj_transaction_recover(PyTdbObject *self)
 {
 	int ret = tdb_transaction_recover(self->ctx);
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *obj_transaction_start(PyTdbObject *self)
 {
 	int ret = tdb_transaction_start(self->ctx);
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *obj_reopen(PyTdbObject *self)
 {
 	int ret = tdb_reopen(self->ctx);
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *obj_lockall(PyTdbObject *self)
 {
 	int ret = tdb_lockall(self->ctx);
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *obj_unlockall(PyTdbObject *self)
 {
 	int ret = tdb_unlockall(self->ctx);
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *obj_lockall_read(PyTdbObject *self)
 {
 	int ret = tdb_lockall_read(self->ctx);
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *obj_unlockall_read(PyTdbObject *self)
 {
 	int ret = tdb_unlockall_read(self->ctx);
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *obj_close(PyTdbObject *self)
 {
 	int ret;
 	if (self->closed)
-		return Py_None;
+		Py_RETURN_NONE;
 	ret = tdb_close(self->ctx);
 	self->closed = true;
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 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);
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *obj_firstkey(PyTdbObject *self)
@@ -229,7 +229,7 @@ static PyObject *obj_delete(PyTdbObject *self, PyObject *args)
 	key = PyString_AsTDB_DATA(py_key);
 	ret = tdb_delete(self->ctx, key);
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 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);
 	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);
 	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyMethodDef tdb_object_methods[] = {
diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c
index 3d71d78..f8e6481 100644
--- a/lib/tevent/pytevent.c
+++ b/lib/tevent/pytevent.c
@@ -35,7 +35,7 @@ static PyObject *py_set_default_backend(PyObject *self, PyObject *args)
     if (!PyArg_ParseTuple(args, "s", &name))
         return NULL;
     tevent_set_default_backend(name);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 static PyObject *py_backend_list(PyObject *self)
diff --git a/libcli/nbt/pynbt.c b/libcli/nbt/pynbt.c
index 9afe7ea..8a6d459 100644
--- a/libcli/nbt/pynbt.c
+++ b/libcli/nbt/pynbt.c
@@ -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)
 {
-	return Py_None; /* FIXME */
+	Py_RETURN_NONE; /* FIXME */
 }
 
 static PyMethodDef py_nbt_methods[] = {
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 2474bf4..938ea36 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -283,7 +283,7 @@ sub PythonStruct($$$$$$)
 		$self->deindent;
 		$self->pidl("}");
 		$self->pidl("");
-		$self->pidl("return Py_None;");
+		$self->pidl("Py_RETURN_NONE;");
 		$self->deindent;
 		$self->pidl("}");
 		$self->pidl("");
diff --git a/source4/auth/credentials/pycredentials.c b/source4/auth/credentials/pycredentials.c
index 4fa9fe5..903ca2f 100644
--- a/source4/auth/credentials/pycredentials.c
+++ b/source4/auth/credentials/pycredentials.c
@@ -37,7 +37,7 @@ struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj)
 static PyObject *PyString_FromStringOrNULL(const char *str)
 {
 	if (str == NULL)
-		return Py_None;
+		Py_RETURN_NONE;
 	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)
 {
 	cli_credentials_set_anonymous(self->ptr);
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 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;
 
 	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)
@@ -187,7 +187,7 @@ static PyObject *py_creds_set_kerberos_state(py_talloc_Object *self, PyObject *a
 		return NULL;
 
         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)
@@ -203,7 +203,7 @@ static PyObject *py_creds_guess(py_talloc_Object *self, PyObject *args)
 
 	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)
@@ -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);
 	PyErr_NTSTATUS_IS_ERR_RAISE(status);
 
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyMethodDef py_creds_methods[] = {
diff --git a/source4/lib/com/pycom.c b/source4/lib/com/pycom.c
index 9222be4..55f1fd2 100644
--- a/source4/lib/com/pycom.c
+++ b/source4/lib/com/pycom.c
@@ -56,7 +56,7 @@ static PyObject *py_get_class_object(PyObject *self, PyObject *args)
 	
 	/* FIXME: Magic, integrate with stubs generated by pidl. */
 
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static struct PyMethodDef com_methods[] = {
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index 0dda9aa..0bc6447 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -101,7 +101,7 @@ static PyObject *PyLdbResult_FromResult(struct ldb_result *result)
 	PyObject *ret;
 	int i;
 	if (result == NULL) {
-		return Py_None;
+		Py_RETURN_NONE;
 	} 
 	ret = PyList_New(result->count);
 	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 ? */
 	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)
@@ -381,7 +381,7 @@ static PyObject *py_ldb_set_create_perms(PyTypeObject *self, PyObject *args)
 
 	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)
@@ -392,31 +392,31 @@ static PyObject *py_ldb_set_modules_dir(PyTypeObject *self, PyObject *args)
 
 	ldb_set_modules_dir(PyLdb_AsLdbContext(self), modules_dir);
 
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *py_ldb_transaction_start(PyLdbObject *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)
 {
 	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)
 {
 	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)
 {
 	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)
@@ -428,7 +428,7 @@ static PyObject *py_ldb_get_root_basedn(PyLdbObject *self)
 {
 	struct ldb_dn *dn = ldb_get_root_basedn(PyLdb_AsLdbContext(self));
 	if (dn == NULL)
-		return Py_None;
+		Py_RETURN_NONE;
 	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));
 	if (dn == NULL)
-		return Py_None;
+		Py_RETURN_NONE;
 	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));
 	if (dn == NULL)
-		return Py_None;
+		Py_RETURN_NONE;
 	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));
 	if (dn == NULL)
-		return Py_None;
+		Py_RETURN_NONE;
 	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));
 
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 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));
 	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)
@@ -635,7 +635,7 @@ static PyObject *py_ldb_add(PyLdbObject *self, PyObject *args)
 	ret = ldb_add(PyLdb_AsLdbContext(self), msg);
 	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);
 	PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb);
 
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 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);
 	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)
@@ -690,7 +690,7 @@ static PyObject *py_ldb_schema_attribute_remove(PyLdbObject *self, PyObject *arg
 
 	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)
@@ -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));
 
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *ldb_ldif_to_pyobject(struct ldb_ldif *ldif)
 {
 	if (ldif == NULL) {
-		return Py_None;
+		Py_RETURN_NONE;
 	} else {
 	/* We don't want this attached to the 'ldb' any more */
 		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);
 
 	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) {
 		talloc_free(mem_ctx);
-		return Py_None;
+		Py_RETURN_NONE;
 	}
 
 	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);
 
 	if (data == NULL)
-		return Py_None;
+		Py_RETURN_NONE;
 
 	/* 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);
 
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 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)
 {
 	PyLdbModule_AsModule(self)->ops->start_transaction(PyLdbModule_AsModule(self));
-	return Py_None;
+	Py_RETURN_NONE;
 }
 
 static PyObject *py_ldb_module_end_transaction(PyLdbModuleObject *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)
 {
 	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)
@@ -1138,7 +1138,7 @@ static PyObject *py_ldb_module_add(PyLdbModuleObject *self, PyObject *args)
 
 	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) 
@@ -1160,7 +1160,7 @@ static PyObject *py_ldb_module_modify(PyLdbModuleObject *self, PyObject *args)
 
 	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) 
@@ -1180,7 +1180,7 @@ static PyObject *py_ldb_module_delete(PyLdbModuleObject *self, PyObject *args)
 
 	PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL);
 
-	return Py_None;
+	Py_RETURN_NONE;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list