diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-07-14 20:43:56 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-07-14 20:43:56 +0200 |
| commit | 8430dbf041ce70dcba81101678beee0492252fd2 (patch) | |
| tree | 847a3e2de1f485c685d9b627c4be1869aa514b4f /python/apt_pkgmodule.cc | |
| parent | e3745827634d8334f796a1506e575ab6f5efdaee (diff) | |
| download | python-apt-8430dbf041ce70dcba81101678beee0492252fd2.tar.gz | |
python/configuration.cc: Unify all Configuration,ConfigurationPtr,ConfigurationSub into one type.
This makes the whole API easier. The disadvantage is that we require 8 bytes (??) more per
object for the owner object pointer, which is NULL for most cases (the only exception being
objects created by Configuration.sub_tree).
Diffstat (limited to 'python/apt_pkgmodule.cc')
| -rw-r--r-- | python/apt_pkgmodule.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 3f18f785..e4fd0dfc 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -527,8 +527,7 @@ extern "C" void initapt_pkg() #endif { // Finalize our types to add slots, etc. - if (PyType_Ready(&PyConfigurationPtr_Type) == -1) INIT_ERROR; - if (PyType_Ready(&PyConfigurationSub_Type) == -1) INIT_ERROR; + if (PyType_Ready(&PyConfiguration_Type) == -1) INIT_ERROR; if (PyType_Ready(&PyCacheFile_Type) == -1) INIT_ERROR; // Initialize the module @@ -539,8 +538,10 @@ extern "C" void initapt_pkg() #endif // Global variable linked to the global configuration class - CppPyObject<Configuration *> *Config = CppPyObject_NEW<Configuration *>(&PyConfigurationPtr_Type); + CppOwnedPyObject<Configuration*> *Config = CppOwnedPyObject_NEW<Configuration*>(NULL, &PyConfiguration_Type); Config->Object = _config; + // Global configuration, should never be deleted. + Config->NoDelete = true; PyModule_AddObject(Module,"config",Config); #ifdef COMPAT_0_7 Py_INCREF(Config); @@ -568,8 +569,6 @@ extern "C" void initapt_pkg() ADDTYPE(Module,"Cdrom",&PyCdrom_Type); /* ========================= configuration.cc ========================= */ ADDTYPE(Module,"Configuration",&PyConfiguration_Type); - //ADDTYPE(Module,"ConfigurationSub",&PyConfigurationSub_Type); // NO __new__() - //ADDTYPE(Module,"ConfigurationPtr",&PyConfigurationPtr_Type); // NO __new__() /* ========================= depcache.cc ========================= */ ADDTYPE(Module,"ActionGroup",&PyActionGroup_Type); ADDTYPE(Module,"DepCache",&PyDepCache_Type); |
