diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/apt_pkgmodule.cc | 2 | ||||
| -rw-r--r-- | python/configuration.cc | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 9e486a91..d53f64a6 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -56,7 +56,7 @@ static PyObject *newConfiguration(PyObject *self,PyObject *args) { PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.newConfiguration() is " "deprecated. Use apt_pkg.Configuration() instead.", 1); - return CppPyObject_NEW<Configuration>(&PyConfiguration_Type); + return CppOwnedPyObject_NEW<Configuration*>(NULL, &PyConfiguration_Type, new Configuration()); } #endif /*}}}*/ diff --git a/python/configuration.cc b/python/configuration.cc index 11231a28..b2367c3e 100644 --- a/python/configuration.cc +++ b/python/configuration.cc @@ -152,6 +152,8 @@ static PyObject *CnfList(PyObject *Self,PyObject *Args) // Convert the whole configuration space into a list PyObject *List = PyList_New(0); const Configuration::Item *Top = GetSelf(Self).Tree(RootName); + if (!GetSelf(Self).Tree(0)) + return List; const Configuration::Item *Root = GetSelf(Self).Tree(0)->Parent; if (Top != 0 && RootName != 0) Top = Top->Child; @@ -216,7 +218,7 @@ static PyObject *CnfKeys(PyObject *Self,PyObject *Args) const Configuration::Item *Root = 0; if (RootName == 0) Stop = 0; - if (Top != 0) + if (Top != 0 && GetSelf(Self).Tree(0)) Root = GetSelf(Self).Tree(0)->Parent; for (; Top != 0;) { |
