# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1478121825 -19800
#      Thu Nov 03 02:53:45 2016 +0530
# Node ID 8cd0e855ebb448a4ec1e835b346a920a1cb835cb
# Parent  495481800cc65bddf8a944ce0a091fef5972c6b9
py3: use try/except to check for basestring

The term basestring don't exist in Python 3.5 and throws a NameError.
It used to refer to unicodes in Python 2. Used try/expect to handle this.

diff -r 495481800cc6 -r 8cd0e855ebb4 mercurial/ui.py
--- a/mercurial/ui.py   Thu Nov 03 02:27:46 2016 +0530
+++ b/mercurial/ui.py   Thu Nov 03 02:53:45 2016 +0530
@@ -520,7 +520,12 @@
         result = self.config(section, name, untrusted=untrusted)
         if result is None:
             result = default or []
-        if isinstance(result, basestring):
+        checkunicode = False
+        try:
+            checkunicode = isinstance(result, basestring)
+        except NameError:
+            checkunicode = isinstance(result, str)
+        if checkunicode:
             result = _configlist(result.lstrip(' ,\n'))
             if result is None:
                 result = default or []
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to