Handle iterator weakrefs manually to improve performance

Much of the time required to constructan iterator is spent in the
WeakValueDictionary class, which is written in Python. Handle the
weakrefs manually from C code avoids that overhead, which results in a
major performance gain.