diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-10-29 18:36:13 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-10-29 18:36:13 +0100 |
commit | ba742e6a7b27d03bf0b4b53da633ef6bf92853e1 (patch) | |
tree | 25de2f71389b4447e06dbf193de9fdca871a9d58 | |
parent | e772048235a8d64a11f6addca8e627cdad2fa54b (diff) | |
download | trollius-ba742e6a7b27d03bf0b4b53da633ef6bf92853e1.tar.gz |
Add source traceback to BaseSubprocessTransport
-rw-r--r-- | asyncio/base_subprocess.py | 1 | ||||
-rw-r--r-- | asyncio/unix_events.py | 20 | ||||
-rw-r--r-- | asyncio/windows_events.py | 12 |
3 files changed, 20 insertions, 13 deletions
diff --git a/asyncio/base_subprocess.py b/asyncio/base_subprocess.py index d008779..b4be1c2 100644 --- a/asyncio/base_subprocess.py +++ b/asyncio/base_subprocess.py @@ -31,6 +31,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport): stderr=stderr, bufsize=bufsize, **kwargs) self._pid = self._proc.pid self._extra['subprocess'] = self._proc + self._source_traceback = self._loop._get_traceback() if self._loop.get_debug(): if isinstance(args, (bytes, str)): program = args diff --git a/asyncio/unix_events.py b/asyncio/unix_events.py index 93c8c1c..bdcd3fd 100644 --- a/asyncio/unix_events.py +++ b/asyncio/unix_events.py @@ -168,14 +168,18 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): stdin, stdout, stderr, bufsize, extra=None, **kwargs): with events.get_child_watcher() as watcher: - transp = _UnixSubprocessTransport(self, protocol, args, shell, - stdin, stdout, stderr, bufsize, - extra=extra, **kwargs) - yield from transp._post_init() - watcher.add_child_handler(transp.get_pid(), - self._child_watcher_callback, transp) - - return transp + transport = _UnixSubprocessTransport(self, protocol, args, shell, + stdin, stdout, stderr, + bufsize, extra=extra, + **kwargs) + if transport._source_traceback: + del transport._source_traceback[-1] + yield from transport._post_init() + watcher.add_child_handler(transport.get_pid(), + self._child_watcher_callback, + transport) + + return transport def _child_watcher_callback(self, pid, returncode, transp): self.call_soon_threadsafe(transp._process_exited, returncode) diff --git a/asyncio/windows_events.py b/asyncio/windows_events.py index 6763f0b..0530902 100644 --- a/asyncio/windows_events.py +++ b/asyncio/windows_events.py @@ -269,11 +269,13 @@ class ProactorEventLoop(proactor_events.BaseProactorEventLoop): def _make_subprocess_transport(self, protocol, args, shell, stdin, stdout, stderr, bufsize, extra=None, **kwargs): - transp = _WindowsSubprocessTransport(self, protocol, args, shell, - stdin, stdout, stderr, bufsize, - extra=extra, **kwargs) - yield from transp._post_init() - return transp + transport = _WindowsSubprocessTransport(self, protocol, args, shell, + stdin, stdout, stderr, bufsize, + extra=extra, **kwargs) + if transport._source_traceback: + del transport._source_traceback[-1] + yield from transport._post_init() + return transport class IocpProactor: |