@@ -57,14 +57,14 @@ class CodeRunner:
57
57
"""Runs user code in an interpreter.
58
58
59
59
Running code requests a refresh by calling
60
- request_from_main_context (force_refresh=True), which
60
+ request_from_main_thread (force_refresh=True), which
61
61
suspends execution of the code by blocking on a queue
62
62
that the main thread was blocked on.
63
63
64
64
After load_code() is called with the source code to be run,
65
65
the run_code() method should be called to start running the code.
66
66
The running code may request screen refreshes and user input
67
- by calling request_from_main_context .
67
+ by calling request_from_main_thread .
68
68
When this are called, the running source code cedes
69
69
control, and the current run_code() method call returns.
70
70
@@ -98,7 +98,7 @@ def __init__(self, interp=None, request_refresh=lambda: None):
98
98
# waiting for response from main thread
99
99
self .code_is_waiting = False
100
100
# sigint happened while in main thread
101
- self .sigint_happened_in_main_context = False # TODO rename context to thread
101
+ self .sigint_happened_in_main_thread = False # TODO rename context to thread
102
102
self .orig_sigint_handler = None
103
103
104
104
@property
@@ -142,8 +142,8 @@ def run_code(self, for_code=None):
142
142
self .code_is_waiting = False
143
143
if is_main_thread ():
144
144
signal .signal (signal .SIGINT , self .sigint_handler )
145
- if self .sigint_happened_in_main_context :
146
- self .sigint_happened_in_main_context = False
145
+ if self .sigint_happened_in_main_thread :
146
+ self .sigint_happened_in_main_thread = False
147
147
self .responses_for_code_thread .put (SigintHappened )
148
148
else :
149
149
self .responses_for_code_thread .put (for_code )
@@ -180,7 +180,7 @@ def sigint_handler(self, *args):
180
180
"sigint while fulfilling code request sigint handler "
181
181
"running!"
182
182
)
183
- self .sigint_happened_in_main_context = True
183
+ self .sigint_happened_in_main_thread = True
184
184
185
185
def _blocking_run_code (self ):
186
186
try :
@@ -192,7 +192,7 @@ def _blocking_run_code(self):
192
192
if unfinished
193
193
else Done ())
194
194
195
- def request_from_main_context (self , force_refresh = False ):
195
+ def request_from_main_thread (self , force_refresh = False ):
196
196
"""Return the argument passed in to .run_code(for_code)
197
197
198
198
Nothing means calls to run_code must be... ???
@@ -223,7 +223,7 @@ def __init__(self, coderunner, on_write, real_fileobj):
223
223
224
224
def write (self , s , * args , ** kwargs ):
225
225
self .on_write (s , * args , ** kwargs )
226
- return self .coderunner .request_from_main_context (force_refresh = True )
226
+ return self .coderunner .request_from_main_thread (force_refresh = True )
227
227
228
228
# Some applications which use curses require that sys.stdout
229
229
# have a method called fileno. One example is pwntools. This
0 commit comments