sbinet / go-python

naive go bindings to the CPython2 C-API
Other
1.53k stars 138 forks source link

Fix PyDict_Next, C function actually returns bool #55

Closed masci closed 7 years ago

masci commented 7 years ago

When iterating dictionaries, the return value from PyDict_Next is converted to an error, so even when the functions returns 1 meaning "you can keep iterating", go-python assumes it's an exit code != 0. According to Python docs the integer return value should be treated as a bool (1 meaning True).