def test_whos():
    'Check that whos is protected against objects where repr() fails.'

    class A(object):

        def __repr__(self):
            raise Exception()
    _ip.user_ns['a'] = A()
    _ip.magic('whos')
Check that whos is protected against objects where repr() fails.
def test_whos():
    

    class A(object):

        def __repr__(self):
            raise Exception()
    _ip.user_ns['a'] = A()
    _ip.magic('whos')