With python-2.5.1 running on an ubuntu feisty box:
root@mirror:/tmp/apt# python
Python 2.5.1 (r251:54863, May 2 2007, 16:27:44)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import apt_inst
>>> apt_inst.debExtractArchive(open("/tmp/apt/uqm_0.5.0-2ubuntu1_amd64.deb"),"/tmp/cdr")
1
So far so good, but if I look at the processes filehandles:
root@mirror:~# ls -al /proc/19026/fd
total 4
dr-x------ 2 root root 0 2007-07-30 15:05 .
dr-xr-xr-x 5 root root 0 2007-07-30 15:05 ..
lrwx------ 1 root root 64 2007-07-30 15:06 0 -> /dev/pts/5
lrwx------ 1 root root 64 2007-07-30 15:06 1 -> /dev/pts/5
lrwx------ 1 root root 64 2007-07-30 15:05 2 -> /dev/pts/5
l-wx------ 1 root root 64 2007-07-30 15:06 5 -> /tmp/cdr/usr/share/games/uqm/content/CVS/Entries.Static
So if I process a ton of .deb's using python-apt I leak file descriptors until the process dies. The strange part is that it's only some packages leak a file handles.