File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 3535import shutil
3636import sys
3737
38+
39+ PY3K = sys .version_info >= (3 , 0 )
40+
3841# PEP 3114
39- if sys . version_info [ 0 ] == 2 :
42+ if not PY3K :
4043 compat_next = lambda gen : gen .next ()
4144else :
4245 compat_next = lambda gen : gen .__next__ ()
4346
44- # In Python 3 b'0' gives int 30 while b'0' in Python 3
45- def compat_ord (c ):
46- if isinstance (c , int ):
47- return c
48- return ord (c )
49-
5047
5148#------------------------------------------------
5249# Logging is controlled by logger named after the
@@ -960,9 +957,11 @@ def _reverse(self):
960957 h .startsrc , h .starttgt = h .starttgt , h .startsrc
961958 h .linessrc , h .linestgt = h .linestgt , h .linessrc
962959 for i ,line in enumerate (h .text ):
963- if compat_ord (line [0 ]) == compat_ord (b'+' ):
960+ # need to use line[0:1] here, because line[0]
961+ # returns int instead of bytes on Python 3
962+ if line [0 :1 ] == b'+' :
964963 h .text [i ] = b'-' + line [1 :]
965- elif compat_ord ( line [0 ]) == compat_ord ( b'-' ) :
964+ elif line [0 : 1 ] == b'-' :
966965 h .text [i ] = b'+' + line [1 :]
967966
968967 def revert (self , strip = 0 , root = None ):
You can’t perform that action at this time.
0 commit comments