summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/streams.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-14 16:33:40 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-07-14 16:33:40 (GMT)
commitacdb782a83d72a823030335e8f190890ae4df9cf (patch)
tree4a4a894ea9296027473031806b1b3dcbade6c1ac /Lib/asyncio/streams.py
parentb1ebfdddb356d5ad63bacb10589a402c6407a86c (diff)
downloadcpython-acdb782a83d72a823030335e8f190890ae4df9cf.zip
cpython-acdb782a83d72a823030335e8f190890ae4df9cf.tar.gz
cpython-acdb782a83d72a823030335e8f190890ae4df9cf.tar.bz2
asyncio: sync with Tulip
* Tulip issue #184: Log subprocess events in debug mode - Log stdin, stdout and stderr transports and protocols - Log process identifier (pid) - Log connection of pipes - Log process exit - Log Process.communicate() tasks: feed stdin, read stdout and stderr - Add __repr__() method to many classes related to subprocesses * Add BaseSubprocessTransport._pid attribute. Store the pid so it is still accessible after the process exited. It's more convinient for debug. * create_connection(): add the socket in the "connected to" debug log * Clean up some docstrings and comments. Remove unused unimplemented _read_from_self().
Diffstat (limited to 'Lib/asyncio/streams.py')
-rw-r--r--Lib/asyncio/streams.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py
index 9b654cd..d18db77 100644
--- a/Lib/asyncio/streams.py
+++ b/Lib/asyncio/streams.py
@@ -15,6 +15,7 @@ from . import events
from . import futures
from . import protocols
from .coroutines import coroutine
+from .log import logger
_DEFAULT_LIMIT = 2**16
@@ -153,10 +154,15 @@ class FlowControlMixin(protocols.Protocol):
def pause_writing(self):
assert not self._paused
self._paused = True
+ if self._loop.get_debug():
+ logger.debug("%r pauses writing", self)
def resume_writing(self):
assert self._paused
self._paused = False
+ if self._loop.get_debug():
+ logger.debug("%r resumes writing", self)
+
waiter = self._drain_waiter
if waiter is not None:
self._drain_waiter = None
@@ -244,6 +250,12 @@ class StreamWriter:
self._reader = reader
self._loop = loop
+ def __repr__(self):
+ info = [self.__class__.__name__, 'transport=%r' % self._transport]
+ if self._reader is not None:
+ info.append('reader=%r' % self._reader)
+ return '<%s>' % ' '.join(info)
+
@property
def transport(self):
return self._transport