Commit d0d0401f authored by Tres Seaver's avatar Tres Seaver

Sniff dict-like items correctly under Py3k.

parent 7991529d
...@@ -486,8 +486,14 @@ update_from_seq(PyObject *map, PyObject *seq) ...@@ -486,8 +486,14 @@ update_from_seq(PyObject *map, PyObject *seq)
* returns true for a PeristentMapping or PersistentDict, and we * returns true for a PeristentMapping or PersistentDict, and we
* want to use items() in those cases too. * want to use items() in those cases too.
*/ */
#ifdef PY3K
#define ITERITEMS "items"
#else
#define ITERITEMS "iteritems"
#endif
if (!PySequence_Check(seq) || /* or it "looks like a dict" */ if (!PySequence_Check(seq) || /* or it "looks like a dict" */
PyObject_HasAttrString(seq, "iteritems")) PyObject_HasAttrString(seq, ITERITEMS))
#undef ITERITEMS
{ {
PyObject *items; PyObject *items;
items = PyObject_GetAttrString(seq, "items"); items = PyObject_GetAttrString(seq, "items");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment