def test_prefilter_attribute_errors():
 class X(object, ):
  def __getattr__(self, k):
   raise ValueError('broken object')
  def __call__(self, x):
   return x
 ip.user_ns['x'] = X()
 ip.magic('autocall 2')
 try:
  ip.prefilter('x 1')
 finally:
  del ip.user_ns['x']
  ip.magic('autocall 0')

def test_prefilter_attribute_errors ( ) : class X ( object , ) : def __getattr__ ( self , k ) : raise ValueError ( 'broken object' ) def __call__ ( self , x ) : return x ip . user_ns [ 'x' ] = X ( ) ip . magic ( 'autocall 2' ) try : ip . prefilter ( 'x 1' ) finally : del ip . user_ns [ 'x' ] ip . magic ( 'autocall 0' )
capture exceptions thrown by user objects on attribute access .