File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 125125import socketserver
126126import atexit
127127from textwrap import dedent
128+ from itertools import count
128129
129130try :
130131 # macro-enabled console with imacropy semantics
155156
156157_server_instance = None
157158_active_sessions = {}
158- _session_counter = 0 # for generating session ids, needed for pairing control and REPL sessions.
159+ _session_counter = count ( start = 1 ) # for generating session ids, needed for pairing control and REPL sessions.
159160_halt_pending = False
160161_original_stdin = sys .stdin
161162_original_stdout = sys .stdout
@@ -357,9 +358,7 @@ def handle(self):
357358
358359 try :
359360 # for control/REPL pairing
360- global _session_counter
361- _session_counter += 1
362- self .session_id = _session_counter
361+ self .session_id = next (_session_counter )
363362 _active_sessions [self .session_id ] = self # also for exit monitoring
364363
365364 # self.request is the socket. We don't need a StreamRequestHandler with self.rfile and self.wfile,
You can’t perform that action at this time.
0 commit comments