|
31 | 31 | from traitlets.config.configurable import SingletonConfigurable |
32 | 32 | from IPython.core.error import StdinNotImplementedError, UsageError |
33 | 33 | from ipython_genutils import py3compat |
34 | | -from ipython_genutils.py3compat import unicode_type, string_types |
| 34 | +from ipython_genutils.py3compat import unicode_type, string_types, PY3 |
35 | 35 | from ipykernel.jsonutil import json_clean |
36 | 36 | from traitlets import ( |
37 | 37 | Any, Instance, Float, Dict, List, Set, Integer, Unicode, Bool, |
@@ -920,8 +920,8 @@ def _input_request(self, prompt, ident, parent, password=False): |
920 | 920 | self._stdin_msg = None |
921 | 921 | # Send the input request. |
922 | 922 | content = json_clean(dict(prompt=prompt, password=password)) |
923 | | - self.session.send(self.stdin_socket, u'input_request', content, parent, |
924 | | - ident=ident) |
| 923 | + self.session.send(self.stdin_socket, u'input_request', |
| 924 | + content, parent, ident=ident) |
925 | 925 | # Await a response. |
926 | 926 | reply = self._wait_input_request_reply() |
927 | 927 |
|
@@ -957,12 +957,12 @@ def _wait_input_request_reply(self): |
957 | 957 | def _input_request_loop_step(self): |
958 | 958 | """Do one step of the input request loop.""" |
959 | 959 | # Allow GUI event loop to update |
960 | | - if sys.version_info >= (3, 4): |
961 | | - is_main_thread = (threading.current_thread() is |
962 | | - threading.main_thread()) |
| 960 | + if PY3: |
| 961 | + is_main_thread = ( |
| 962 | + threading.current_thread() is threading.main_thread()) |
963 | 963 | else: |
964 | | - is_main_thread = isinstance(threading.current_thread(), |
965 | | - threading._MainThread) |
| 964 | + is_main_thread = isinstance( |
| 965 | + threading.current_thread(), threading._MainThread) |
966 | 966 | if is_main_thread and self.eventloop and self._input_eventloop: |
967 | 967 | self.eventloop(self) |
968 | 968 | return self._stdin_msg |
|
0 commit comments