From e57ac64d83c51c0f12e8279603082bf8c8c5054c 2011-09-07 11:22:31 From: Thomas Kluyver Date: 2011-09-07 11:22:31 Subject: [PATCH] Small changes towards supporting Python 3. --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index b59516b..be54783 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -414,7 +414,10 @@ class InteractiveShell(SingletonConfigurable, Magic): # 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 + if py3compat.PY3: + self.raw_input_original = input + else: + 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 diff --git a/IPython/core/magic.py b/IPython/core/magic.py index 0956b35..8735c4d 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -61,7 +61,6 @@ from IPython.utils.text import LSString, SList, format_screen from IPython.utils.timing import clock, clock2 from IPython.utils.warn import warn, error from IPython.utils.ipstruct import Struct -import IPython.utils.generics #----------------------------------------------------------------------------- # Utility functions diff --git a/IPython/lib/deepreload.py b/IPython/lib/deepreload.py index 5925ee0..d9f3ca1 100644 --- a/IPython/lib/deepreload.py +++ b/IPython/lib/deepreload.py @@ -159,7 +159,10 @@ def deep_reload_hook(module): return import_module(name[i+1:], name, parent) # Save the original hooks -original_reload = __builtin__.reload +try: + original_reload = __builtin__.reload +except AttributeError: + original_reload = imp.reload # Python 3 # Replacement for reload() def reload(module, exclude=['sys', '__builtin__', '__main__']): diff --git a/IPython/utils/nested_context.py b/IPython/utils/nested_context.py index b47ec9c..49aafd4 100644 --- a/IPython/utils/nested_context.py +++ b/IPython/utils/nested_context.py @@ -21,8 +21,6 @@ def nested(*managers): do_something() """ - warn("With-statements now directly support multiple context managers", - DeprecationWarning, 3) exits = [] vars = [] exc = (None, None, None)