Show More
@@ -68,7 +68,7 b' class hgimporter(object):' | |||||
68 | # indicates the type of module. So just assume what we found |
|
68 | # indicates the type of module. So just assume what we found | |
69 | # is OK (even though it could be a pure Python module). |
|
69 | # is OK (even though it could be a pure Python module). | |
70 | except ImportError: |
|
70 | except ImportError: | |
71 | if modulepolicy == 'c': |
|
71 | if modulepolicy == b'c': | |
72 | raise |
|
72 | raise | |
73 | zl = ziploader('mercurial', 'pure') |
|
73 | zl = ziploader('mercurial', 'pure') | |
74 | mod = zl.load_module(name) |
|
74 | mod = zl.load_module(name) | |
@@ -106,7 +106,7 b' class hgimporter(object):' | |||||
106 | 'version should exist' % name) |
|
106 | 'version should exist' % name) | |
107 |
|
107 | |||
108 | except ImportError: |
|
108 | except ImportError: | |
109 | if modulepolicy == 'c': |
|
109 | if modulepolicy == b'c': | |
110 | raise |
|
110 | raise | |
111 |
|
111 | |||
112 | # Could not load the C extension and pure Python is allowed. So |
|
112 | # Could not load the C extension and pure Python is allowed. So |
@@ -19,9 +19,9 b' import sys' | |||||
19 | # py - only load pure Python modules |
|
19 | # py - only load pure Python modules | |
20 | # |
|
20 | # | |
21 | # By default, require the C extensions for performance reasons. |
|
21 | # By default, require the C extensions for performance reasons. | |
22 | policy = 'c' |
|
22 | policy = b'c' | |
23 | policynoc = ('cffi', 'cffi-allow', 'py') |
|
23 | policynoc = (b'cffi', b'cffi-allow', b'py') | |
24 | policynocffi = ('c', 'py') |
|
24 | policynocffi = (b'c', b'py') | |
25 |
|
25 | |||
26 | try: |
|
26 | try: | |
27 | from . import __modulepolicy__ |
|
27 | from . import __modulepolicy__ | |
@@ -42,4 +42,8 b' if sys.version_info[0] >= 3:' | |||||
42 | policy = b'py' |
|
42 | policy = b'py' | |
43 |
|
43 | |||
44 | # Environment variable can always force settings. |
|
44 | # Environment variable can always force settings. | |
45 | policy = os.environ.get('HGMODULEPOLICY', policy) |
|
45 | if sys.version_info[0] >= 3: | |
|
46 | if 'HGMODULEPOLICY' in os.environ: | |||
|
47 | policy = os.environ['HGMODULEPOLICY'].encode('utf-8') | |||
|
48 | else: | |||
|
49 | policy = os.environ.get('HGMODULEPOLICY', policy) |
@@ -27,8 +27,14 b' New errors are not allowed. Warnings are' | |||||
27 | use encoding.environ instead (py3) |
|
27 | use encoding.environ instead (py3) | |
28 | Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob) |
|
28 | Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob) | |
29 | Skipping mercurial/httpclient/_readers.py it has no-che?k-code (glob) |
|
29 | Skipping mercurial/httpclient/_readers.py it has no-che?k-code (glob) | |
30 |
mercurial/policy.py:4 |
|
30 | mercurial/policy.py:46: | |
31 | > policy = os.environ.get('HGMODULEPOLICY', policy) |
|
31 | > if 'HGMODULEPOLICY' in os.environ: | |
|
32 | use encoding.environ instead (py3) | |||
|
33 | mercurial/policy.py:47: | |||
|
34 | > policy = os.environ['HGMODULEPOLICY'].encode('utf-8') | |||
|
35 | use encoding.environ instead (py3) | |||
|
36 | mercurial/policy.py:49: | |||
|
37 | > policy = os.environ.get('HGMODULEPOLICY', policy) | |||
32 | use encoding.environ instead (py3) |
|
38 | use encoding.environ instead (py3) | |
33 | Skipping mercurial/statprof.py it has no-che?k-code (glob) |
|
39 | Skipping mercurial/statprof.py it has no-che?k-code (glob) | |
34 | [1] |
|
40 | [1] |
@@ -23,3 +23,10 b' The full traceback is hidden to have a s' | |||||
23 | $ $PYTHON3 `which hg` version | tail -1 |
|
23 | $ $PYTHON3 `which hg` version | tail -1 | |
24 | *** failed to import extension babar from imaginary_elephant: *: 'imaginary_elephant' (glob) |
|
24 | *** failed to import extension babar from imaginary_elephant: *: 'imaginary_elephant' (glob) | |
25 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
25 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
|
26 | ||||
|
27 | Test bytes-ness of policy.policy with HGMODULEPOLICY | |||
|
28 | ||||
|
29 | $ HGMODULEPOLICY=py | |||
|
30 | $ export HGMODULEPOLICY | |||
|
31 | $ $PYTHON3 `which hg` debuginstall 2>&1 2>&1 | tail -1 | |||
|
32 | no problems detected |
General Comments 0
You need to be logged in to leave comments.
Login now