mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	Another fix. Partly reverted the tweaks done by the previous fix.
This commit is contained in:
		
							parent
							
								
									091153d43b
								
							
						
					
					
						commit
						cd70eee244
					
				
					 1 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -290,8 +290,8 @@ def __getitem__(self, key):
 | 
			
		|||
                if key == 'a':
 | 
			
		||||
                    return 12
 | 
			
		||||
                raise KeyError
 | 
			
		||||
            def __iter__(self):
 | 
			
		||||
                return iter('xyz')
 | 
			
		||||
            def keys(self):
 | 
			
		||||
                return list('xyz')
 | 
			
		||||
 | 
			
		||||
        m = M()
 | 
			
		||||
        g = globals()
 | 
			
		||||
| 
						 | 
				
			
			@ -313,8 +313,8 @@ def __getitem__(self, key):
 | 
			
		|||
                if key == 'a':
 | 
			
		||||
                    return 12
 | 
			
		||||
                return dict.__getitem__(self, key)
 | 
			
		||||
            def __iter__(self):
 | 
			
		||||
                return iter('xyz')
 | 
			
		||||
            def keys(self):
 | 
			
		||||
                return list('xyz')
 | 
			
		||||
 | 
			
		||||
        d = D()
 | 
			
		||||
        self.assertEqual(eval('a', g, d), 12)
 | 
			
		||||
| 
						 | 
				
			
			@ -346,8 +346,8 @@ def __getitem__(self, key):
 | 
			
		|||
        class C:
 | 
			
		||||
            def __getitem__(self, item):
 | 
			
		||||
                raise KeyError(item)
 | 
			
		||||
            def __iter__(self):
 | 
			
		||||
                return 'a'  # XXX Not quite faithful to the SF bug...
 | 
			
		||||
            def keys(self):
 | 
			
		||||
                return 1 # used to be 'a' but that's no longer an error
 | 
			
		||||
        self.assertRaises(TypeError, eval, 'dir()', globals(), C())
 | 
			
		||||
 | 
			
		||||
    # Done outside of the method test_z to get the correct scope
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue