[issue30322] PyObject_GetIter does not behave as documented on dict objects

2017-05-10 Thread Sam De Meyer
Sam De Meyer added the comment: You seem to be right, my object was lacking the keys method. Please excuse me for the false alarm, and thanks for pointing it out. -- stage: -> resolved status: open -> closed ___ Python tracker

[issue30322] PyObject_GetIter does not behave as documented on dict objects

2017-05-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: This from the help on dict.update(): | update(...) | D.update([E, ]**F) -> None. Update D from dict/iterable E and F. | If E present and has a .keys() method, does: for k in E: D[k] = E[k] | If E present and lacks .keys() method, does

[issue30322] PyObject_GetIter does not behave as documented on dict objects

2017-05-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I can't believe in this since one-argument iter() just calls PyObject_GetIter(). dict.update() accepts either a dict-like object (which should have the keys() method) or an iterable producing key-value pairs. If your dict-like object doesn't work as expected

[issue30322] PyObject_GetIter does not behave as documented on dict objects

2017-05-09 Thread Sam De Meyer
New submission from Sam De Meyer: According to the docs (https://docs.python.org/3/c-api/object.html) the `PyObject_GetIter` method should be equivalent to the python call `iter()`, but, when given a dict, the `PyObject_GetIter` returns an iterator over key-value pairs whereas the `iter()` met