summaryrefslogtreecommitdiff
path: root/asyncio/tasks.py
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup gather(): use cancelled() method instead of using private FutureVictor Stinner2015-01-291-1/+1
| | | | attribute
* Python issue #23219: cancelling wait_for() now cancels the taskVictor Stinner2015-01-151-4/+8
|
* Cleanup gather()Victor Stinner2015-01-091-4/+7
| | | | Use public methods instead of hacks to consume the exception of a future.
* Truncate to 80 columnsVictor Stinner2015-01-091-1/+1
|
* Python issue #22475: fix Task.get_stack() docVictor Stinner2014-12-041-1/+1
|
* Initialize more Future and Task attributes in the class definition to avoidVictor Stinner2014-12-041-3/+4
| | | | attribute errors in destructors.
* tasks.py: Sync comments updates from cpython treeYury Selivanov2014-09-241-9/+10
|
* Tulip issue #201: Fix a race condition in wait_for()Victor Stinner2014-08-281-6/+9
| | | | | | Don't raise a TimeoutError if we reached the timeout and the future completed in the same iteration of the event loop. A side effect of the bug is that Queue.get() looses items.
* Enhance representation of Future and Future subclassesVictor Stinner2014-07-291-19/+8
| | | | | | | | | | * 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.
* Python issue 21163: Fix "destroy pending task" warning in test_wait_errors()Victor Stinner2014-07-161-2/+2
|
* Python issue 21163: Ignore "destroy pending task" warnings for private tasks inVictor Stinner2014-07-161-11/+23
| | | | asyncio.gather().
* Fix some pyflakes warnings: remove unused importsVictor Stinner2014-07-111-1/+0
|
* Improve CoroWrapper: copy also the qualified name on Python 3.4, not only onVictor Stinner2014-07-111-1/+0
| | | | Python 3.5+
* repr(Task) and repr(CoroWrapper) now also includes where these objects wereVictor Stinner2014-07-101-1/+6
| | | | | | | created. If the coroutine is not a generator (don't use "yield from"), use the location of the function, not the location of the coro() wrapper.
* Tulip issue #185: Add a create_task() method to event loopsVictor Stinner2014-07-081-1/+3
| | | | | | | | | The create_task() method can be overriden in custom event loop to implement their own task class. For example, greenio and Pulsar projects use their own task class. The create_task() method is now preferred over creating directly task using the Task class.
* Python issue 21447, 21886: Fix a race condition when setting the result of aVictor Stinner2014-07-051-1/+2
| | | | | Future with call_soon(). Add an helper, an private method, to set the result only if the future was not cancelled.
* Backed out changeset b288da71fb40Victor Stinner2014-07-031-4/+1
| | | | Oops, I wanted to send this patch for review before
* Add asyncio.tasks.task_factory variableVictor Stinner2014-07-031-1/+4
| | | | | | | In the greenio project, Task._step() should not create Task objects but GreenTask to control how tasks are executed. Luca Sbardella already asked this feature for its Pulsar project to support coroutines using yield instead of yield-from.
* repr(Task): include also the future the task is waiting forVictor Stinner2014-07-011-0/+3
|
* Python issue #21163: BaseEventLoop.run_until_complete() andVictor Stinner2014-06-301-1/+4
| | | | | test_utils.run_briefly() don't log the "destroy pending task" message anymore. The log is redundant for run_until_complete() and useless in run_briefly().
* Move coroutine code in the new module asyncio.coroutinesVictor Stinner2014-06-291-135/+8
|
* Tulip issue #137: In debug mode, save traceback where Future, Task and HandleVictor Stinner2014-06-271-3/+11
| | | | | | | | | | | 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.
* Tulip issue #137: In debug mode, add the traceback where the coroutine objectVictor Stinner2014-06-271-7/+10
| | | | was created to the "coroutine ... was never yield from" log
* Tulip issue #177: Rewite repr() of Future, Task, Handle and TimerHandleVictor Stinner2014-06-251-20/+31
| | | | | | - Uniformize repr() output to format "<Class ...>" - On Python 3.5+, repr(Task) uses the qualified name instead of the short name of the coroutine
* repr(Task) now also contains the line number even if the coroutine is done: useVictor Stinner2014-06-241-2/+4
| | | | | | | | the first line number of the code object instead of the current line number of the generator frame. The name of the coroutine is not enough because many coroutines may have the same name. It's a common case in asyncio tests for example.
* Log an error if a Task is destroyed while it is still pending, but only onVictor Stinner2014-06-241-0/+13
| | | | Python 3.4 and newer.
* Set __qualname__ attribute of CoroWrapper in @coroutine decoratorVictor Stinner2014-06-181-4/+6
| | | | | | | | | - Drop __slots__ optimization of CoroWrapper to be able to set the __qualname__ attribute. - Add tests on __name__, __qualname__ and __module__ of a coroutine function and coroutine object. - Fix test_tasks when run in debug mode (PYTHONASYNCIODEBUG env var set) on Python 3.3 or 3.4
* Task.__repr__() now also handles CoroWrapperVictor Stinner2014-06-171-1/+1
|
* Issue #173: Enhance repr(Handle) and repr(Task)Victor Stinner2014-06-121-1/+9
| | | | | | | | | | repr(Handle) is shorter for function: "foo" instead of "<function foo at 0x...>". It now also includes the source of the callback, filename and line number where it was defined, if available. repr(Task) now also includes the current position in the code, filename and line number, if available. If the coroutine (generator) is done, the line number is omitted and "done" is added.
* wait(): mention that the future sequence must not be emptyVictor Stinner2014-06-101-0/+2
|
* Rephrase Task.cancel docstringVictor Stinner2014-06-021-1/+1
|
* Fix docstring typo: CancellationError should be CancelledError.Guido van Rossum2014-05-281-1/+1
|
* Add __weakref__ slots to Handle and CoroWrapper. Fixes issue #166.Guido van Rossum2014-04-271-1/+1
|
* Be careful accessing instance variables in __del__ (CPython issue 21340).Guido van Rossum2014-04-271-1/+3
|
* Add gi_{frame,running,code} properties to CoroWrapper. Fixes issue #163.Guido van Rossum2014-04-151-0/+12
|
* tasks: Make sure CoroWrapper.send proxies one argument correctlyYury Selivanov2014-04-151-0/+2
|
* tasks: Fix CoroWrapper to workaround yield-from bug in CPythonYury Selivanov2014-04-141-1/+4
|
* Fix bad grammar.Guido van Rossum2014-03-311-2/+2
|
* Document Task.cancel() properly.Guido van Rossum2014-03-311-0/+19
|
* Issue #158: Task._step() now also sets self to None if an exception is raised.Victor Stinner2014-03-041-1/+1
| | | | self is set to None to break a reference cycle.
* asyncio: remove unused imports and unused variables noticed by pyflakesVictor Stinner2014-02-201-2/+0
|
* Issue #136: Add get/set_debug() methods to BaseEventLoopTests. Add also aVictor Stinner2014-02-191-1/+4
| | | | | PYTHONASYNCIODEBUG environment variable to debug coroutines since Python startup, to be able to debug coroutines defined directly in the asyncio module.
* Fix spelling & typosYury Selivanov2014-02-181-1/+1
|
* Change as_completed() to use a Queue, to avoid O(N**2) behavior. Fixes issue ↵Guido van Rossum2014-02-121-20/+33
| | | | #127.
* Issue #131: as_completed() and wait() now raises a TypeError if the list ofVictor Stinner2014-02-111-0/+4
| | | | futures is not a list but a Future, Task or coroutine object
* tasks: Fix as_completed, gather & wait to work with duplicate coroutines. ↵Yury Selivanov2014-02-061-3/+4
| | | | Issue #114
* tasks.gather: Fix docstringYury Selivanov2014-02-061-1/+1
|
* Move async() call back to its original position. Issue 117.Guido van Rossum2014-01-281-1/+1
|
* wait_for() now accepts None as timeoutVictor Stinner2014-01-281-1/+4
|
* wait_for() now cancels the future on timeout. Patch written by GustavoVictor Stinner2014-01-221-2/+4
| | | | Carneiro.