mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 19:34:08 +00:00 
			
		
		
		
	asyncio.subprocess: Fix a race condition in communicate()
Use self._loop instead of self._transport._loop, because transport._loop is set to None at process exit.
This commit is contained in:
		
							parent
							
								
									88a928b614
								
							
						
					
					
						commit
						cdb476bd43
					
				
					 1 changed files with 1 additions and 2 deletions
				
			
		| 
						 | 
					@ -146,7 +146,6 @@ class Process:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @tasks.coroutine
 | 
					    @tasks.coroutine
 | 
				
			||||||
    def communicate(self, input=None):
 | 
					    def communicate(self, input=None):
 | 
				
			||||||
        loop = self._transport._loop
 | 
					 | 
				
			||||||
        if input:
 | 
					        if input:
 | 
				
			||||||
            stdin = self._feed_stdin(input)
 | 
					            stdin = self._feed_stdin(input)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
| 
						 | 
					@ -160,7 +159,7 @@ class Process:
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            stderr = self._noop()
 | 
					            stderr = self._noop()
 | 
				
			||||||
        stdin, stdout, stderr = yield from tasks.gather(stdin, stdout, stderr,
 | 
					        stdin, stdout, stderr = yield from tasks.gather(stdin, stdout, stderr,
 | 
				
			||||||
                                                        loop=loop)
 | 
					                                                        loop=self._loop)
 | 
				
			||||||
        yield from self.wait()
 | 
					        yield from self.wait()
 | 
				
			||||||
        return (stdout, stderr)
 | 
					        return (stdout, stderr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue