tag 369147 patch thanks * Josh Triplett <[EMAIL PROTECTED]>, [2006-05-27 13:02 -0700]: > apt_pkg.GetCache() segfaults if called before apt_pkg.InitSystem(): > > >>> import apt_pkg > >>> apt_pkg.GetCache() > Segmentation fault > > It should raise an exception like other functions do: > > >>> import apt_pkg > >>> apt_pkg.VersionCompare("1","2") > Traceback (most recent call last): > File "<stdin>", line 1, in ? > ValueError: _system not initialized
The attached patch fixes this bug, please consider applying it. Thanks. ciao, ema
diff -Nru python-apt-0.7.6/python/cache.cc python-apt-0.7.6/python/cache.cc --- python-apt-0.7.6/python/cache.cc 2008-06-17 17:26:33.000000000 +0200 +++ python-apt-0.7.6/python/cache.cc 2008-07-12 19:31:15.000000000 +0200 @@ -928,6 +928,11 @@ if (PyArg_ParseTuple(Args, "|O", &pyCallbackInst) == 0) return 0; + if (_system == 0) { + PyErr_SetString(PyExc_ValueError,"_system not initialized"); + return 0; + } + pkgCacheFile *Cache = new pkgCacheFile(); if(pyCallbackInst != 0) {