Show More
@@ -131,6 +131,7 b' class Kernel(Configurable):' | |||||
131 | # A reference to the Python builtin 'raw_input' function. |
|
131 | # A reference to the Python builtin 'raw_input' function. | |
132 | # (i.e., __builtin__.raw_input for Python 2.7, builtins.input for Python 3) |
|
132 | # (i.e., __builtin__.raw_input for Python 2.7, builtins.input for Python 3) | |
133 | _sys_raw_input = Any() |
|
133 | _sys_raw_input = Any() | |
|
134 | _sys_eval_input = Any() | |||
134 |
|
135 | |||
135 | # set of aborted msg_ids |
|
136 | # set of aborted msg_ids | |
136 | aborted = Set() |
|
137 | aborted = Set() | |
@@ -352,15 +353,18 b' class Kernel(Configurable):' | |||||
352 | # raw_input in the user namespace. |
|
353 | # raw_input in the user namespace. | |
353 | if content.get('allow_stdin', False): |
|
354 | if content.get('allow_stdin', False): | |
354 | raw_input = lambda prompt='': self._raw_input(prompt, ident, parent) |
|
355 | raw_input = lambda prompt='': self._raw_input(prompt, ident, parent) | |
|
356 | input = lambda prompt='': eval(raw_input(prompt)) | |||
355 | else: |
|
357 | else: | |
356 | raw_input = lambda prompt='' : self._no_raw_input() |
|
358 | raw_input = input = lambda prompt='' : self._no_raw_input() | |
357 |
|
359 | |||
358 | if py3compat.PY3: |
|
360 | if py3compat.PY3: | |
359 | self._sys_raw_input = __builtin__.input |
|
361 | self._sys_raw_input = __builtin__.input | |
360 | __builtin__.input = raw_input |
|
362 | __builtin__.input = raw_input | |
361 | else: |
|
363 | else: | |
362 | self._sys_raw_input = __builtin__.raw_input |
|
364 | self._sys_raw_input = __builtin__.raw_input | |
|
365 | self._sys_eval_input = __builtin__.input | |||
363 | __builtin__.raw_input = raw_input |
|
366 | __builtin__.raw_input = raw_input | |
|
367 | __builtin__.input = input | |||
364 |
|
368 | |||
365 | # Set the parent message of the display hook and out streams. |
|
369 | # Set the parent message of the display hook and out streams. | |
366 | shell.displayhook.set_parent(parent) |
|
370 | shell.displayhook.set_parent(parent) | |
@@ -403,6 +407,7 b' class Kernel(Configurable):' | |||||
403 | __builtin__.input = self._sys_raw_input |
|
407 | __builtin__.input = self._sys_raw_input | |
404 | else: |
|
408 | else: | |
405 | __builtin__.raw_input = self._sys_raw_input |
|
409 | __builtin__.raw_input = self._sys_raw_input | |
|
410 | __builtin__.input = self._sys_eval_input | |||
406 |
|
411 | |||
407 | reply_content[u'status'] = status |
|
412 | reply_content[u'status'] = status | |
408 |
|
413 |
General Comments 0
You need to be logged in to leave comments.
Login now