mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	bpo-36373: Fix deprecation warnings (GH-15889)
https://bugs.python.org/issue36373
This commit is contained in:
		
							parent
							
								
									efd5741ae9
								
							
						
					
					
						commit
						7264e92b71
					
				
					 5 changed files with 12 additions and 12 deletions
				
			
		|  | @ -332,7 +332,7 @@ def __init__(self, lock=None, *, loop=None): | |||
|                           DeprecationWarning, stacklevel=2) | ||||
| 
 | ||||
|         if lock is None: | ||||
|             lock = Lock(loop=self._loop) | ||||
|             lock = Lock(loop=loop) | ||||
|         elif lock._loop is not self._loop: | ||||
|             raise ValueError("loop argument must agree with lock") | ||||
| 
 | ||||
|  |  | |||
|  | @ -45,7 +45,7 @@ def __init__(self, maxsize=0, *, loop=None): | |||
|         # Futures. | ||||
|         self._putters = collections.deque() | ||||
|         self._unfinished_tasks = 0 | ||||
|         self._finished = locks.Event(loop=self._loop) | ||||
|         self._finished = locks.Event(loop=loop) | ||||
|         self._finished.set() | ||||
|         self._init(maxsize) | ||||
| 
 | ||||
|  |  | |||
|  | @ -500,10 +500,9 @@ def test_ctor_loop(self): | |||
|             self.assertIs(cond._loop, self.loop) | ||||
| 
 | ||||
|     def test_ctor_noloop(self): | ||||
|         with self.assertWarns(DeprecationWarning): | ||||
|             asyncio.set_event_loop(self.loop) | ||||
|             cond = asyncio.Condition() | ||||
|             self.assertIs(cond._loop, self.loop) | ||||
|         asyncio.set_event_loop(self.loop) | ||||
|         cond = asyncio.Condition() | ||||
|         self.assertIs(cond._loop, self.loop) | ||||
| 
 | ||||
|     def test_wait(self): | ||||
|         with self.assertWarns(DeprecationWarning): | ||||
|  |  | |||
|  | @ -83,8 +83,7 @@ def test_ctor_loop(self): | |||
| 
 | ||||
|     def test_ctor_noloop(self): | ||||
|         asyncio.set_event_loop(self.loop) | ||||
|         with self.assertWarns(DeprecationWarning): | ||||
|             q = asyncio.Queue() | ||||
|         q = asyncio.Queue() | ||||
|         self.assertIs(q._loop, self.loop) | ||||
| 
 | ||||
|     def test_repr(self): | ||||
|  |  | |||
|  | @ -89,8 +89,9 @@ def _callMaybeAsync(self, func, /, *args, **kwargs): | |||
|         else: | ||||
|             return ret | ||||
| 
 | ||||
|     async def _asyncioLoopRunner(self): | ||||
|         queue = self._asyncioCallsQueue | ||||
|     async def _asyncioLoopRunner(self, fut): | ||||
|         self._asyncioCallsQueue = queue = asyncio.Queue() | ||||
|         fut.set_result(None) | ||||
|         while True: | ||||
|             query = await queue.get() | ||||
|             queue.task_done() | ||||
|  | @ -113,8 +114,9 @@ def _setupAsyncioLoop(self): | |||
|         asyncio.set_event_loop(loop) | ||||
|         loop.set_debug(True) | ||||
|         self._asyncioTestLoop = loop | ||||
|         self._asyncioCallsQueue = asyncio.Queue(loop=loop) | ||||
|         self._asyncioCallsTask = loop.create_task(self._asyncioLoopRunner()) | ||||
|         fut = loop.create_future() | ||||
|         self._asyncioCallsTask = loop.create_task(self._asyncioLoopRunner(fut)) | ||||
|         loop.run_until_complete(fut) | ||||
| 
 | ||||
|     def _tearDownAsyncioLoop(self): | ||||
|         assert self._asyncioTestLoop is not None | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andrew Svetlov
						Andrew Svetlov