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