Skip to content

Commit 99e3d4f

Browse files
author
Quentin Peter
committed
Change PY2 compatibility code
1 parent 190e8ba commit 99e3d4f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ipykernel/kernelbase.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from traitlets.config.configurable import SingletonConfigurable
3232
from IPython.core.error import StdinNotImplementedError, UsageError
3333
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
3535
from ipykernel.jsonutil import json_clean
3636
from traitlets import (
3737
Any, Instance, Float, Dict, List, Set, Integer, Unicode, Bool,
@@ -920,8 +920,8 @@ def _input_request(self, prompt, ident, parent, password=False):
920920
self._stdin_msg = None
921921
# Send the input request.
922922
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)
925925
# Await a response.
926926
reply = self._wait_input_request_reply()
927927

@@ -957,12 +957,12 @@ def _wait_input_request_reply(self):
957957
def _input_request_loop_step(self):
958958
"""Do one step of the input request loop."""
959959
# 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())
963963
else:
964-
is_main_thread = isinstance(threading.current_thread(),
965-
threading._MainThread)
964+
is_main_thread = isinstance(
965+
threading.current_thread(), threading._MainThread)
966966
if is_main_thread and self.eventloop and self._input_eventloop:
967967
self.eventloop(self)
968968
return self._stdin_msg

0 commit comments

Comments
 (0)