diff --git a/IPython/core/tests/test_oinspect.py b/IPython/core/tests/test_oinspect.py
index ebb1802..ed6c08a 100644
--- a/IPython/core/tests/test_oinspect.py
+++ b/IPython/core/tests/test_oinspect.py
@@ -398,7 +398,7 @@ def test_property_sources():
 def test_property_docstring_is_in_info_for_detail_level_0():
     class A(object):
         @property
-        def foobar():
+        def foobar(self):
             """This is `foobar` property."""
             pass
 
diff --git a/IPython/external/decorators/_numpy_testing_utils.py b/IPython/external/decorators/_numpy_testing_utils.py
index a01e346..ad7bd0f 100644
--- a/IPython/external/decorators/_numpy_testing_utils.py
+++ b/IPython/external/decorators/_numpy_testing_utils.py
@@ -85,7 +85,7 @@ class WarningManager:
         else:
             return None
 
-    def __exit__(self):
+    def __exit__(self, type_, value, traceback):
         if not self._entered:
             raise RuntimeError("Cannot exit %r without entering first" % self)
         self._module.filters = self._filters
@@ -101,10 +101,8 @@ def assert_warns(warning_class, func, *args, **kw):
 
     # XXX: once we may depend on python >= 2.6, this can be replaced by the
     # warnings module context manager.
-    ctx = WarningManager(record=True)
-    l = ctx.__enter__()
-    warnings.simplefilter('always')
-    try:
+    with WarningManager(record=True) as l:
+        warnings.simplefilter('always')
         func(*args, **kw)
         if not len(l) > 0:
             raise AssertionError("No warning raised when calling %s"
@@ -112,5 +110,3 @@ def assert_warns(warning_class, func, *args, **kw):
         if not l[0].category is warning_class:
             raise AssertionError("First warning for %s is not a " \
                     "%s( is %s)" % (func.__name__, warning_class, l[0]))
-    finally:
-        ctx.__exit__()
diff --git a/IPython/lib/lexers.py b/IPython/lib/lexers.py
index 908188b..f983a3d 100644
--- a/IPython/lib/lexers.py
+++ b/IPython/lib/lexers.py
@@ -39,7 +39,7 @@ from pygments.lexer import (
     Lexer, DelegatingLexer, RegexLexer, do_insertions, bygroups, using,
 )
 from pygments.token import (
-    Comment, Generic, Keyword, Literal, Name, Operator, Other, Text, Error,
+    Generic, Keyword, Literal, Name, Operator, Other, Text, Error,
 )
 from pygments.util import get_bool_opt
 
@@ -83,13 +83,11 @@ def build_ipy_lexer(python3):
     # we will also have two IPython lexer classes.
     if python3:
         PyLexer = Python3Lexer
-        clsname = 'IPython3Lexer'
         name = 'IPython3'
         aliases = ['ipython3']
         doc = """IPython3 Lexer"""
     else:
         PyLexer = PythonLexer
-        clsname = 'IPythonLexer'
         name = 'IPython'
         aliases = ['ipython2', 'ipython']
         doc = """IPython Lexer"""
@@ -468,9 +466,9 @@ class IPythonConsoleLexer(Lexer):
             if insertion:
                 self.insertions.append((len(self.buffer), [insertion]))
             self.buffer += code
-        else:
-            for token in self.buffered_tokens():
-                yield token
+
+        for token in self.buffered_tokens():
+            yield token
 
 class IPyLexer(Lexer):
     """