comparison mercurial/policy.py @ 43103:c95b2f40db7c

py3: stop normalizing 2nd argument of *attr() to unicode Now that we don't byteify strings, we can stop normalizing the 2nd string argument to getattr() and remove explicit overrides we were using in the code base. We no longer use some helper functions in the source transformer, so we remove those as well. Differential Revision: https://phab.mercurial-scm.org/D7012
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 06 Oct 2019 17:45:05 -0400
parents c59eb1560c44
children 313e3a279828
comparison
equal deleted inserted replaced
43102:829088e87032 43103:c95b2f40db7c
68 try: 68 try:
69 fakelocals[modname] = mod = getattr(pkg, modname) 69 fakelocals[modname] = mod = getattr(pkg, modname)
70 except AttributeError: 70 except AttributeError:
71 raise ImportError(r'cannot import name %s' % modname) 71 raise ImportError(r'cannot import name %s' % modname)
72 # force import; fakelocals[modname] may be replaced with the real module 72 # force import; fakelocals[modname] may be replaced with the real module
73 getattr(mod, r'__doc__', None) 73 getattr(mod, '__doc__', None)
74 return fakelocals[modname] 74 return fakelocals[modname]
75 75
76 76
77 # keep in sync with "version" in C modules 77 # keep in sync with "version" in C modules
78 _cextversions = { 78 _cextversions = {
92 } 92 }
93 93
94 94
95 def _checkmod(pkgname, modname, mod): 95 def _checkmod(pkgname, modname, mod):
96 expected = _cextversions.get((pkgname, modname)) 96 expected = _cextversions.get((pkgname, modname))
97 actual = getattr(mod, r'version', None) 97 actual = getattr(mod, 'version', None)
98 if actual != expected: 98 if actual != expected:
99 raise ImportError( 99 raise ImportError(
100 r'cannot import module %s.%s ' 100 r'cannot import module %s.%s '
101 r'(expected version: %d, actual: %r)' 101 r'(expected version: %d, actual: %r)'
102 % (pkgname, modname, expected, actual) 102 % (pkgname, modname, expected, actual)