Commit Graph

38 Commits

Author SHA1 Message Date
Yury Selivanov 7ce1c6fb57 bpo-30508: Don't log exceptions if Task/Future "cancel()" method called (#2050) 2017-06-11 13:49:18 +00:00
INADA Naoki 3e2ad8ec61 bpo-29617: Remove Python 3.3 support from asyncio (GH-232) 2017-04-25 10:57:18 +09:00
Yury Selivanov a0c1ba608e Issue #28544: Implement asyncio.Task in C.
This implementation provides additional 10-20% speed boost for
asyncio programs.

The patch also fixes _asynciomodule.c to use Arguments Clinic, and
makes '_schedule_callbacks' an overridable method (as it was in 3.5).
2016-10-28 12:52:37 -04:00
Yury Selivanov 01c521ba7a asyncio: Increase asyncio.Future test coverage; test both implementations.
Also, add 'isfuture' to 'asyncio.futures.__all__', so that it's
exposed as 'asyncio.isfuture'.
2016-10-23 22:34:35 -04:00
INADA Naoki a83636247e Issue #28448: Fix C implemented asyncio.Future didn't work on Windows 2016-10-21 12:30:15 +09:00
INADA Naoki c411a7d821 Issue #28452: Remove _asyncio._init_module function 2016-10-18 11:48:14 +09:00
INADA Naoki 9f2ce25481 Issue #28428: Rename _futures module to _asyncio.
It will have more speedup functions or classes other than asyncio.Future.
2016-10-15 15:39:19 +09:00
INADA Naoki 9e4e38ecd2 Issue #26801: Added C implementation of asyncio.Future.
Original patch by Yury Selivanov.
2016-10-09 14:44:47 +09:00
Guido van Rossum 7b3b3dc85d Merge asyncio upstream. 2016-09-09 14:26:31 -07:00
Guido van Rossum 1140a03426 Rename Future._blocking to _asyncio_future_blocking.
This is now an official "protected" API that can be used to write
classes that are duck-type-compatible with Future without subclassing
it.  (For that purpose I also changed isinstance(result, Future) to
check for this attribute instead.)

Hopefully Amber Brown can use this to make Twisted.Deferred compatible
with asyncio.Future.

