summaryrefslogtreecommitdiff
path: root/python/generic.h
AgeCommit message (Collapse)AuthorFilesLines
2014-01-27python/generic.h: Fix MkPyNumber to work if char is unsigned.Julian Andres Klode1-1/+1
We currently consider two cases "unsigned char" and "char". This works as long as "char" is signed, but this is not guaranteed. Change "char" to "signed char" instead.
2013-10-23python/{depcache.cc,string.cc}: Ignore deprecation warnings for some callsJulian Andres Klode1-0/+5
Those functions are deprecated in APT, but we still need to provide them for backwards compatibility.
2013-10-08python/generic.cc: Move PyApt_Filename::init hereJulian Andres Klode1-21/+1
2013-10-08PyApt_Filename: Add return value to assignment operatorJulian Andres Klode1-2/+2
2013-10-08python/generic.h: Introduce a PyApt_Filename classJulian Andres Klode1-0/+60
On Python 3, we need to encode filenames. We could use PyUnicode_FSConverter but this introduces unneeded complexity in all callees, and is only available in Python 3.1 anyway.
2013-09-11Remove old API compatibility C++ support codeJulian Andres Klode1-6/+0
2012-10-23build fixes for python3.3Michael Vogt1-0/+4
2011-04-12apt_pkg: Fix unsigned/long-vs-int issues (LP: #610820)Julian Andres Klode1-0/+16
This fix is large, but simple in concept. Instead of relying on Py_BuildValue and type signatures, or type-specific conversion functions, create a new set of overloaded MkPyNumber() functions that automatically do the right thing for each numerical type.
2010-12-12Merge from mvoJulian Andres Klode1-1/+3
* python/generic.h: - set Object to NULL in CppDeallocPtr * python/depcache.cc: - don't run "actiongroup.release()" if the object was already deallocated * tests/test_apt_cache.py: - fix tests to work if apt compressed indexes are enabled
2010-12-07python/generic.h: Fix a memory leak (leaking on every unicode string).Julian Andres Klode1-1/+3
2010-12-07* python/generic.h:Michael Vogt1-1/+3
- set Object to NULL in CppDeallocPtr * python/depcache.cc: - don't run "actiongroup.release()" if the object was already deallocated
2010-02-27* python:Julian Andres Klode1-0/+6
- Handle deprecated attributes and methods in the tp_gettattro slot, this allows us to easily warn if a deprecated function is used.
2010-01-31python/generic.h: Fix CppPyObject_NEW with parameter again.Julian Andres Klode1-2/+2
2010-01-27Merge the CppOwnedPyObject C++ class into CppPyObject.Julian Andres Klode1-71/+22
2009-08-07python/arfile.cc: Introduce apt_inst.ArArchive and apt_inst.ArMember.Julian Andres Klode1-0/+1
This is part one of wishlist Bug#536096, introducing classes in apt_inst.
2009-07-24python/generic.h: Do not deallocate the temporary bytes object in ↵Julian Andres Klode1-5/+1
PyUnicode_AsString.
2009-07-21python/lock.cc: Implement apt_pkg.FileLock().Julian Andres Klode1-0/+1
This is yet another context manager, this time for locking files. It can be used multiple times and features an internal counter.
2009-07-17python: Use PyString_FromFormat instead of snprintf.Julian Andres Klode1-0/+1
2009-07-14python/generic.h: Use Py_XINCREF instead of Py_INCREF in CppOwnedPyObject_NEW.Julian Andres Klode1-3/+2
Reason: Owner may be NULL.
2009-07-13python/generic.h: Use PyBytes_AS_STRING instead of PyBytes_AsString in ↵Julian Andres Klode1-1/+2
PyUnicode_AsString.
2009-07-10python/generic.h: Introduce NoDelete field in CppPyObject.Julian Andres Klode1-4/+13
Setting NoDelete to true causes the deallocation functions to not delete the underlying C++ object. This is useful in situations where the object is already managed somewhere else, e.g. DepCache by CacheFile. It will also assist us in providing a flexible C++ API which only takes ownership if requested.
2009-06-25python: Use PyVarObject_HEAD_INIT() instead of PyObject_HEAD_INIT().Julian Andres Klode1-0/+1
This is related to PEP 3123 and fixes some compiler warnings.
2009-06-25python/generic.h: Make PyObject_AsString() only accept unicode on Python 3.Julian Andres Klode1-1/+11
2009-06-25python/cache.cc: Support unicode objects and str objects in Python 2.Julian Andres Klode1-1/+26
2009-06-21python/generic.h: Define a compat macro PyErr_WarnEx for Python 2.4Julian Andres Klode1-0/+5
2009-06-21python: Make all CppOwnedPyObjects and similar support garbage collection.Julian Andres Klode1-4/+40
If you want to subclass apt_pkg.Cache() and create an apt_pkg.DepCache() object in it (e.g. as self.depcache) this is needed because otherwise, Python would not know about the cyclic dependency and refuse to free any of them. This also changes apt_pkg.Cache to the standard deallocation schema, because the underlying CacheFile deletes its pointers automatically on deletion. Thus a second call is not needed.
2009-06-12Bugfix: Delete pointers correctly, fixing memory leaks. (LP: #370149)Julian Andres Klode1-0/+19
We previously called the destructor of the pointer. This resulted in no object using pointers being deallocated. This patch introduces CppDeallocPtr() and CppOwnedDeallocPtr() which do the same as the other CppDealloc() and CppOwnedDealloc(), but use 'delete' on the pointer instead of the deconstructor. Furthermore, this patch also changes AcquireFile to be a CppOwnedPyObject, owned by the Acquire object. Without this change, deleting the Acquire object would cause a crash when AcquireFile is deallocated.
2009-06-08python/generic.h,tag.cc,configuration.cc: Use tp_alloc/tp_free instead of ↵Julian Andres Klode1-6/+6
PyObject_NEW/DEL This allows us to finally implement subclassing. Previously deletion of an instance of a subclass caused segmentation faults, this is not the case anymore.
2009-04-17* python/generic.h: Force 0.7 compatibility to be off in Python 3 buildsJulian Andres Klode1-0/+2
2009-04-15* Introduce support for Python 3 (Closes: #523645)Julian Andres Klode1-0/+25
This is the first initial port to Python 3. The API is almost completely identical to the one found in Python 2, except that functions working with binary data require bytes (md5sum,sha1sum,sha256sum,Base64Encode). Using setup3.py to install the modules will not work, because the apt package still has to be converted to Python 3. For the package, we call 2to3-3.1 in debian/rules to do this automatically.
2008-05-16Remove trailing whitespace.Ben Finney1-7/+7
2006-10-04* python/generic.h:Michael Vogt1-2/+2
- use PyObject_DEL() instead of PyMem_DEL()
2006-09-18* python/generic.h:Michael Vogt1-0/+4
- deal with the api change and stay backward compatible with 2.4
2005-05-03* merged with Greek0@gmx.net--2005-main, native apt interface added, fixed a ↵Michael Vogt1-0/+11
refcount problem, added tests/ directory * apt/package.py, apt/__init__.py: - started a native python interface that will wrap the uglier bits of python-apt in the future * tests/pkgsrcrecords.py: - started a test directory * python/pkgsrcrecords.cc: - fixed a refcount problem - merged with Greek0s tree Patches applied: * Greek0@gmx.net--2005-main/python-apt--debian--0.6--base-0 tag of apt@packages.debian.org/python-apt--main--0--patch-8 * Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-1 Minor typo fix in debian/rules * Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-2 Typo fix in depcache.cc which caused wrong function to be called * Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-3 Improved CppPyObject, leading to a better PkgDepCacheStruct * Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-4 Improved build system * Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-5 Restored the old tar.cc to work with the older apt in debian again * Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-6 Fix for Debian #304296 (Segfault in CppOwnedDealloc) * Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-7 Fix for Debian #304903 (FD leak) * Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-8 Fixed the compilation error introduced in patch-6 * Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-9 New debian/changelog from Debians python-apt 0.6.10 * Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-10 Minor changes to make the packages lintian/linda clean * apt@packages.debian.org/python-apt--main--0--patch-8 Merge michael.vogt@ubuntu.com--2005/python-apt--pkgDepCache--0
2004-11-24#include <new>Arch Librarian1-1/+2
Author: mdz Date: 2002-03-10 05:45:34 GMT #include <new>
2004-11-24Fix g++-3.0 compilation issuesArch Librarian1-3/+3
Author: mdz Date: 2002-02-26 01:36:15 GMT Fix g++-3.0 compilation issues
2004-11-24Changed include pathsArch Librarian1-2/+2
Author: jgg Date: 2002-01-08 06:53:04 GMT Changed include paths
2004-11-24Initial revisionArch Librarian1-0/+132
Author: jgg Date: 2001-02-20 06:32:01 GMT Initial revision