# HG changeset patch # User Yuya Nishihara # Date 1489588119 -32400 # Node ID 3b7a6941a6efcca57c6d13bc356adee99adb7ff1 # Parent 52dabcc4996828e940d5e7d76fb07a9b84e49d26 py3: call codecs.escape_encode() directly string_escape doesn't exist on Python 3, but fortunately the undocumented codecs.escape_encode() function exists on CPython 2.6, 2.7, 3.5 and PyPy 5.6. So let's use it for now. http://stackoverflow.com/a/23151714 diff -r 52dabcc49968 -r 3b7a6941a6ef mercurial/util.py --- a/mercurial/util.py Wed Mar 15 23:21:30 2017 +0900 +++ b/mercurial/util.py Wed Mar 15 23:28:39 2017 +0900 @@ -17,6 +17,7 @@ import bz2 import calendar +import codecs import collections import datetime import errno @@ -2131,7 +2132,9 @@ ) def escapestr(s): - return s.encode('string_escape') + # call underlying function of s.encode('string_escape') directly for + # Python 3 compatibility + return codecs.escape_encode(s)[0] def uirepr(s): # Avoid double backslash in Windows path repr()