]> granicus.if.org Git - python/commitdiff
asyncio: sync with Tulip
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 18 Dec 2014 22:47:27 +0000 (23:47 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 18 Dec 2014 22:47:27 +0000 (23:47 +0100)
* Fix a race condition in BaseSubprocessTransport._try_finish().

  If the process exited before the _post_init() method was called, scheduling
  the call to _call_connection_lost() with call_soon() is wrong:
  connection_made() must be called before connection_lost().

  Reuse the BaseSubprocessTransport._call() method to schedule the call to
  _call_connection_lost() to ensure that connection_made() and
  connection_lost() are called in the correct order.

* Add repr(PipeHandle)

* Fix typo

Lib/asyncio/base_subprocess.py
Lib/asyncio/windows_events.py
Lib/asyncio/windows_utils.py

index d0087793600b5876df512d5f87d7475a84d2e038..81698b09850d106ff0cb8d3a46e3c6d3b9ec502a 100644 (file)
@@ -153,7 +153,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
         if all(p is not None and p.disconnected
                for p in self._pipes.values()):
             self._finished = True
-            self._loop.call_soon(self._call_connection_lost, None)
+            self._call(self._call_connection_lost, None)
 
     def _call_connection_lost(self, exc):
         try:
index 6763f0b7bdcff663798977a2040d5bdea8db0717..0773d061f79a31f57c3c8b37e584d463167eae30 100644 (file)
@@ -402,7 +402,7 @@ class IocpProactor:
             ov.getresult()
             return pipe
 
-        # FIXME: Tulip issue 196: why to we neeed register=False?
+        # FIXME: Tulip issue 196: why do we need register=False?
         # See also the comment in the _register() method
         return self._register(ov, pipe, finish_accept_pipe,
                               register=False)
index 1155a77f346cdf93e0e62e6b1e008445524f5c1c..c6e4bc9e46bce09e89893403b07e3681858961a0 100644 (file)
@@ -134,6 +134,13 @@ class PipeHandle:
     def __init__(self, handle):
         self._handle = handle
 
+    def __repr__(self):
+        if self._handle != -1:
+            handle = 'handle=%r' % self._handle
+        else:
+            handle = 'closed'
+        return '<%s %s>' % (self.__class__.__name__, handle)
+
     @property
     def handle(self):
         return self._handle