Commit Graph

40 Commits

Author SHA1 Message Date
Victor Stinner 1a870c9132 asyncio: sync with Tulip
- Tulip issue #181: Faster create_connection(). Call directly
  waiter.set_result() in the constructor of _ProactorBasePipeTransport and
  _SelectorSocketTransport, instead of using of delaying the call with
  call_soon().
- Cleanup iscoroutine()
2014-07-07 17:26:54 +02:00
Victor Stinner a9acbe82e7 Closes #21886, #21447: Fix a race condition in asyncio when setting the result
of a Future with call_soon(). Add an helper, a private method, to set the
result only if the future was not cancelled.
2014-07-05 15:29:41 +02:00
Victor Stinner f328c7dc69 asyncio, Tulip issue 171: BaseEventLoop.close() now raises an exception if the
event loop is running. You must first stop the event loop and then wait until
it stopped, before closing it.
2014-06-23 01:02:37 +02:00
Victor Stinner d143209d7f Tulip issue 83: document more asyncio functions in docstrings 2014-06-19 17:11:49 +02:00
Victor Stinner 54c4b8e5c1 Closes #21595: asyncio.BaseSelectorEventLoop._read_from_self() now reads all
available bytes from the "self pipe", not only a single byte. This change
reduces the risk of having the pipe full and so getting the innocuous
"BlockingIOError: [Errno 11] Resource temporarily unavailable" message.
2014-06-19 12:59:15 +02:00
Victor Stinner bb2fc5b2a5 Issue #21326: Add a new is_closed() method to asyncio.BaseEventLoop
Add BaseEventLoop._closed attribute and use it to check if the event loop was
closed or not, instead of checking different attributes in each subclass of
BaseEventLoop.

