Commit Graph

12 Commits

Author SHA1 Message Date
Victor Stinner 7b5a900e88 asyncio: BaseSubprocessTransport._kill_wait() now also call close()
close() closes pipes, which is not None yet by _kill_wait().
2015-01-29 02:14:30 +01:00
Victor Stinner 29ad0111bd asyncio: sync with Tulip
* PipeHandle now uses None instead of -1 for a closed handle
* Sort imports in windows_utils.
* Fix test_events on Python older than 3.5. Skip SSL tests on the
  ProactorEventLoop if ssl.MemoryIO is missing
* Fix BaseEventLoop._create_connection_transport(). Close the transport if the
  creation of the transport (if the waiter) gets an exception.
* _ProactorBasePipeTransport now sets _sock to None when the transport is
  closed.
* Fix BaseSubprocessTransport.close(). Ignore pipes for which the protocol is
  not set yet (still equal to None).
* TestLoop.close() now calls the close() method of the parent class
  (BaseEventLoop).
* Cleanup BaseSelectorEventLoop: create the protocol on a separated line for
  readability and ease debugging.
* Fix BaseSubprocessTransport._kill_wait(). Set the _returncode attribute, so
  close() doesn't try to terminate the process.
* Tests: explicitly close event loops and transports
* UNIX pipe transports: add closed/closing in repr(). Add "closed" or "closing"
  state in the __repr__() method of _UnixReadPipeTransport and
  _UnixWritePipeTransport classes.
2015-01-15 00:04:21 +01:00
Victor Stinner f651a60407 Python issue #23173: sync with Tulip
* If an exception is raised during the creation of a subprocess, kill the
  subprocess (close pipes, kill and read the return status). Log an error in
  such case.
* Fix SubprocessStreamProtocol.connection_made() to handle cancelled waiter.
  Add unit test cancelling subprocess methods.
2015-01-14 02:10:33 +01:00
Victor Stinner 587feb19e8 Issue #23209: Break some reference cycles in asyncio. Patch written by Martin
Richard.
2015-01-09 21:34:27 +01:00
Victor Stinner 1b9763d0a9 asyncio: sync with Tulip
* 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
2014-12-18 23:47:27 +01:00
Victor Stinner acdb782a83 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().
2014-07-14 18:33:40 +02:00
Victor Stinner f951d28ac8 asyncio: sync with Tulip, add a new asyncio.coroutines module 2014-06-29 00:46:45 +02:00
Victor Stinner 915bcb0111 Issue #20400: Merge Tulip into Python: add the new asyncio.subprocess module
* Add a new asyncio.subprocess module
* Add new create_subprocess_exec() and create_subprocess_shell() functions
* The new asyncio.subprocess.SubprocessStreamProtocol creates stream readers
  for stdout and stderr and a stream writer for stdin.
* The new asyncio.subprocess.Process class offers an API close to the
  subprocess.Popen class:

  - pid, returncode, stdin, stdout and stderr attributes
  - communicate(), wait(), send_signal(), terminate() and kill() methods

* Remove STDIN (0), STDOUT (1) and STDERR (2) constants from base_subprocess
  and unix_events, to not be confused with the symbols with the same name of
  subprocess and asyncio.subprocess modules
* _ProactorBasePipeTransport.get_write_buffer_size() now counts also the size
  of the pending write
* _ProactorBaseWritePipeTransport._loop_writing() may now pause the protocol if
  the write buffer size is greater than the high water mark (64 KB by default)
2014-02-01 22:49:59 +01:00
Guido van Rossum 1e9a446ebe asyncio: Pass through pause/resume from subprocess pipe proto to subprocess proto. Also kill dummy eof_received(). 2014-01-29 14:28:15 -08:00
Victor Stinner aaabc4fdca asyncio: Get rid of _try_connected(). 2014-01-29 14:22:56 -08:00
Andrew Svetlov 0742cae335 Merge latest Tulip into asyncio 2014-01-26 18:36:01 +02:00
Guido van Rossum 0016e1d8ba asyncio: Add new file (forgotten). 2013-10-30 14:56:49 -07:00