Filehandle leaks in font_manager.py (was: PDF backend problem)

[Moving to the devel list.]

Here's a patch for font_manager.py to close opened files. Could
somebody review the patch? As I mentioned earlier, I don't understand
why cPickle/pickle is not imported at the top level, so I'm hesitant
to check this in without review.

font_manager_fhleak.patch (4.02 KB)

I would just suggest using open() instead of file(), but this is a
general Python tip :slight_smile:

Everything else seems OK.

Best,
Edin

···

On 3/13/07, Jouni K. Seppänen <jks@...278...> wrote:

[Moving to the devel list.]

Here's a patch for font_manager.py to close opened files. Could
somebody review the patch? As I mentioned earlier, I don't understand
why cPickle/pickle is not imported at the top level, so I'm hesitant
to check this in without review.

Jouni K. Seppänen <jks@...278...> writes:

> I fixed another filehandle leak in the pdf backend, so here's a more
> complete patch. There are also several cases of file(...) being passed
> to pickle.dump or pickle.load in font_manager.py. I was going to take
> care of these by writing some utility functions, but I started
> wondering why the import of cPickle or pickle is done only within
> methods of FontManager and not at the top level. Are there some
> platforms where neither is available, or what is the rationale?

--
Jouni K. Seppänen
http://www.iki.fi/jks

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel