mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 11:49:12 +00:00 
			
		
		
		
	Use sys.platform instead of os.name to detect Windows in asyncio docs. Patch by Akira Li. (Merge 3.4->3.5)
This commit is contained in:
		
						commit
						26825bcb8d
					
				
					 2 changed files with 4 additions and 5 deletions
				
			
		| 
						 | 
					@ -57,9 +57,9 @@ asyncio currently provides two implementations of event loops:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Example to use a :class:`ProactorEventLoop` on Windows::
 | 
					Example to use a :class:`ProactorEventLoop` on Windows::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    import asyncio, os
 | 
					    import asyncio, sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if os.name == 'nt':
 | 
					    if sys.platform == 'win32':
 | 
				
			||||||
        loop = asyncio.ProactorEventLoop()
 | 
					        loop = asyncio.ProactorEventLoop()
 | 
				
			||||||
        asyncio.set_event_loop(loop)
 | 
					        asyncio.set_event_loop(loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -198,4 +198,3 @@ Access to the global loop policy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Set the current event loop policy. If *policy* is ``None``, the default
 | 
					   Set the current event loop policy. If *policy* is ``None``, the default
 | 
				
			||||||
   policy is restored.
 | 
					   policy is restored.
 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,9 +12,9 @@ On Windows, the default event loop is :class:`SelectorEventLoop` which does not
 | 
				
			||||||
support subprocesses. :class:`ProactorEventLoop` should be used instead.
 | 
					support subprocesses. :class:`ProactorEventLoop` should be used instead.
 | 
				
			||||||
Example to use it on Windows::
 | 
					Example to use it on Windows::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    import asyncio, os
 | 
					    import asyncio, sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if os.name == 'nt':
 | 
					    if sys.platform == 'win32':
 | 
				
			||||||
        loop = asyncio.ProactorEventLoop()
 | 
					        loop = asyncio.ProactorEventLoop()
 | 
				
			||||||
        asyncio.set_event_loop(loop)
 | 
					        asyncio.set_event_loop(loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue