mercurial/__init__.py
changeset 42603 3018749a71bb
parent 42574 d28d91f9f35a
child 43076 2372284d9457
equal deleted inserted replaced
42602:c7d236b55a3e 42603:3018749a71bb
   223                         if argidx is not None:
   223                         if argidx is not None:
   224                             _ensureunicode(argidx)
   224                             _ensureunicode(argidx)
   225 
   225 
   226                 # It changes iteritems/values to items/values as they are not
   226                 # It changes iteritems/values to items/values as they are not
   227                 # present in Python 3 world.
   227                 # present in Python 3 world.
   228                 elif fn in ('iteritems', 'itervalues'):
   228                 elif (fn in ('iteritems', 'itervalues') and
       
   229                       not (tokens[i - 1].type == token.NAME and
       
   230                            tokens[i - 1].string == 'def')):
   229                     yield t._replace(string=fn[4:])
   231                     yield t._replace(string=fn[4:])
   230                     continue
   232                     continue
   231 
   233 
   232             # Emit unmodified token.
   234             # Emit unmodified token.
   233             yield t
   235             yield t
   234 
   236 
   235     # Header to add to bytecode files. This MUST be changed when
   237     # Header to add to bytecode files. This MUST be changed when
   236     # ``replacetoken`` or any mechanism that changes semantics of module
   238     # ``replacetoken`` or any mechanism that changes semantics of module
   237     # loading is changed. Otherwise cached bytecode may get loaded without
   239     # loading is changed. Otherwise cached bytecode may get loaded without
   238     # the new transformation mechanisms applied.
   240     # the new transformation mechanisms applied.
   239     BYTECODEHEADER = b'HG\x00\x0b'
   241     BYTECODEHEADER = b'HG\x00\x0c'
   240 
   242 
   241     class hgloader(importlib.machinery.SourceFileLoader):
   243     class hgloader(importlib.machinery.SourceFileLoader):
   242         """Custom module loader that transforms source code.
   244         """Custom module loader that transforms source code.
   243 
   245 
   244         When the source code is converted to a code object, we transform
   246         When the source code is converted to a code object, we transform