Tests and docs are TBD.
2016-09-09 12:54:54 -07:00
Yury Selivanov 7661db6228 Issue #27041: asyncio: Add loop.create_future method 2016-05-16 15:38:39 -04:00
Yury Selivanov 1bd030788d asyncio: Prevent StopIteration from being thrown into a Future
Patch by Chris Angelico (issue #26221)
2016-03-02 11:03:28 -05:00
Martin Panter c04fb56e36 Issue #26304: Change "allows to <verb>" to "allows <verb>ing" or similar
The original form is incorrect grammar and feels awkward, even though the
meaning is clear.
2016-02-10 05:44:01 +00:00
Yury Selivanov 5d7e3b6cd2 asyncio: Cleanup Future API
See https://github.com/python/asyncio/pull/292 for details.
2015-11-17 12:19:41 -05:00
Guido van Rossum 841d9ee41a Issue #25304: Add asyncio.run_coroutine_threadsafe(). By Vincent Michel. 2015-10-03 08:31:42 -07:00
Victor Stinner 71080fc351 asyncio: Add asyncio.compat module
Move compatibility helpers for the different Python versions to a new
asyncio.compat module.
2015-07-25 02:23:21 +02:00
Yury Selivanov 1af2bf75a2 asyncio: Support PEP 492. Issue #24017. 2015-05-11 22:27:25 -04:00
Guido van Rossum 0a9933ebf3 Asyncio issue 222 / PR 231 (Victor Stinner) -- fix @coroutine functions without __name__. 2015-05-02 18:38:24 -07:00
Victor Stinner 978a9afc6a Issue #23243, asyncio: Emit a ResourceWarning when an event loop or a transport
is not explicitly closed. Close also explicitly transports in test_sslproto.
2015-01-29 17:50:58 +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 70db9e428a asyncio: sync with Tulip
* Tulip issue 184: FlowControlMixin constructor now get the event loop if the
  loop parameter is not set. Add unit tests to ensure that constructor of
  StreamReader and StreamReaderProtocol classes get the event loop.
* Remove outdated TODO/XXX
2015-01-09 21:32:05 +01:00
Victor Stinner fe22e0985a asyncio: Initialize more Future and Task attributes in the class definition to
avoid attribute errors in destructors.
2014-12-04 23:00:13 +01:00
Serhiy Storchaka 56a6d855e2 Removed duplicated words in in comments and docs. 2014-12-01 18:28:43 +02:00
Victor Stinner 662fd5f68e asyncio: Fix formatting of the "Future exception was never retrieved" in
release mode
2014-11-20 14:16:31 +01:00
Victor Stinner 313a980904 asyncio: sync with Tulip
* _WaitHandleFuture.cancel() now notify IocpProactor through the overlapped
  object that the wait was cancelled.
* Optimize IocpProactor.wait_for_handle() gets the result if the wait is
  signaled immediatly.
* Enhance representation of Future and Future subclasses

  - Add "created at filename:lineno" in the representation
  - Add Future._repr_info() method which can be more easily overriden than
    Future.__repr__(). It should now be more easy to enhance Future
    representation without having to modify each subclass. For example,
    _OverlappedFuture and _WaitHandleFuture get the new "created at" information.
  - Use reprlib to format Future result, and function arguments when formatting a
    callback, to limit the length of the representation.

* Fix repr(_WaitHandleFuture)
* _WaitHandleFuture and _OverlappedFuture: hide frames of internal calls in the
  source traceback.
* Cleanup ProactorIocp._poll(): set the timeout to 0 after the first call to
  GetQueuedCompletionStatus()
* test_locks: close the temporary event loop and check the condition lock
* Remove workaround in test_futures, no more needed
2014-07-29 12:58:23 +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 80f53aa9a0 asyncio, Tulip issue 137: In debug mode, save traceback where Future, Task and
Handle objects are created. Pass the traceback to call_exception_handler() in
the 'source_traceback' key.

The traceback is truncated to hide internal calls in asyncio, show only the
traceback from user code.

Add tests for the new source_traceback, and a test for the 'Future/Task
exception was never retrieved' log.
2014-06-27 13:52:20 +02:00
Victor Stinner 975735f729 asyncio, Tulip issue 177: Rewite repr() of Future, Task, Handle and TimerHandle
- Uniformize repr() output to format "<Class ...>"
- On Python 3.5+, repr(Task) uses the qualified name instead of the short name
  of the coroutine
2014-06-25 21:41:58 +02:00
Victor Stinner a02f81ff17 asyncio: Log an error if a Task is destroyed while it is still pending 2014-06-24 22:37:53 +02:00
Victor Stinner b4c9388947 asyncio: remove unused imports and unused variables noticed by pyflakes 2014-02-20 10:37:27 +01:00
Yury Selivanov 569efa2e4b asyncio: New error handling API. Issue #20681. 2014-02-18 18:02:19 -05:00
Victor Stinner 9572898282 asyncio: Future.set_exception(exc) should instantiate exc if it is a class. 2014-01-30 16:01:54 -08:00
Victor Stinner e40c078627 Issue #19967: Defer the formating of the traceback in asyncio.Future destructor 2013-12-21 00:19:33 +01:00
Guido van Rossum 9ba75db3c5 asyncio: Clean up formatting. 2013-12-19 13:49:32 -08:00
Victor Stinner 4c3c699e62 Close #19967: Thanks to the PEP 442, asyncio.Future can use a destructor in
Python 3.4 to log "uncatched" exceptions, instead of the dedicated
_TracebackLogger class.
2013-12-19 22:42:40 +01:00
Guido van Rossum 7a465647e4 asyncio: Pass cancellation from wrapping Future to wrapped Future. By Saúl Ibarra Corretgé (mostly). 2013-11-22 11:47:22 -08: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