branchmap.branchcache, among other classes, defines a
iteritems(). That currently gets replaced by items() by the source
transformer. That makes it harder for extensions to work with both py2
and py3, since they have to call either items() or iteritems() on
branchcache. Let's not replace definitions of iteritems() (and
itervalues()) and only replace the call-sites. We need to also add an
items() alias to branchcache (etc) so our transformer call-sites will
find it.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Comment Actions
- a/mercurial/__init__.py
+++ b/mercurial/__init__.py
@@ -225,7 +225,9 @@
- It changes iteritems/values to items/values as they are not
- present in Python 3 world.
- elif fn in ('iteritems', 'itervalues'):
+ elif (fn in ('iteritems', 'itervalues') and
+ not (tokens[i - 1].type == token.NAME and
+ tokens[i - 1].string == 'def')):
Perhaps, we need to bump the BYTECODEHEADER version to recompile all
py3 modules.
Comment Actions
Oops, I missed that despite the the big all-caps message. Thanks for pointing that out. I'll fix it in flight (changing HG\x00\x0b to HG\x00\x0c).