Skip to content

Commit

Permalink
Merge remote-tracking branch 'takluyver/pypy-compat'
Browse files Browse the repository at this point in the history
  • Loading branch information
takluyver committed Sep 7, 2011
2 parents db29245 + d8f3d17 commit 9a6a3fb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
4 changes: 2 additions & 2 deletions IPython/core/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from IPython.testing.skipdoctest import skip_doctest
from IPython.utils import io
from IPython.utils.traitlets import Bool, Dict, Instance, Int, List, Unicode
from IPython.utils.traitlets import Bool, Dict, Instance, Int, CInt, List, Unicode
from IPython.utils.warn import warn

#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -63,7 +63,7 @@ def _dir_hist_default(self):
# The SQLite database
db = Instance(sqlite3.Connection)
# The number of the current session in the history database
session_number = Int()
session_number = CInt()
# Should we log output to the database? (default no)
db_log_output = Bool(False, config=True)
# Write to database every x commands (higher values save disk access & power)
Expand Down
8 changes: 4 additions & 4 deletions IPython/core/interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@
# Utilities
#-----------------------------------------------------------------------------

# store the builtin raw_input globally, and use this always, in case user code
# overwrites it (like wx.py.PyShell does)
raw_input_original = raw_input

def softspace(file, newvalue):
"""Copied from code.py, to remove the dependency"""

Expand Down Expand Up @@ -411,6 +407,10 @@ def __init__(self, config=None, ipython_dir=None, profile_dir=None,
# init_readline() must come before init_io(), because init_io uses
# readline related things.
self.init_readline()
# We save this here in case user code replaces raw_input, but it needs
# to be after init_readline(), because PyPy's readline works by replacing
# raw_input.
self.raw_input_original = raw_input
# init_completer must come after init_readline, because it needs to
# know whether readline is present or not system-wide to configure the
# completers, since the completion machinery can now operate
Expand Down
2 changes: 1 addition & 1 deletion IPython/core/magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3179,7 +3179,7 @@ def _get_pasted_lines(self, sentinel):
from IPython.core import interactiveshell
print "Pasting code; enter '%s' alone on the line to stop." % sentinel
while True:
l = interactiveshell.raw_input_original(':')
l = self.shell.raw_input_original(':')
if l == sentinel:
return
else:
Expand Down
7 changes: 1 addition & 6 deletions IPython/frontend/terminal/interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ def get_default_editor():
ed = 'notepad' # same in Windows!
return ed


# store the builtin raw_input globally, and use this always, in case user code
# overwrites it (like wx.py.PyShell does)
raw_input_original = raw_input

#-----------------------------------------------------------------------------
# Main class
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -337,7 +332,7 @@ def raw_input(self, prompt=''):
self.set_readline_completer()

try:
line = raw_input_original(prompt).decode(self.stdin_encoding)
line = self.raw_input_original(prompt).decode(self.stdin_encoding)
except ValueError:
warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
" or sys.stdout.close()!\nExiting IPython!")
Expand Down

0 comments on commit 9a6a3fb

Please sign in to comment.