summaryrefslogtreecommitdiff
path: root/lib/tdb/pytdb.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix clang 9 missing-field-initializer warningsGary Lockyer2020-05-081-1/+1
| | | | Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
* pytdb: add python binding for storev()Jule Anger2020-05-051-0/+49
| | | | | | Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* py3: Remove #define PyInt_FromLong PyLong_FromLongAndrew Bartlett2020-03-231-6/+5
| | | | | | | This allows us to end the use of Python 2/3 compatability macros. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power
* py3: Remove #define PyInt_AsLong PyLong_AsLongAndrew Bartlett2020-03-231-2/+1
| | | | | | | This allows us to end the use of Python 2/3 compatability macros. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <npower@samba.org>
* py3: Remove #define PyInt_Check PyLong_CheckAndrew Bartlett2020-03-231-2/+1
| | | | | | | | This will allow us to remove some unused code in the PIDL-generated python bindings. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <npower@samba.org>
* py3: Remove PyStr_FromFormat() compatability macroAndrew Bartlett2019-06-241-4/+1
| | | | | | | | We no longer need Samba to be py2/py3 compatible so we choose to return to the standard function names. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* py3: Remove PyStr_FromString() compatability macroAndrew Bartlett2019-06-241-3/+1
| | | | | | | | We no longer need Samba to be py2/py3 compatible so we choose to return to the standard function names. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* lib/tdb: squash 'cast between incompatible function types' warningNoel Power2019-05-161-20/+40
| | | | | | | | | | | | | | squash 'cast between incompatible function types' warning To avoid warning above produced by using -Wcast-function-type we; + ensure PyCFunctions of type METH_NOARGS defined dummy arg + ensure PyCFunctions of type METH_KEYWORDS use PY_DISCARD_FUNC_SIG macro Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
* lib:tdb: Use C99 initializer for PyGetSetDef in pytdbAndreas Schneider2019-01-281-18/+34
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* tdb python binding: raise KeyError(key) when the key doesn't existAurelien Aptel2015-07-211-1/+5
| | | | | | | | | | This change makes tdb dicts more consistent with Python dicts. BUG: https://bugzilla.samba.org/show_bug.cgi?id=7416 Signed-off-by: Aurelien Aptel <aaptel@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* pyldb: Add a text-based interface for Python 3Petr Viktorin2015-07-211-0/+18
| | | | | | Signed-off-by: Petr Viktorin <pviktori@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* pytdb: Use new dict API on Python 3Petr Viktorin2015-07-211-8/+34
| | | | | | | | | - Remove has_key() method, add a fast "in" operator - Rename iterkeys() to keys() Signed-off-by: Petr Viktorin <pviktori@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* pytdb: Port to Python 3Petr Viktorin2015-07-211-62/+106
| | | | | | | | | | | | - Use bytes for all data, text strings for repr() - Use PyLong instead of PyInt on py3 - Use new module initialization - Update tests - Run tests in "make test" Signed-off-by: Petr Viktorin <pviktori@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* pytdb: Allow nextkey() to be calledPetr Viktorin2015-07-211-1/+1
| | | | | | | | nextkey() was defined to take no arguments but expected one. Signed-off-by: Petr Viktorin <pviktori@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* pytdb: avoid const warnings by using discard_const_p()Stefan Metzmacher2014-05-121-9/+18
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* samba:python - Py_RETURN_NONE remove compatibility code for releases < 2.4Matthias Dieter Wallnöfer2014-01-091-4/+0
| | | | | | | | | http://www.python.org/doc//current/c-api/none.html Reviewed-By: Jelmer Vernooij <jelmer@samba.org> Autobuild-User(master): Matthias Dieter Wallnöfer <mdw@samba.org> Autobuild-Date(master): Thu Jan 9 16:27:47 CET 2014 on sn-devel-104
* tdb: Fix possible crash bugs in the python tdb code.Andreas Schneider2012-12-121-2/+15
| | | | | | | | You can't call tdb_error() for tdb_reopen() or tdb_close(), both return the error code of close(2) and not a TDB_ERROR! Reviewed-by: Simo Sorce <idra@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
* pytdb: Check if the database is closed before we touch itAndrew Bartlett2012-07-161-10/+80
| | | | | | | | | | | If .close() has already been called, we have to play dead - the self->ctx is just not valid any more, as we have been shut down to allow some other part of Samba to open the tdb. Andrew Bartlett Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Jul 16 13:51:52 CEST 2012 on sn-devel-104
* pytdb: Check for errors parsing strings into TDB_DATAAndrew Bartlett2012-07-161-0/+16
| | | | | | | The call to PyStringAsString() can raise an exception, and we want to return that rather than following a NULL pointer later. Andrew Bartlett
* tdb: Fix python documentation for tdb moduleAmitay Isaacs2011-12-131-1/+1
|
* pytdb: Shorter description which fits on a single line.Jelmer Vernooij2011-11-131-1/+2
|
* tdb: fix a build warning.Günther Deschner2011-05-061-0/+1
| | | | Guenther
* s4-python: Only set BASETYPE flag if subclassing is supported.Jelmer Vernooij2011-01-011-1/+1
| | | | | Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sat Jan 1 03:39:58 CET 2011 on sn-devel-104
* pytdb: Make PyTdb variable static.Jelmer Vernooij2010-12-211-3/+3
|
* Avoid the use of PyAPI_DATA, which is for internal Python API's.Arnaud Faucher2010-11-221-1/+1
| | | | | | | Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Mon Nov 22 00:52:56 CET 2010 on sn-devel-104
* pytdb: Add __version__ attribute.Jelmer Vernooij2010-10-041-0/+2
|
* pytdb: Include Python.h first to prevent warning.Jelmer Vernooij2010-10-021-1/+1
|
* pytdb: Check errors after PyObject_New() callsKirill Smelkov2010-10-021-0/+7
| | | | | | | | The call could fail with e.g. MemoryError, and we'll dereference NULL pointer without checking. Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
* pytdb: Add support for tdb_repack()Kirill Smelkov2010-10-021-0/+9
| | | | | | Cc: 597386@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
* pytdb: Add TDB_INCOMPATIBLE_HASH open flagKirill Smelkov2010-10-021-0/+1
| | | | | | | | | | | In 2dcf76 Rusty added TDB_INCOMPATIBLE_HASH open flag which selects Jenkins lookup3 hash for new databases. Expose this flag to python users too. Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
* pytdb: Make filename argument optional.Jelmer Vernooij2010-09-191-5/+11
|
* pytdb: Add support for tdb_freelist_size()Kirill Smelkov2010-09-191-0/+6
| | | | | | Cc: 597386@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
* pytdb: Add support for tdb_transaction_prepare_commit()Kirill Smelkov2010-09-191-0/+10
| | | | | | Cc: 597386@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
* pytdb: Add support for tdb_enable_seqnum, tdb_get_seqnum and ↵Kirill Smelkov2010-09-191-0/+23
| | | | | | | | tdb_increment_seqnum_nonblock Cc: 597386@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
* pytdb: Update open flags to match those for tdb_open() in tdb.hKirill Smelkov2010-09-191-0/+6
| | | | | | | | | Namely TDB_NOSYNC, TDB_SEQNUM, TDB_VOLATILE, TDB_ALLOW_NESTING and TDB_DISALLOW_NESTING were missing. Cc: 597386@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
* pytdb: Fix repr segfault for internal dbKirill Smelkov2010-09-191-1/+3
| | | | | | | | | | | | | | | The problem was tdb->name is NULL for TDB_INTERNAL databases, and so it was crashing ... #0 0xb76944f3 in strlen () from /lib/i686/cmov/libc.so.6 #1 0x0809862b in PyString_FromFormatV (format=0xb72b6a26 "Tdb('%s')", vargs=0xbfc26a94 "") at ../Objects/stringobject.c:211 #2 0x08098888 in PyString_FromFormat (format=0xb72b6a26 "Tdb('%s')") at ../Objects/stringobject.c:358 #3 0xb72b65f2 in tdb_object_repr (self=0xb759e060) at ./pytdb.c:439 Cc: 597089@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
* pytdb: Add support for tdb_add_flags() & tdb_remove_flags()Kirill Smelkov2010-09-191-0/+23
| | | | | | | | | Note, unlike tdb_open where flags is `int', tdb_{add,remove}_flags want flags as `unsigned', so instead of "i" I used "I" in PyArg_ParseTuple. Cc: 597386@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
* tdb: update tdb ABI to use hide_symbols=TrueAndrew Tridgell2010-04-201-10/+0
| | | | | | | | | | | | | | We now use -fvisibilty=hidden to hide symbols from outside the tdb shared library. This also moved tdb_transaction_recover() into the tdb_private.h header, as it should never have been a public API. For that reason we are changing the version number. We're only doing a minor version increment as it is extremely unlikely that anyone was actually using tdb_transaction_recover() as its locking requirements were rather unusual. Pair-Programmed-With: Rusty Russell <rusty@samba.org>
* tdb: fix typo in python's Tdb.get() docstringKirill Smelkov2009-10-291-1/+1
| | | | | | | It's Tdb.get(), not Tdb.fetch(). Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* tdb: kill last bits from swigKirill Smelkov2009-10-291-1/+1
| | | | | | | | We no longer use swig for pytdb, so there is no need for swig make rules. Also pytdb.c header should be updated. Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* s3 build: Remove unused fstat check to fix a bunch of HAVE_FSTAT warningsTim Prouty2009-01-301-4/+0
|
* lib/tdb: include replace.h and system/filesys.h in pytdb.cStefan Metzmacher2009-01-301-4/+3
| | | | | | This fixes the build on Tru64. metze
* Avoid using a utility header for Python replacements included in Samba,Jelmer Vernooij2009-01-081-1/+5
| | | | since this will not be shipped with talloc/tdb/tevent/etc.
* s3/s4 build: Fix Py_RETURN_NONE to work with python versions < 2.4Tim Prouty2009-01-071-1/+1
|
* py: Properly increase the reference counter of Py_None.Jelmer Vernooij2009-01-061-16/+16
|
* Make sure to not close tdb database more than once.Jelmer Vernooij2008-12-181-2/+10
|
* Implement missing functions in pytdb.Jelmer Vernooij2008-12-181-2/+62
|
* Add simple manually written replacement for the tdb module.Jelmer Vernooij2008-12-181-0/+449