Use WeakKeyDictionary instead of WeakSet

That makes it compatible with Python 2.6 again.

Change-Id: Ie19c0af7d0b27083ccbf9053494ac234b4a95330
Merge "Use WeakKeyDictionary instead of WeakSet"