Ported weakref API funcs (all two).