Python: fixed memory leaks in Vertex.attributes() and Edge.attributes()

Closes #778