diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 7c07e26..22f6a56 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -1382,14 +1382,6 @@ class InteractiveShell(SingletonConfigurable): found = False; obj = None; ospace = None; ismagic = False; isalias = False; parent = None - # We need to special-case 'print', which as of python2.6 registers as a - # function but should only be treated as one if print_function was - # loaded with a future import. In this case, just bail. - if (oname == 'print' and not py3compat.PY3 and not \ - (self.compile.compiler_flags & __future__.CO_FUTURE_PRINT_FUNCTION)): - return {'found':found, 'obj':obj, 'namespace':ospace, - 'ismagic':ismagic, 'isalias':isalias, 'parent':parent} - # Look for the given name by splitting it in parts. If the head is # found, then we look for all the remaining parts as members, and only # declare success if we can find them all. diff --git a/IPython/core/ultratb.py b/IPython/core/ultratb.py index f7d4c76..3ccbb81 100644 --- a/IPython/core/ultratb.py +++ b/IPython/core/ultratb.py @@ -1055,27 +1055,8 @@ class VerboseTB(TBTools): etype, evalue = str, sys.exc_info()[:2] etype_str, evalue_str = map(str, (etype, evalue)) # ... and format it - exception = ['%s%s%s: %s' % (colors.excName, etype_str, - colorsnormal, py3compat.cast_unicode(evalue_str))] - - if (not py3compat.PY3) and type(evalue) is types.InstanceType: - try: - names = [w for w in dir(evalue) if isinstance(w, str)] - except: - # Every now and then, an object with funny internals blows up - # when dir() is called on it. We do the best we can to report - # the problem and continue - _m = '%sException reporting error (object with broken dir())%s:' - exception.append(_m % (colors.excName, colorsnormal)) - etype_str, evalue_str = map(str, sys.exc_info()[:2]) - exception.append('%s%s%s: %s' % (colors.excName, etype_str, - colorsnormal, py3compat.cast_unicode(evalue_str))) - names = [] - for name in names: - value = text_repr(getattr(evalue, name)) - exception.append('\n%s%s = %s' % (indent, name, value)) - - return exception + return ['%s%s%s: %s' % (colors.excName, etype_str, + colorsnormal, py3compat.cast_unicode(evalue_str))] def format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset): """Formats the header, traceback and exception message for a single exception. diff --git a/IPython/extensions/autoreload.py b/IPython/extensions/autoreload.py index 7f4ba39..6dc3ec7 100644 --- a/IPython/extensions/autoreload.py +++ b/IPython/extensions/autoreload.py @@ -116,7 +116,7 @@ import traceback import types import weakref from importlib import import_module - +from IPython.utils.py3compat import PY3 try: # Reload is not defined by default in Python3. reload @@ -124,7 +124,6 @@ except NameError: from imp import reload from IPython.utils import openpy -from IPython.utils.py3compat import PY3 #------------------------------------------------------------------------------ # Autoreload functionality @@ -356,10 +355,7 @@ def superreload(module, reload=reload, old_objects={}): try: old_objects.setdefault(key, []).append(weakref.ref(obj)) except TypeError: - # weakref doesn't work for all types; - # create strong references for 'important' cases - if not PY3 and isinstance(obj, types.ClassType): - old_objects.setdefault(key, []).append(StrongRef(obj)) + pass # reload module try: diff --git a/IPython/utils/_process_common.py b/IPython/utils/_process_common.py index fa2144c..204092b 100644 --- a/IPython/utils/_process_common.py +++ b/IPython/utils/_process_common.py @@ -187,14 +187,6 @@ def arg_split(s, posix=False, strict=True): command-line args. """ - # Unfortunately, python's shlex module is buggy with unicode input: - # http://bugs.python.org/issue1170 - # At least encoding the input when it's unicode seems to help, but there - # may be more problems lurking. Apparently this is fixed in python3. - is_unicode = False - if (not py3compat.PY3) and isinstance(s, unicode): - is_unicode = True - s = s.encode('utf-8') lex = shlex.shlex(s, posix=posix) lex.whitespace_split = True # Extract tokens, ensuring that things like leaving open quotes @@ -216,8 +208,5 @@ def arg_split(s, posix=False, strict=True): # couldn't parse, get remaining blob as last token tokens.append(lex.token) break - - if is_unicode: - # Convert the tokens back to unicode. - tokens = [x.decode('utf-8') for x in tokens] + return tokens