Commit 4a3a7006 authored by Tres Seaver's avatar Tres Seaver

Special-case Py3k dicts in _SetIterator.

They don't have 'iteritems', and their 'items' returns a custom iterable.
parent 48b6f87d
...@@ -21,6 +21,7 @@ from struct import error as struct_error ...@@ -21,6 +21,7 @@ from struct import error as struct_error
from persistent import Persistent from persistent import Persistent
from .Interfaces import BTreesConflictError from .Interfaces import BTreesConflictError
from ._compat import PY3
from ._compat import cmp from ._compat import cmp
from ._compat import int_types from ._compat import int_types
from ._compat import xrange from ._compat import xrange
...@@ -175,8 +176,11 @@ class _SetIteration(object): ...@@ -175,8 +176,11 @@ class _SetIteration(object):
try: try:
itmeth = to_iterate.iteritems itmeth = to_iterate.iteritems
except AttributeError: except AttributeError:
itmeth = to_iterate.__iter__ if PY3 and isinstance(to_iterate, dict): #pragma NO COVER Py3k
useValues = False itmeth = to_iterate.items().__iter__
else:
itmeth = to_iterate.__iter__
useValues = False
else: else:
self.value = None self.value = None
else: else:
......
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