mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	Merge 3.5 (asyncio)
This commit is contained in:
		
						commit
						a054f40e84
					
				
					 2 changed files with 12 additions and 4 deletions
				
			
		| 
						 | 
					@ -262,8 +262,12 @@ def _format_coroutine(coro):
 | 
				
			||||||
    assert iscoroutine(coro)
 | 
					    assert iscoroutine(coro)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not hasattr(coro, 'cr_code') and not hasattr(coro, 'gi_code'):
 | 
					    if not hasattr(coro, 'cr_code') and not hasattr(coro, 'gi_code'):
 | 
				
			||||||
        # Most likely a Cython coroutine.
 | 
					        # Most likely a built-in type or a Cython coroutine.
 | 
				
			||||||
        coro_name = getattr(coro, '__qualname__', coro.__name__)
 | 
					
 | 
				
			||||||
 | 
					        # Built-in types might not have __qualname__ or __name__.
 | 
				
			||||||
 | 
					        coro_name = getattr(
 | 
				
			||||||
 | 
					            coro, '__qualname__',
 | 
				
			||||||
 | 
					            getattr(coro, '__name__', type(coro).__name__))
 | 
				
			||||||
        coro_name = '{}()'.format(coro_name)
 | 
					        coro_name = '{}()'.format(coro_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        running = False
 | 
					        running = False
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2384,8 +2384,6 @@ def test_coroutine_like_object_debug_formatting(self):
 | 
				
			||||||
        # (such as ones compiled with Cython).
 | 
					        # (such as ones compiled with Cython).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        class Coro:
 | 
					        class Coro:
 | 
				
			||||||
            __name__ = 'AAA'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            def send(self, v):
 | 
					            def send(self, v):
 | 
				
			||||||
                pass
 | 
					                pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2399,6 +2397,7 @@ def __await__(self):
 | 
				
			||||||
                pass
 | 
					                pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        coro = Coro()
 | 
					        coro = Coro()
 | 
				
			||||||
 | 
					        coro.__name__ = 'AAA'
 | 
				
			||||||
        self.assertTrue(asyncio.iscoroutine(coro))
 | 
					        self.assertTrue(asyncio.iscoroutine(coro))
 | 
				
			||||||
        self.assertEqual(coroutines._format_coroutine(coro), 'AAA()')
 | 
					        self.assertEqual(coroutines._format_coroutine(coro), 'AAA()')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2408,6 +2407,11 @@ def __await__(self):
 | 
				
			||||||
        coro.cr_running = True
 | 
					        coro.cr_running = True
 | 
				
			||||||
        self.assertEqual(coroutines._format_coroutine(coro), 'BBB() running')
 | 
					        self.assertEqual(coroutines._format_coroutine(coro), 'BBB() running')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        coro = Coro()
 | 
				
			||||||
 | 
					        # Some coroutines might not have '__name__', such as
 | 
				
			||||||
 | 
					        # built-in async_gen.asend().
 | 
				
			||||||
 | 
					        self.assertEqual(coroutines._format_coroutine(coro), 'Coro()')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TimerTests(unittest.TestCase):
 | 
					class TimerTests(unittest.TestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue