jelmer/dulwich — pull request #35 by eberle1080 (2011-11-13 23:27:45+00:00)
Title: Changed py_parse_tree to return a custom iterator

From _objects.c:69 (in `py_parse_tree`)

```C
/* TODO: currently this returns a list; if memory usage is a concern,
* consider rewriting as a custom iterator object */
```

I've gone ahead and implemented this. I've never created a generator function on the C side of things, so I used this as my guide:

http://stackoverflow.com/questions/1815812/how-to-create-a-generator-iterator-with-the-python-c-api/1816961#1816961

The tests all seem to work, and I don't think there are any leaks. I also wrote a py3k version, but the structures have changed enough that I decided to make it its own commit (rather than just merging this one).