# HG changeset patch # User Martijn Pieters <mjpiet...@fb.com> # Date 1476012788 -7200 # Sun Oct 09 13:33:08 2016 +0200 # Node ID 096d7a42fe6425bf741b09d47e77b387c6180ca4 # Parent a56076f85aa6aa728457ecc571ff58514bc59896 py3: a second argument to open can't be bytes
diff --git a/mercurial/__init__.py b/mercurial/__init__.py --- a/mercurial/__init__.py +++ b/mercurial/__init__.py @@ -305,6 +305,22 @@ except IndexError: pass + if fn == 'open': + try: + # (NAME, 'open') + # (OP, '(') + # (NAME|STRING, 'filename') + # (OP, ',') + # (NAME|STRING, mode) + st = tokens[i + 4] + if (st.type == token.STRING and + st.string[0] in ("'", '"')): + rt = tokenize.TokenInfo(st.type, 'u%s' % st.string, + st.start, st.end, st.line) + tokens[i + 4] = rt + except IndexError: + pass + # It changes iteritems to items as iteritems is not # present in Python 3 world. if fn == 'iteritems': @@ -319,7 +335,7 @@ # ``replacetoken`` or any mechanism that changes semantics of module # loading is changed. Otherwise cached bytecode may get loaded without # the new transformation mechanisms applied. - BYTECODEHEADER = b'HG\x00\x04' + BYTECODEHEADER = b'HG\x00\x05' class hgloader(importlib.machinery.SourceFileLoader): """Custom module loader that transforms source code. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel