diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-16 20:39:21 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-16 20:39:21 -0500 |
commit | b460581e8ab37f7d3aa1f1a154e5e67b96fc3585 (patch) | |
tree | 73e77ce040708f062a5f308c8f53bc445755e680 /coverage/backward.py | |
parent | d7b993da5b5eed6b4015227d9e70d061e7d94c9c (diff) | |
download | python-coveragepy-b460581e8ab37f7d3aa1f1a154e5e67b96fc3585.tar.gz |
Use iitems() to avoid lists of dict items on py2.
Diffstat (limited to 'coverage/backward.py')
-rw-r--r-- | coverage/backward.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/coverage/backward.py b/coverage/backward.py index b78158c..6347501 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -49,6 +49,16 @@ try: except NameError: range = range +# A function to iterate listlessly over a dict's items. +if "iteritems" in dir({}): + def iitems(d): + """Produce the items from dict `d`.""" + return d.iteritems() +else: + def iitems(d): + """Produce the items from dict `d`.""" + return d.items() + # Exec is a statement in Py2, a function in Py3 if sys.version_info >= (3, 0): def exec_code_object(code, global_map): |