File tree 2 files changed +13
-9
lines changed
2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 37
37
from __future__ import absolute_import
38
38
39
39
import sys
40
+ import threading
40
41
41
42
py3 = (sys .version_info [0 ] == 3 )
42
43
44
+
43
45
if py3 :
44
46
from pygments .lexers import Python3Lexer as PythonLexer
45
47
else :
46
48
from pygments .lexers import PythonLexer
47
49
50
+
48
51
if py3 or sys .version_info [:3 ] >= (2 , 7 , 3 ):
49
52
def prepare_for_exec (arg , encoding = None ):
50
53
return arg
@@ -65,3 +68,12 @@ def try_decode(s, encoding):
65
68
except UnicodeDecodeError :
66
69
return None
67
70
return s
71
+
72
+
73
+ if py3 :
74
+ def is_main_thread ():
75
+ return threading .main_thread () == threading .current_thread ()
76
+ else :
77
+ def is_main_thread ():
78
+ return isinstance (threading .current_thread (), threading ._MainThread )
79
+
Original file line number Diff line number Diff line change 34
34
from bpython .formatter import BPythonFormatter
35
35
from bpython import autocomplete
36
36
from bpython .translations import _
37
- from bpython ._py3compat import py3
37
+ from bpython ._py3compat import py3 , is_main_thread
38
38
from bpython .pager import get_pager_command
39
39
40
40
from bpython .curtsiesfrontend import replpainter as paint
99
99
unicode = str
100
100
101
101
102
- if py3 :
103
- def is_main_thread ():
104
- return threading .main_thread () == threading .current_thread ()
105
- else :
106
- def is_main_thread ():
107
- return isinstance (threading .current_thread (), threading ._MainThread )
108
-
109
-
110
102
class FakeStdin (object ):
111
103
"""The stdin object user code will reference
112
104
You can’t perform that action at this time.
0 commit comments