run_forever() and run_until_complete() methods now raise a RuntimeError('Event loop is
closed') exception if the event loop was closed.

BaseProactorEventLoop.close() now also cancels "accept futures".
2014-06-10 10:23:10 +02:00
Andrew Svetlov 3207a03035 Fix for raising exception not derived from BaseException in _SelectorSslTransport.resume_reading 2014-05-27 21:24:43 +03:00
Guido van Rossum 3d139d8ed6 asyncio: Fix the second half of issue #21447: race in _write_to_self(). 2014-05-06 14:42:40 -07:00
Victor Stinner eeeebcd816 asyncio: Synchronize with Tulip
* Issue #159: Fix windows_utils.socketpair()

  - Use "127.0.0.1" (IPv4) or "::1" (IPv6) host instead of "localhost", because
    "localhost" may be a different IP address
  - Reject also invalid arguments: only AF_INET/AF_INET6 with SOCK_STREAM (and
    proto=0) are supported

* Reject add/remove reader/writer when event loop is closed.
* Fix ResourceWarning warnings
2014-03-06 00:52:53 +01:00
Victor Stinner c89c8a7be9 asyncio/windows_events.py: use more revelant names to overlapped callbacks
For example: "finish_recv", not just "finish".
2014-02-26 17:35:30 +01:00
Yury Selivanov b0b0e628ee asyncio: Fix spelling and typos.
Thanks to Vajrasky Kok for discovering some of them.
2014-02-18 22:27:48 -05:00
Victor Stinner 065ca25aae asyncio, Tulip issue 139: Improve error messages on "fatal errors"
Mention if the error was caused by a read or a write, and be more specific on
the object (ex: "pipe transport" instead of "transport").
2014-02-19 01:40:41 +01:00
Yury Selivanov c098241342 asyncio.transports: Make _ProactorBasePipeTransport use _FlowControlMixin 2014-02-18 18:41:13 -05:00
Yury Selivanov ff827f08ac asyncio: New error handling API. Issue #20681. 2014-02-18 18:02:19 -05:00
Victor Stinner 28773465e6 ayncio, Tulip issue 129: BaseEventLoop.sock_connect() now raises an error if
the address is not resolved (hostname instead of an IP address) for AF_INET and
AF_INET6 address families.
2014-02-13 09:24:37 +01:00
Victor Stinner dc62b7e261 asyncio: Tulip issue 112: Inline make_handle() into Handle constructor 2014-02-10 00:45:44 +01:00
Victor Stinner 85310a50a9 Issue #20505: Remove resolution and _granularity from selectors and asyncio
* Remove selectors.BaseSelector.resolution attribute
* Remove asyncio.BaseEventLoop._granularity attribute
2014-02-07 23:34:58 +01:00
Guido van Rossum 3ccead1f6a asyncio: Refactoring: move write flow control to a subclass/mixin. 2014-01-29 13:15:59 -08:00
Victor Stinner 669eeaf933 Merge latest Tulip into asyncio
- Make the new granularity attribute private
- Simplify BaseEventLoop._run_once(): avoid math.ceil(), use simple arithmetic
  instead
2014-01-26 00:02:31 +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 f67255ab94 Issue #20311: asyncio: Add a granularity attribute to BaseEventLoop: maximum
between the resolution of the BaseEventLoop.time() method and the resolution of
the selector. The granuarility is used in the scheduler to round time and
deadline.
2014-01-25 15:01:33 +01:00
Christian Heimes 6d8c1abb00 Issue #19509: Finish implementation of check_hostname
The new asyncio package now supports the new feature and comes with additional tests for SSL.
2013-12-06 00:23:13 +01:00
Guido van Rossum a5062c5d81 asyncio: Change write buffer use to avoid O(N**2). Make write()/sendto() accept bytearray/memoryview too. Change some asserts with proper exceptions. 2013-11-27 14:12:48 -08:00
Guido van Rossum 7fa6e1aeea Keep asyncio working with Python 3.3 too. 2013-11-23 15:36:43 -08:00
Christian Heimes 67986f9431 Issue #19735: Implement private function ssl._create_stdlib_context() to
create SSLContext objects in Python's stdlib module. It provides a single
configuration point and makes use of SSLContext.load_default_certs().
2013-11-23 22:43:47 +01:00
Guido van Rossum 2335de7a20 asyncio: Replace connection_refused() with error_received(). 2013-11-15 16:51:48 -08:00
Guido van Rossum 28dff0d823 asyncio: Better-looking errors when ssl module cannot be imported. In part by Arnaud Faure. 2013-11-01 14:22:30 -07:00
Guido van Rossum 3a703921a6 asyncio: Log a warning when eof_received() returns true and using ssl. 2013-11-01 14:19:35 -07:00
Guido van Rossum 2b57016458 asyncio: Refactor ssl transport ready loop (Nikolay Kim). 2013-11-01 14:18:02 -07:00
Guido van Rossum 21c85a7124 asyncio: Add server_hostname as create_connection() argument, with secure default. 2013-11-01 14:16:54 -07:00
Guido van Rossum 2b430b8720 asyncio: Fold some long lines. 2013-11-01 14:13:30 -07:00
Guido van Rossum 3317a13253 asyncio: Pause accepting whenever accept() returns certain errors. Fixes asyncio issue #78. 2013-11-01 14:12:50 -07:00
Guido van Rossum 1f683bbe71 asyncio: When not closing the connection after receiving EOF, still remove the read handler. 2013-10-30 14:36:58 -07:00
Antoine Pitrou 4ca7355901 Issue #19299: fix refleak test failures in test_asyncio 2013-10-20 00:54:10 +02:00
Guido van Rossum f19a6ef2c9 Verify hostname if verify_mode is CERT_OPTIONAL too. 2013-10-19 09:52:09 -07:00
Guido van Rossum 355491dc47 Write flow control for asyncio (includes asyncio.streams overhaul). 2013-10-18 15:17:11 -07:00
Guido van Rossum 2546a17765 Important race condition fix for Tulip. 2013-10-18 10:10:36 -07:00
Guido van Rossum 57497ad181 Rename Transport.pause/resume to pause_reading/pause_writing. Also relax timeout in test_call_later(). 2013-10-18 07:58:20 -07:00
Guido van Rossum fc29e0f37e Rename the logger to plain "logger". 2013-10-17 15:39:45 -07:00
Guido van Rossum 27b7c7ebf1 Initial checkin of asyncio package (== Tulip, == PEP 3156). 2013-10-17 13:40:50 -07:00