matplotlib/matplotlib — pull request #1834 by mgiuca-google (2013-03-18 04:20:35+00:00)
Title: finance: Fixed making directories for explicit cachename

In `finance.fetch_historical_yahoo`, if an explicit `cachename` is supplied, the code still attempts to create a directory in the usual cache location (which is not necessary), and fails to create directories required for the supplied cache directory.

I have patched it so that it creates the necessary directories leading up to `cachename`.

As an aside, I also fixed it so that it explicitly closes the URL object opened by `urlopen` and uses the modern `with` style context managers.