Comment 16 for bug 187106

Revision history for this message
Krzysztof Nowicki (krissn) wrote :

Yes, I meant the zipimport module.

The hack basically eliminates all fclose() calls and replaces all fopen() calls with a wrapper function, which keeps a copy of the filename of the last open file and it's file descriptor. If the supplied file name matches the stored one the function just returns the cached handle. Otherwise the existing handle is closed and a new one is opened. Everything is done on static global variables. The problem here is that the last used file is never actually closed, but I guess that could be fixed by some more sophisticated logic.

I could try to spend some time to develop a more clean solution.