File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 3737from __future__ import absolute_import
3838
3939import sys
40+ import threading
4041
4142py3 = (sys .version_info [0 ] == 3 )
4243
44+
4345if py3 :
4446 from pygments .lexers import Python3Lexer as PythonLexer
4547else :
4648 from pygments .lexers import PythonLexer
4749
50+
4851if py3 or sys .version_info [:3 ] >= (2 , 7 , 3 ):
4952 def prepare_for_exec (arg , encoding = None ):
5053 return arg
@@ -65,3 +68,12 @@ def try_decode(s, encoding):
6568 except UnicodeDecodeError :
6669 return None
6770 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 3434from bpython .formatter import BPythonFormatter
3535from bpython import autocomplete
3636from bpython .translations import _
37- from bpython ._py3compat import py3
37+ from bpython ._py3compat import py3 , is_main_thread
3838from bpython .pager import get_pager_command
3939
4040from bpython .curtsiesfrontend import replpainter as paint
9999 unicode = str
100100
101101
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-
110102class FakeStdin (object ):
111103 """The stdin object user code will reference
112104
You can’t perform that action at this time.
0 commit comments