##// END OF EJS Templates
Merge remote-tracking branch 'takluyver/pypy-compat'
Thomas Kluyver -
r4729:9a6a3fbc merge
parent child Browse files
Show More
@@ -25,7 +25,7 b' from IPython.config.configurable import Configurable'
25
25
26 from IPython.testing.skipdoctest import skip_doctest
26 from IPython.testing.skipdoctest import skip_doctest
27 from IPython.utils import io
27 from IPython.utils import io
28 from IPython.utils.traitlets import Bool, Dict, Instance, Int, List, Unicode
28 from IPython.utils.traitlets import Bool, Dict, Instance, Int, CInt, List, Unicode
29 from IPython.utils.warn import warn
29 from IPython.utils.warn import warn
30
30
31 #-----------------------------------------------------------------------------
31 #-----------------------------------------------------------------------------
@@ -63,7 +63,7 b' class HistoryManager(Configurable):'
63 # The SQLite database
63 # The SQLite database
64 db = Instance(sqlite3.Connection)
64 db = Instance(sqlite3.Connection)
65 # The number of the current session in the history database
65 # The number of the current session in the history database
66 session_number = Int()
66 session_number = CInt()
67 # Should we log output to the database? (default no)
67 # Should we log output to the database? (default no)
68 db_log_output = Bool(False, config=True)
68 db_log_output = Bool(False, config=True)
69 # Write to database every x commands (higher values save disk access & power)
69 # Write to database every x commands (higher values save disk access & power)
@@ -86,10 +86,6 b" dedent_re = re.compile(r'^\\s+raise|^\\s+return|^\\s+pass')"
86 # Utilities
86 # Utilities
87 #-----------------------------------------------------------------------------
87 #-----------------------------------------------------------------------------
88
88
89 # store the builtin raw_input globally, and use this always, in case user code
90 # overwrites it (like wx.py.PyShell does)
91 raw_input_original = raw_input
92
93 def softspace(file, newvalue):
89 def softspace(file, newvalue):
94 """Copied from code.py, to remove the dependency"""
90 """Copied from code.py, to remove the dependency"""
95
91
@@ -411,6 +407,10 b' class InteractiveShell(SingletonConfigurable, Magic):'
411 # init_readline() must come before init_io(), because init_io uses
407 # init_readline() must come before init_io(), because init_io uses
412 # readline related things.
408 # readline related things.
413 self.init_readline()
409 self.init_readline()
410 # We save this here in case user code replaces raw_input, but it needs
411 # to be after init_readline(), because PyPy's readline works by replacing
412 # raw_input.
413 self.raw_input_original = raw_input
414 # init_completer must come after init_readline, because it needs to
414 # init_completer must come after init_readline, because it needs to
415 # know whether readline is present or not system-wide to configure the
415 # know whether readline is present or not system-wide to configure the
416 # completers, since the completion machinery can now operate
416 # completers, since the completion machinery can now operate
@@ -3179,7 +3179,7 b' Defaulting color scheme to \'NoColor\'"""'
3179 from IPython.core import interactiveshell
3179 from IPython.core import interactiveshell
3180 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3180 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3181 while True:
3181 while True:
3182 l = interactiveshell.raw_input_original(':')
3182 l = self.shell.raw_input_original(':')
3183 if l == sentinel:
3183 if l == sentinel:
3184 return
3184 return
3185 else:
3185 else:
@@ -47,11 +47,6 b' def get_default_editor():'
47 ed = 'notepad' # same in Windows!
47 ed = 'notepad' # same in Windows!
48 return ed
48 return ed
49
49
50
51 # store the builtin raw_input globally, and use this always, in case user code
52 # overwrites it (like wx.py.PyShell does)
53 raw_input_original = raw_input
54
55 #-----------------------------------------------------------------------------
50 #-----------------------------------------------------------------------------
56 # Main class
51 # Main class
57 #-----------------------------------------------------------------------------
52 #-----------------------------------------------------------------------------
@@ -337,7 +332,7 b' class TerminalInteractiveShell(InteractiveShell):'
337 self.set_readline_completer()
332 self.set_readline_completer()
338
333
339 try:
334 try:
340 line = raw_input_original(prompt).decode(self.stdin_encoding)
335 line = self.raw_input_original(prompt).decode(self.stdin_encoding)
341 except ValueError:
336 except ValueError:
342 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
337 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
343 " or sys.stdout.close()!\nExiting IPython!")
338 " or sys.stdout.close()!\nExiting IPython!")
General Comments 0
You need to be logged in to leave comments. Login now