Commit Graph

16 Commits

Author SHA1 Message Date
Victor Stinner fea6a100dc asyncio: sync with Tulip
Improve stability of the proactor event loop, especially operations on
overlapped objects:

* Tulip issue 195: Don't call UnregisterWait() twice if a _WaitHandleFuture is
  cancelled twice to fix a crash.
* IocpProactor.close(): cancel futures to cancel overlapped operations, instead
  of cancelling directly overlapped operations. Future objects may not call
  ov.cancel() if the future was cancelled or if the overlapped was already
  cancelled. The cancel() method of the future may also catch exceptions. Log
  also errors on cancellation.
* tests: rename "f" to "fut"
* Add a __repr__() method to IocpProactor
* Add a destructor to IocpProactor which closes it
* _OverlappedFuture.cancel() doesn't cancel the overlapped anymore if it is
  done: if it is already cancelled or completed. Log also an error if the
  cancellation failed.
* Add the address of the overlapped object in repr(_OverlappedFuture)
* _OverlappedFuture truncates the source traceback to hide the call to the
  parent constructor (useless in debug).
2014-07-25 00:54:53 +02:00
Victor Stinner 0e243612f8 asyncio tests: relax timings for slow buildbots 2014-07-24 12:04:22 +02:00
Victor Stinner 64d750b36b asyncio: Fix pyflakes errors
- Add a missing import
- Remove an unused import
- Remove unused variables
2014-06-18 03:25:23 +02:00
Victor Stinner c73701de72 asyncio: Refactor tests: add a base TestCase class 2014-06-18 01:36:32 +02:00
Victor Stinner f5e37037cc asyncio: Fix pyflakes warnings: remove unused variables and imports 2014-02-26 11:07:42 +01:00
Victor Stinner 1703bbbf89 Oops, undo unwanted changes in test_asyncio: mistakes of my the last sync with
Tulip (changeset d7ac90c0463a)
2014-02-03 23:59:52 +01: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
Victor Stinner a0aa88ce89 test_asyncio: relax timing, the "AMD64 Windows Server 2008 [SB] 3.x" buildbot
looks to be slow
2014-02-01 04:11:16 +01:00
Victor Stinner 8dffc456d7 Update asyncio from the Tulip project
Major changes:

- StreamReader.readexactly() now raises an IncompleteReadError if the
  end of stream is reached before we received enough bytes, instead of
  returning less bytes than requested.

- Unit tests use the main asyncio module instead of submodules like events

- _UnixWritePipeTransport now also supports character devices, as
  _UnixReadPipeTransport. Patch written by Jonathan Slenders.

- Export more symbols: BaseEventLoop, BaseProactorEventLoop,
  BaseSelectorEventLoop, Queue and Queue sublasses, Empty, Full
2014-01-25 15:32:06 +01:00
Victor Stinner 5e42354263 Fix ResourceWarning in test_asyncio.test_windows_events:
close the write end of the socket pair
2014-01-11 00:16:50 +01:00
Victor Stinner 24bd028092 Issue #19952: test_asyncio: relax timings of Windows events, buildbots are
sometimes busy
2013-12-13 02:45:18 +01:00
Victor Stinner e3010fd740 Relax timing on test_asyncio for busy (slow) Windows buildbots
http://buildbot.python.org/all/builders/AMD64%20Windows%20Server%202008%20%5BSB%5D%203.x/builds/1649/steps/test/logs/stdio

======================================================================
FAIL: test_wait_for_handle (test.test_asyncio.test_windows_events.ProactorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\home\cpython\buildslave\x64\3.x.snakebite-win2k8r2sp1-amd64\build\lib\test\test_asyncio\test_windows_events.py", line 112, in test_wait_for_handle
    self.assertTrue(0.18 < elapsed < 0.22, elapsed)
AssertionError: False is not true : 0.25
2013-11-18 11:05:22 +01:00
Guido van Rossum a8d630a6e6 asyncio: Various style nits. 2013-11-01 14:20:55 -07:00
Guido van Rossum 90fb914b4b asyncio: Make the IOCP proactor support "waitable" handles (Richard Oudkerk). 2013-10-30 14:44:05 -07:00
Antoine Pitrou cb1fe98f76 Make various asyncio test files individually runnable 2013-10-20 21:02:53 +02:00
Guido van Rossum 27b7c7ebf1 Initial checkin of asyncio package (== Tulip, == PEP 3156). 2013-10-17 13:40:50 -07:00