Author: Armin Rigo <[email protected]>
Branch: keys_with_hash
Changeset: r79337:23c0a1a91166
Date: 2015-09-01 10:35 +0200
http://bitbucket.org/pypy/pypy/changeset/23c0a1a91166/
Log: Fix iterkeys_with_hash
diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py
--- a/rpython/rlib/objectmodel.py
+++ b/rpython/rlib/objectmodel.py
@@ -794,10 +794,14 @@
else:
return compute_hash(key)
+def _iterkeys_with_hash_untranslated(d):
+ for k in d:
+ yield (k, _expected_hash(d, k))
+
def iterkeys_with_hash(d):
"""Iterates (key, hash) pairs without recomputing the hash."""
if not we_are_translated():
- return ((k, _expected_hash(d, k)) for k in d)
+ return _iterkeys_with_hash_untranslated(d)
return d.iterkeys_with_hash()
def contains_with_hash(d, key, h):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit