Use PyObjectRef's automatic reference counting

Replace most Py_.*REF calls with PyObjectRef's automatic
memory management, with borrowed references.