From 45cdd4f2c6b04bfdfd37ef0e1a6358b29680afb8 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 19 Apr 2009 15:17:32 +0200 Subject: * python/*.cc: Export all types and add a __new__() method to them. Some names may be changed before the release, but this is a good draft. --- python/sourcelist.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'python/sourcelist.cc') diff --git a/python/sourcelist.cc b/python/sourcelist.cc index 48b3b7c8..15311e94 100644 --- a/python/sourcelist.cc +++ b/python/sourcelist.cc @@ -97,13 +97,21 @@ static PyGetSetDef PkgSourceListGetSet[] = { {} }; +static PyObject *PkgSourceListNew(PyTypeObject *type,PyObject *args,PyObject *kwds) +{ + char *kwlist[] = {0}; + if (PyArg_ParseTupleAndKeywords(args,kwds,"",kwlist) == 0) + return 0; + return CppPyObject_NEW(type,new pkgSourceList()); +} + PyTypeObject PkgSourceListType = { PyObject_HEAD_INIT(&PyType_Type) #if PY_MAJOR_VERSION < 3 0, // ob_size #endif - "pkgSourceList", // tp_name + "apt_pkg.SourceList", // tp_name sizeof(CppPyObject), // tp_basicsize 0, // tp_itemsize // Methods @@ -133,6 +141,14 @@ PyTypeObject PkgSourceListType = PkgSourceListMethods, // tp_methods 0, // tp_members PkgSourceListGetSet, // tp_getset + 0, // tp_base + 0, // tp_dict + 0, // tp_descr_get + 0, // tp_descr_set + 0, // tp_dictoffset + 0, // tp_init + 0, // tp_alloc + PkgSourceListNew, // tp_new }; PyObject *GetPkgSourceList(PyObject *Self,PyObject *Args) -- cgit v1.2.3