@@ -3926,8 +3926,7 @@ def _open(self, filename, mode):
39263926 # - For Python 3, force the encoding. Forcing the encoding on Python 2
39273927 # turns strings into Unicode strings, which gets messy. Python 2
39283928 # doesn't decode regular strings anyway.
3929- return open (filename , "rU" if mode == "r" else mode ) if _IS_PY2 else \
3930- open (filename , mode , encoding = self ._encoding )
3929+ return open (filename , mode , encoding = self ._encoding )
39313930
39323931 def _check_undef_syms (self ):
39333932 # Prints warnings for all references to undefined symbols within the
@@ -3956,7 +3955,7 @@ def is_num(s):
39563955
39573956 return True
39583957
3959- for sym in ( self .syms .viewvalues if _IS_PY2 else self . syms . values ) ():
3958+ for sym in self .syms .values ():
39603959 # - sym.nodes empty means the symbol is undefined (has no
39613960 # definition locations)
39623961 #
@@ -6896,12 +6895,11 @@ def _shell_fn(kconf, _, command):
68966895 command , shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE
68976896 ).communicate ()
68986897
6899- if not _IS_PY2 :
6900- try :
6901- stdout = stdout .decode (kconf ._encoding )
6902- stderr = stderr .decode (kconf ._encoding )
6903- except UnicodeDecodeError as e :
6904- _decoding_error (e , kconf .filename , kconf .linenr )
6898+ try :
6899+ stdout = stdout .decode (kconf ._encoding )
6900+ stderr = stderr .decode (kconf ._encoding )
6901+ except UnicodeDecodeError as e :
6902+ _decoding_error (e , kconf .filename , kconf .linenr )
69056903
69066904 if stderr :
69076905 kconf ._warn ("'{}' wrote to stderr: {}" .format (
@@ -6938,9 +6936,6 @@ def _shell_fn(kconf, _, command):
69386936# Symbol will do. We test this with 'is'.
69396937_NO_CACHED_SELECTION = 0
69406938
6941- # Are we running on Python 2?
6942- _IS_PY2 = sys .version_info [0 ] < 3
6943-
69446939try :
69456940 _UNAME_RELEASE = os .uname ()[2 ]
69466941except AttributeError :
@@ -7233,11 +7228,11 @@ def _shell_fn(kconf, _, command):
72337228
72347229
72357230def _re_match (regex ):
7236- return re .compile (regex , 0 if _IS_PY2 else re .ASCII ).match
7231+ return re .compile (regex , re .ASCII ).match
72377232
72387233
72397234def _re_search (regex ):
7240- return re .compile (regex , 0 if _IS_PY2 else re .ASCII ).search
7235+ return re .compile (regex , re .ASCII ).search
72417236
72427237
72437238# Various regular expressions used during parsing
0 commit comments