Show More
@@ -138,7 +138,7 b' if ispy3:' | |||||
138 | if getattr(sys, 'argv', None) is not None: |
|
138 | if getattr(sys, 'argv', None) is not None: | |
139 | sysargv = list(map(os.fsencode, sys.argv)) |
|
139 | sysargv = list(map(os.fsencode, sys.argv)) | |
140 |
|
140 | |||
141 | bytechr = struct.Struct('>B').pack |
|
141 | bytechr = struct.Struct(r'>B').pack | |
142 | byterepr = b'%r'.__mod__ |
|
142 | byterepr = b'%r'.__mod__ | |
143 |
|
143 | |||
144 | class bytestr(bytes): |
|
144 | class bytestr(bytes): | |
@@ -282,7 +282,7 b' if ispy3:' | |||||
282 | xrange = builtins.range |
|
282 | xrange = builtins.range | |
283 | unicode = str |
|
283 | unicode = str | |
284 |
|
284 | |||
285 | def open(name, mode='r', buffering=-1, encoding=None): |
|
285 | def open(name, mode=b'r', buffering=-1, encoding=None): | |
286 | return builtins.open(name, sysstr(mode), buffering, encoding) |
|
286 | return builtins.open(name, sysstr(mode), buffering, encoding) | |
287 |
|
287 | |||
288 | safehasattr = _wrapattrfunc(builtins.hasattr) |
|
288 | safehasattr = _wrapattrfunc(builtins.hasattr) | |
@@ -359,7 +359,7 b' else:' | |||||
359 | return filename |
|
359 | return filename | |
360 | else: |
|
360 | else: | |
361 | raise TypeError( |
|
361 | raise TypeError( | |
362 | "expect str, not %s" % type(filename).__name__) |
|
362 | r"expect str, not %s" % type(filename).__name__) | |
363 |
|
363 | |||
364 | # In Python 2, fsdecode() has a very chance to receive bytes. So it's |
|
364 | # In Python 2, fsdecode() has a very chance to receive bytes. So it's | |
365 | # better not to touch Python 2 part as it's already working fine. |
|
365 | # better not to touch Python 2 part as it's already working fine. | |
@@ -404,11 +404,11 b' else:' | |||||
404 | rawinput = raw_input |
|
404 | rawinput = raw_input | |
405 | getargspec = inspect.getargspec |
|
405 | getargspec = inspect.getargspec | |
406 |
|
406 | |||
407 | isjython = sysplatform.startswith('java') |
|
407 | isjython = sysplatform.startswith(b'java') | |
408 |
|
408 | |||
409 | isdarwin = sysplatform == 'darwin' |
|
409 | isdarwin = sysplatform == b'darwin' | |
410 | isposix = osname == 'posix' |
|
410 | isposix = osname == b'posix' | |
411 | iswindows = osname == 'nt' |
|
411 | iswindows = osname == b'nt' | |
412 |
|
412 | |||
413 | def getoptb(args, shortlist, namelist): |
|
413 | def getoptb(args, shortlist, namelist): | |
414 | return _getoptbwrapper(getopt.getopt, args, shortlist, namelist) |
|
414 | return _getoptbwrapper(getopt.getopt, args, shortlist, namelist) |
General Comments 0
You need to be logged in to leave comments.
Login now