New submission from Tom Tromey: I was debugging this bug reported against gdb:
http://sourceware.org/bugzilla/show_bug.cgi?id=14386 It turns out that what went wrong in this code was that PyIter_Check evaluates to 0 when its argument is a Python list. This happens because the PyIter_Check macro looks at the tp_iternext field; but this field is 0 in PyList_Type. I am not sure of the correct fix; but PyIter_Check is not faithfully reflecting what PyObject_GetIter does. Maybe it isn't intended to; but anyway it seems that checking tp_iter would maybe be a better approximation. Even if PyIter_Check remains as-is, I think it would be nice if the documentation were more specific about what it actually does. FWIW I'm modifying gdb not to use this function. ---------- components: None messages: 167143 nosy: tromey priority: normal severity: normal status: open title: PyIter_Check evaluates to 0 for Python list object versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15529> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com