matplotlib/matplotlib — pull request #3274 by tacaswell (2014-07-18 02:41:33+00:00)
Title: BUG : fixes FontProperties memory leak

According to the data
model (https://docs.python.org/2/reference/datamodel.html#object.__hash__)
objects that define __hash__ need to define __eq__ or __cmp__. By
default, all user defined classes have a __cmp__ which evaluates to
False for all other objects.

Previously we do not define either __cmp__ or __eq__ on FontProperties,

This results in never finding the property
cached in the dict, hence the growth in the number of
FontProperties (and I assume the stuff in them).

By adding __eq__ and __ne__ we complete the data model and adding
FontProperties to dictionaries should work as expected.

This was not a problem before, but in #3077 the caching key was changed
from hash(prop) -> prop.

Closes #3264