D6052: global: use raw string for setlocale() argument

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sat Mar 2 21:26:54 UTC 2019


indygreg created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Otherwise Python 2 will coerce a unicode to str, which fails
  on HGUNICODEPEDANTRY=1.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6052

AFFECTED FILES
  hgext/histedit.py
  mercurial/crecord.py

CHANGE DETAILS

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -30,7 +30,7 @@
 
 # This is required for ncurses to display non-ASCII characters in default user
 # locale encoding correctly.  --immerrr
-locale.setlocale(locale.LC_ALL, u'')
+locale.setlocale(locale.LC_ALL, r'')
 
 # patch comments based on the git one
 diffhelptext = _("""# To remove '-' lines, make them ' ' lines (context).
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -953,7 +953,7 @@
     # locale. This sets the locale to the user's default system
     # locale.
     import locale
-    locale.setlocale(locale.LC_ALL, u'')
+    locale.setlocale(locale.LC_ALL, r'')
 except ImportError:
     curses = None
 



To: indygreg, durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list