demandimport: support importing builtins for Python 3
__builtin__ was renamed to builtins in Python 3. If importing
__builtin__ fails, fall back to importing builtins in order to support
Python 3.
--- a/mercurial/demandimport.py Sat Jun 27 17:29:15 2015 -0700
+++ b/mercurial/demandimport.py Sat Jun 27 17:31:06 2015 -0700
@@ -26,7 +26,12 @@
import os, sys
from contextlib import contextmanager
-import __builtin__ as builtins
+
+# __builtin__ in Python 2, builtins in Python 3.
+try:
+ import __builtin__ as builtins
+except ImportError:
+ import builtins
_origimport = __import__