This patch doesn't make a whole lot of sense to me.  get_name should 
work just fine if self._family is None, and indeed it does in my own 
testing:

```
from matplotlib import font_manager

f = font_manager.FontProperties(None)
print f._family
print f.get_family()
print f.get_name()
```

So I'd much prefer to get to the bottom of the root cause of this 
problem than patch it unnecessarily in this way.  Any idea what that is?

Mike


On 07/08/2013 10:57 AM, Nicolas Mailhot wrote:
> Hi,
>
> In matplotlib 1.2.1, the  get_name function is not garding against none
> self (unlike other functions); Unfortunately it seems I have a workload
> that makes matplotlib call get_name with None (wasn't the case in 1.2.0).
> I couldn't isolate the exact trigger, when I reduce the volume of data
> processed the problem goes away so I have to simple shareable reproducer.
>
> Anyway, the following patch makes it all work for me, could it (or
> something similar) be merged?
>
> diff -uNr matplotlib-1.2.1.orig/lib/matplotlib/font_manager.py
> matplotlib-1.2.1/lib/matplotlib/font_manager.py
> --- matplotlib-1.2.1.orig/lib/matplotlib/font_manager.py        2013-03-26
> 14:04:37.000000000 +0100
> +++ matplotlib-1.2.1/lib/matplotlib/font_manager.py     2013-07-08
> 14:49:37.791845661 +0200
> @@ -721,6 +721,8 @@
>           Return the name of the font that best matches the font
>           properties.
>           """
> +        if self._family is None:
> +          return rcParams['font.family']
>           return ft2font.FT2Font(str(findfont(self))).family_name
>
>       def get_style(self):
>
> Regards,
>


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to