equal
deleted
inserted
replaced
34 if ispy3: |
34 if ispy3: |
35 import builtins |
35 import builtins |
36 import functools |
36 import functools |
37 import os |
37 import os |
38 fsencode = os.fsencode |
38 fsencode = os.fsencode |
|
39 fsdecode = os.fsdecode |
39 |
40 |
40 def sysstr(s): |
41 def sysstr(s): |
41 """Return a keyword str to be passed to Python functions such as |
42 """Return a keyword str to be passed to Python functions such as |
42 getattr() and str.encode() |
43 getattr() and str.encode() |
43 |
44 |
73 if isinstance(filename, str): |
74 if isinstance(filename, str): |
74 return filename |
75 return filename |
75 else: |
76 else: |
76 raise TypeError( |
77 raise TypeError( |
77 "expect str, not %s" % type(filename).__name__) |
78 "expect str, not %s" % type(filename).__name__) |
|
79 |
|
80 # In Python 2, fsdecode() has a very chance to receive bytes. So it's |
|
81 # better not to touch Python 2 part as it's already working fine. |
|
82 def fsdecode(filename): |
|
83 return filename |
78 |
84 |
79 stringio = io.StringIO |
85 stringio = io.StringIO |
80 empty = _queue.Empty |
86 empty = _queue.Empty |
81 queue = _queue.Queue |
87 queue = _queue.Queue |
82 |
88 |