summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-12-29 18:56:13 +0100
committerJelmer Vernooij <jelmer@samba.org>2011-01-01 03:39:58 +0100
commit5792fa90ace06f736661d9924ec9a75c3a0a9771 (patch)
tree189f5bcd84247351d641f758cc914cf99b6af407 /source4/lib
parentf5fe9c32ef833d3f1ee4b891f46e94382aa182fe (diff)
downloadsamba-5792fa90ace06f736661d9924ec9a75c3a0a9771.tar.gz
samba-5792fa90ace06f736661d9924ec9a75c3a0a9771.tar.bz2
samba-5792fa90ace06f736661d9924ec9a75c3a0a9771.zip
s4-python: Only set BASETYPE flag if subclassing is supported.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sat Jan 1 03:39:58 CET 2011 on sn-devel-104
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb-samba/pyldb.c15
-rw-r--r--source4/lib/ldb/pyldb.c8
-rw-r--r--source4/lib/messaging/pymessaging.c4
3 files changed, 12 insertions, 15 deletions
diff --git a/source4/lib/ldb-samba/pyldb.c b/source4/lib/ldb-samba/pyldb.c
index cce653e20a..472a4664ea 100644
--- a/source4/lib/ldb-samba/pyldb.c
+++ b/source4/lib/ldb-samba/pyldb.c
@@ -45,8 +45,6 @@ static void PyErr_SetLdbError(PyObject *error, int ret, struct ldb_context *ldb_
ldb_ctx == NULL?ldb_strerror(ret):ldb_errstring(ldb_ctx)));
}
-
-
static PyObject *py_ldb_set_loadparm(PyObject *self, PyObject *args)
{
PyObject *py_lp_ctx;
@@ -116,33 +114,33 @@ static PyObject *py_ldb_set_opaque_integer(PyObject *self, PyObject *args)
if (old_val) {
*old_val = value;
Py_RETURN_NONE;
- }
+ }
tmp_ctx = talloc_new(ldb);
if (tmp_ctx == NULL) {
PyErr_NoMemory();
return NULL;
}
-
+
new_val = talloc(tmp_ctx, int);
if (new_val == NULL) {
talloc_free(tmp_ctx);
PyErr_NoMemory();
return NULL;
}
-
+
opaque_name_talloc = talloc_strdup(tmp_ctx, py_opaque_name);
if (opaque_name_talloc == NULL) {
talloc_free(tmp_ctx);
PyErr_NoMemory();
return NULL;
}
-
+
*new_val = value;
/* cache the domain_sid in the ldb */
ret = ldb_set_opaque(ldb, opaque_name_talloc, new_val);
-
+
if (ret != LDB_SUCCESS) {
talloc_free(tmp_ctx);
PyErr_SetLdbError(py_ldb_error, ret, ldb);
@@ -240,13 +238,12 @@ static PyMethodDef py_samba_ldb_methods[] = {
};
static PyTypeObject PySambaLdb = {
- .tp_name = "samba.Ldb",
+ .tp_name = "samba._ldb.Ldb",
.tp_doc = "Connection to a LDB database.",
.tp_methods = py_samba_ldb_methods,
.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
};
-
void init_ldb(void)
{
PyObject *m;
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index 71720d60e0..354e83d8d3 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -8,9 +8,9 @@
Copyright (C) 2007-2010 Jelmer Vernooij <jelmer@samba.org>
Copyright (C) 2009-2010 Matthias Dieter Wallnöfer
- ** NOTE! The following LGPL license applies to the ldb
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
+ ** NOTE! The following LGPL license applies to the ldb
+ ** library. This does NOT imply that all of Samba is released
+ ** under the LGPL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -1502,7 +1502,7 @@ static PyObject *PyLdb_FromLdbContext(struct ldb_context *ldb_ctx)
static void py_ldb_dealloc(PyLdbObject *self)
{
talloc_free(self->mem_ctx);
- PyObject_Del(self);
+ self->ob_type->tp_free(self);
}
PyTypeObject PyLdb = {
diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c
index 9854f4f95e..aece5efd09 100644
--- a/source4/lib/messaging/pymessaging.c
+++ b/source4/lib/messaging/pymessaging.c
@@ -61,7 +61,7 @@ typedef struct {
struct messaging_context *msg_ctx;
} messaging_Object;
-PyObject *py_messaging_connect(PyTypeObject *self, PyObject *args, PyObject *kwargs)
+static PyObject *py_messaging_connect(PyTypeObject *self, PyObject *args, PyObject *kwargs)
{
struct tevent_context *ev;
const char *kwnames[] = { "own_id", "messaging_path", NULL };
@@ -118,7 +118,7 @@ static void py_messaging_dealloc(PyObject *self)
{
messaging_Object *iface = (messaging_Object *)self;
talloc_free(iface->msg_ctx);
- PyObject_Del(self);
+ self->ob_type->tp_free(self);
}
static PyObject *py_messaging_send(PyObject *self, PyObject *args, PyObject *kwargs)