summaryrefslogtreecommitdiff
path: root/lib/talloc/pytalloc.c
AgeCommit message (Collapse)AuthorFilesLines
2023-11-20Use python.h from libreplaceAndreas Schneider1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15513 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-02-17talloc: remove Python 2 #if clausesDouglas Bagnall1-48/+4
Also fix an obsolete related comment. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri Feb 17 14:52:26 UTC 2023 on atb-devel-224
2021-05-19python: Ensure reference counts are properly incrementedJoseph Sutton1-2/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2021-03-16Bug 9931: change pytalloc source to LGPLDavid Disseldorp1-9/+13
pytalloc is currently GPL, while the rest of talloc is LGPL. This situation arose because pytalloc was originally developed under source4/scripting/python/, and moved into talloc proper with commit 0f043c197c473c801fc32c727194b5a2d6ae232f ("Move pytalloc to talloc directory.", October 2008). BUG: https://bugzilla.samba.org/show_bug.cgi?id=9931 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Björn Jacke <bjacke@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Mar 16 18:17:43 UTC 2021 on sn-devel-184
2020-05-08Fix clang 9 missing-field-initializer warningsGary Lockyer1-1/+1
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-06-24py3: Remove PyStr_FromFormat() compatability macroAndrew Bartlett1-8/+2
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>
2019-05-16lib/talloc: squash 'cast between incompatible function types' warningNoel Power1-1/+2
To avoid warning above produced by using -Wcast-function-type we; + ensure PyCFunctions of type METH_NOARGS defined dummy arg Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-03-26pytalloc: Check for errors during module initialization.Kristján Valur1-3/+13
Signed-off-by: Kristján Valur <kristjan@rvx.is> Reviewed-by: Noel Power <npower@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-16Remove extra 0x prefix for the "%p" format specifiers, avoiding 0x0x0 ↵Timur I. Bakeyev1-1/+1
strings in the output. Signed-off-by: Timur I. Bakeyev <timur@iXsystems.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-02-25pytalloc: add pytalloc_GenericObject_{steal,reference}[_ex]()Stefan Metzmacher1-0/+13
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-05-10pytalloc: avoid double 0x0x in repr stringsDouglas Bagnall1-1/+1
The %p format puts one in itself. Before: <drsblobs.repsFromTo2 talloc based object at 0x0x1b551e0> After: <drsblobs.repsFromTo2 talloc based object at 0x1b551e0> Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-03-08pytalloc: Add new BaseObjectAndrew Bartlett1-0/+86
This new object not only avoids the ABI issues of talloc.Object it stores one more pointer, being the start of the array, and so can be used to fix the PIDL bindings/talloc refcount issue. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-05-19pytalloc: Port to Python 3Petr Viktorin1-8/+79
- Use native string for repr - Use rich comparison Removes the deprecated tp_compare in favor of tp_richcompare. Disparate types cannot be compared (except for == and !=), and True or False objects are returned explicitly. - Use Py_TYPE instead of ob_type This changed to conform to C aliasing rules, see http://legacy.python.org/dev/peps/pep-3123/ - Don't provide CObject creation function A PyCapsule based replacement would be possible, but might not be necessary considering the function is not used much. - Use new-style module initialization Build changes: - Use ABI flag in the lib name and pkg-config template - Use the SAMBA_CHECK_PYTHON macro for finding Python Signed-off-by: Petr Viktorin <pviktori@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2015-04-24pytalloc: Fix comparison of disparate typesPetr Viktorin1-1/+1
When fed Python objects of different types, pytalloc_default_cmp compared pointers to PyType objects that weren't part of an array, resulting in undefined behavior. This makes things a bit better (though it still casts ptrdiff_t to int). Signed-off-by: Petr Viktorin <pviktori@redhat.com> Reviewed-By: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2012-07-05talloc: remove unused variablesBjörn Jacke1-5/+0
found by the IRIX compiler Autobuild-User(master): Björn Jacke <bj@sernet.de> Autobuild-Date(master): Thu Jul 5 23:50:54 CEST 2012 on sn-devel-104
2011-08-10pytalloc: Use consistent prefix for functions, add ABI file.Jelmer Vernooij1-21/+21
2011-01-03Revert broken destructor changes.Jelmer Vernooij1-1/+1
2011-01-03s4-python: Properly call PyObject_Del from all destructors.Jelmer Vernooij1-1/+1
2011-01-01s4-python: Only set BASETYPE flag if subclassing is supported.Jelmer Vernooij1-3/+1
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sat Jan 1 03:39:58 CET 2011 on sn-devel-104
2011-01-01s4-python: Add more prototypes.Jelmer Vernooij1-0/+2
2011-01-01s4-python: Properly call PyObject_Del from all destructors.Jelmer Vernooij1-1/+1
2010-12-05pytalloc: Add docstring for talloc.Object.Jelmer Vernooij1-1/+3
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sun Dec 5 18:12:59 CET 2010 on sn-devel-104
2010-12-01pytalloc: Make py_talloc_default_cmp private.Jelmer Vernooij1-0/+15
2010-12-01pytalloc: Make py_talloc_dealloc private.Jelmer Vernooij1-0/+11
2010-12-01pytalloc: Make py_talloc_default_repr private (now exposed by talloc.Object).Jelmer Vernooij1-0/+12
2010-11-30talloc: Add talloc object.Jelmer Vernooij1-0/+15
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Tue Nov 30 23:26:56 CET 2010 on sn-devel-104
2010-11-07pytalloc: Make some arguments optional.Jelmer Vernooij1-6/+6
2010-11-05talloc: Add python talloc module, move convenience functions to it.Jelmer Vernooij1-0/+84
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Fri Nov 5 02:48:21 UTC 2010 on sn-devel-104
2010-11-05talloc: rename pytalloc.c to pytalloc_util.cJelmer Vernooij1-135/+0
2010-10-24talloc: pytalloc should not depend on samba specific codeStefan Metzmacher1-3/+2
metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Sun Oct 24 19:21:25 UTC 2010 on sn-devel-104
2010-10-20pytalloc: use talloc_unlink() to free py_talloc objectsKamen Mazdrashki1-1/+3
Those type of objects are referenced every time we assign them to other py_talloc objects, which leads to runtime warnings that we are trying to free an object with references Wrap talloc_unlink() in SMB_ASSERT() to ensure we catch possible failure Autobuild-User: Kamen Mazdrashki <kamenim@samba.org> Autobuild-Date: Wed Oct 20 21:37:06 UTC 2010 on sn-devel-104
2010-10-08pytalloc: Fix warning that we are subtracting void* pointersKamen Mazdrashki1-1/+1
Autobuild-User: Kamen Mazdrashki <kamenim@samba.org> Autobuild-Date: Fri Oct 8 23:36:54 UTC 2010 on sn-devel-104
2010-09-21pytalloc: Add default compare function.Jelmer Vernooij1-1/+14
2010-09-20pidl: Fix segfault when accessing unicode objects.Jelmer Vernooij1-9/+0
2010-09-02pidl-python: cope with NULL pointers in more placesAndrew Tridgell1-0/+20
NULL is converted to Py_None
2010-09-02pytalloc: treat a NULL ptr as Py_NoneAndrew Tridgell1-1/+7
2010-08-25pytalloc: fixed py_talloc_steal()Andrew Tridgell1-0/+8
py_talloc_steal() was implemented as a macro which evaluated it's 2nd argument twice. It was often called via a macro with a 2nd argument that was a function call, for example an allocation in py_talloc_new(). This meant it allocated memory twice, and leaked one of them. This re-implements py_talloc_steal() as a function, so that it only does the allocation once.
2010-08-25s4-pytalloc: use better names for python talloc objectsAndrew Tridgell1-0/+2
2010-03-29pytalloc: allow for using a system libtalloc-dev with pytallocAndrew Tridgell1-1/+1
When we have a system talloc library, we still need to grab pytalloc.h from lib/talloc. We don't want to just use -Ilib/talloc, as otherwise we'll get the in-tree talloc.h which may not be compatible with the system talloc.h So we need to give the path to pytalloc.h
2010-01-21s4: Include Python.h early to avoid double definition errors.Jelmer Vernooij1-0/+1
2009-09-28pidl: Avoid using talloc_free as function pointer, since it may be aJelmer Vernooij1-0/+10
macro.
2009-07-30DCE/RPC(Python): Rename py_talloc_import to py_talloc_steal.Jelmer Vernooij1-3/+3
Use py_talloc_reference in DCE/RPC code, fixes access to SAMR pipe.
2009-07-01fixed use of reference in pytallocAndrew Tridgell1-3/+23
The previous code caused memory leaks, and also caused situations where talloc_free could be called on pointers with multiple parents The new approach is to have two functions: py_talloc_import : steals the pointer, so it becomes wholly owned by the python object py_talloc_reference: uses a reference, so it is owned by both python and C
2009-01-30lib/talloc: include replace.h in pytalloc.cStefan Metzmacher1-0/+1
This fixes the build on Tru64. metze
2008-12-23pytalloc: Add some comments, use talloc object location in repr ratherJelmer Vernooij1-5/+15
than python object location.
2008-12-21py: Fix initialisation of subtypes, fix segfaults.Jelmer Vernooij1-2/+2
2008-10-24Move pytalloc to talloc directory.Jelmer Vernooij1-0/+52