summaryrefslogtreecommitdiff
path: root/lib/talloc/pytalloc_util.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-04-14lib:talloc: Fix code spellingAndreas Schneider1-1/+1
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2021-03-16Bug 9931: change pytalloc source to LGPLDavid Disseldorp1-11/+15
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
2019-09-26lib/talloc: clang: Fix 'Value stored during its initialization is never read'Noel Power1-1/+1
Fixes: ib/talloc/pytalloc_util.c:245:8: warning: Value stored to 'type_obj' during its initialization is never read <--[clang] void *type_obj = talloc_check_name(ptr, type_name); ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-22talloc/py_util: remove tautologically dead codeDouglas Bagnall1-12/+0
Being careful is good and all, but if we don't trust the static PyTypeObject *type = NULL; two lines up, we need to reconsider our entire software universe. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-22talloc: pytalloc_get_checked_type: survive non-talloc objectsDouglas Bagnall1-1/+1
If the python object is not a talloc object, we will end up with a NULL pointer. We weren't checking for that properly Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-22talloc: add pytalloc_get_name() helperDouglas Bagnall1-0/+9
In several places we go talloc_get_name(pytalloc_get_ptr(py_obj)) which is a certain NULL derefernce if py_obj is not a talloc object. This is a helper function that chooses to say "non-talloc object" rather than crash. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-26pytalloc: Handle memory errors when creating pytalloc objects.Kristján Valur1-6/+23
Don't create superfluous exceptions. Signed-off-by: Kristján Valur <kristjan@rvx.is> Reviewed-by: Noel Power <npower@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-26pytalloc: Further refactoring to eliminate duplicate code.Kristján Valur1-36/+34
Signed-off-by: Kristján Valur <kristjan@rvx.is> Reviewed-by: Noel Power <npower@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-26pytalloc: Refactor the pytalloc_reference and pytalloc_steal to use a common ↵Kristján Valur1-55/+30
method. Signed-off-by: Kristján Valur <kristjan@rvx.is> Reviewed-by: Noel Power <npower@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-21pytalloc: Remove deprecated pytalloc_CObject_FromTallocPtr()Andrew Bartlett1-17/+0
This function makes it harder to remove the --extra-python handlers and is only provided for Python 2.x, support for which Samba is removing. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2017-02-25pytalloc: add pytalloc_GenericObject_{steal,reference}[_ex]()Stefan Metzmacher1-5/+90
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-03-08pytalloc: Add pytalloc_BaseObject_PyType_Ready() wrapperAndrew Bartlett1-0/+14
This avoids the need for the caller to set tp_base and tp_basicsize and so removes those as possible errors. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-03-08pytalloc: Add new BaseObjectAndrew Bartlett1-25/+139
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>
2016-03-08pytalloc: add a _pytalloc_get_type() helper function and generate ↵Stefan Metzmacher1-0/+15
PyExc_TypeError on mismatch Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-03-08talloc: add _pytalloc_get_ptr/_pytalloc_get_mem_ctx helper functionsAndrew Bartlett1-0/+10
This allows us to check which type is involved, and dereference that type correctly Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-05-19pytalloc: Port to Python 3Petr Viktorin1-0/+4
- 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>
2011-08-10pytalloc: Use consistent prefix for functions, add ABI file.Jelmer Vernooij1-11/+11
2010-12-08talloc: mark pytalloc-util functions as _PUBLIC_Stefan Metzmacher1-6/+6
metze
2010-12-08talloc: remove unused PyString_FromString_check_null() from pytalloc-utilStefan Metzmacher1-8/+0
metze
2010-12-01pytalloc: Make py_talloc_default_cmp private.Jelmer Vernooij1-13/+0
2010-12-01pytalloc: Make py_talloc_dealloc private.Jelmer Vernooij1-11/+0
2010-12-01pytalloc: Make py_talloc_default_repr private (now exposed by talloc.Object).Jelmer Vernooij1-12/+0
2010-12-01pytalloc: Expose PyTalloc_GetObjectTypeJelmer Vernooij1-2/+2
2010-12-01pytalloc: Add convenience function for checking if something is a tallocJelmer Vernooij1-0/+27
object.
2010-11-05talloc: rename pytalloc.c to pytalloc_util.cJelmer Vernooij1-0/+135