pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers.
REVISION SUMMARY This backouts changeset https://phab.mercurial-scm.org/rHG7c54917b31f6200449bb7afd253ca0561288456a in which code to prevent adding b'' in front of second argument of open() was deleted in favour of pycompat.open(). Looking back, that's looks like a wrong decision as replacing open() with pycompat.open() is not a good idea. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2297 AFFECTED FILES mercurial/__init__.py CHANGE DETAILS diff --git a/mercurial/__init__.py b/mercurial/__init__.py --- a/mercurial/__init__.py +++ b/mercurial/__init__.py @@ -207,6 +207,13 @@ if argidx is not None: _ensureunicode(argidx) + # Bare open call (not an attribute on something else), the + # second argument (mode) must be a string, not bytes + elif fn == 'open' and not _isop(i - 1, '.'): + arg1idx = _findargnofcall(1) + if arg1idx is not None: + _ensureunicode(arg1idx) + # It changes iteritems/values to items/values as they are not # present in Python 3 world. elif fn in ('iteritems', 'itervalues'): @@ -220,7 +227,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\x0a' + BYTECODEHEADER = b'HG\x00\x0b' class hgloader(importlib.machinery.SourceFileLoader): """Custom module loader that transforms source code. To: pulkit, #hg-reviewers Cc: mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel