summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
Commit message (Collapse)AuthorAgeFilesLines
...
* asyncio: sync with TulipVictor Stinner2015-01-095-11/+10
| | | | | | | * 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
* asyncio: sync with TulipVictor Stinner2015-01-093-7/+16
| | | | | | | | * Document why set_result() calls are safe * Cleanup gather(). Use public methods instead of hacks to consume the exception of a future. * sock_connect(): pass directly the fd to _sock_connect_done instead of the socket.
* asyncio: Truncate to 80 columnsVictor Stinner2015-01-087-15/+23
|
* asyncio: _make_ssl_transport: make the waiter parameter optionalVictor Stinner2015-01-082-3/+3
|
* Issue #23140, asyncio: Fix cancellation of Process.wait(). Check the state ofVictor Stinner2015-01-061-1/+2
| | | | the waiter future before setting its result.
* Issue #23046: Expose the BaseEventLoop class in the asyncio namespaceVictor Stinner2015-01-062-2/+4
|
* Issue #22926: In debug mode, call_soon(), call_at() and call_later() methods ofVictor Stinner2014-12-263-23/+23
| | | | | | | | | | asyncio.BaseEventLoop now use the identifier of the current thread to ensure that they are called from the thread running the event loop. Before, the get_event_loop() method was used to check the thread, and no exception was raised when the thread had no event loop. Now the methods always raise an exception in debug mode when called from the wrong thread. It should help to notice misusage of the API.
* asyncio doc: update also Queue docstringsVictor Stinner2014-12-221-3/+7
|
* asyncio: IocpProactor.wait_for_handle() test now also checks the result of theVictor Stinner2014-12-191-0/+5
| | | | future
* asyncio: sync with TulipVictor Stinner2014-12-183-2/+9
| | | | | | | | | | | | | | | | * 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
* Issue #23074: asyncio.get_event_loop() now raises an exception if the threadVictor Stinner2014-12-182-4/+4
| | | | has no event loop even if assertions are disabled.
* asyncio, tulip issue 209: Fix subprocess for close_fds=False on Python 3.3Victor Stinner2014-12-111-0/+22
| | | | Mark the write end of the stdin pipe as non-inheritable.
* asyncio, tulip issue 202: Add unit test of pause/resume writing for proactorVictor Stinner2014-12-111-4/+0
| | | | socket transport
* Closes #22429, asyncio: Fix EventLoop.run_until_complete(), don't stop theVictor Stinner2014-12-051-2/+12
| | | | | event loop if a BaseException is raised, because the event loop is already stopped.
* Issue #22922: Fix ProactorEventLoop.close()Victor Stinner2014-12-051-1/+3
| | | | | Call _stop_accept_futures() before sestting the _closed attribute, otherwise call_soon() raises an error.
* Closes #22922: More EventLoop methods fail if the loop is closed. Initial patchVictor Stinner2014-12-042-0/+5
| | | | | | | written by Torsten Landschoff. create_task(), call_at(), call_soon(), call_soon_threadsafe() and run_in_executor() now raise an error if the event loop is closed.
* asyncio: Initialize more Future and Task attributes in the class definition toVictor Stinner2014-12-042-5/+5
| | | | avoid attribute errors in destructors.
* Closes #22475: asyncio doc, fix Task.get_stack() docVictor Stinner2014-12-021-1/+1
|
* Removed duplicated words in in comments and docs.Serhiy Storchaka2014-12-011-1/+1
|
* Closes #22685, asyncio: Set the transport of stdout and stderr StreamReaderVictor Stinner2014-11-251-5/+12
| | | | | objects in the SubprocessStreamProtocol. It allows to pause the transport to not buffer too much stdout or stderr data.
* don't require OpenSSL SNI to pass hostname to ssl functions (#22921)Benjamin Peterson2014-11-231-1/+1
| | | | Patch by Donald Stufft.
* asyncio: BaseSelectorEventLoop.close() now closes the self-pipe before callingVictor Stinner2014-11-201-1/+3
| | | | | the parent close() method. If the event loop is already closed, the self-pipe is not unregistered from the selector.
* asyncio: Coroutine objects are now rejected with a TypeError by the followingVictor Stinner2014-11-202-6/+10
| | | | | | | | | | | | | | functions: * add_signal_handler() * call_at() * call_later() * call_soon() * call_soon_threadsafe() * run_in_executor() Fix also the error message of add_signal_handler() (fix the name of the function).
* asyncio: Fix formatting of the "Future exception was never retrieved" inVictor Stinner2014-11-201-3/+4
| | | | release mode
* - Issue #22841: Reject coroutines in asyncio add_signal_handler().Guido van Rossum2014-11-141-0/+3
| | | | Patch by Ludovic.Gasc.
* asyncio: Move loop attribute to _FlowControlMixinVictor Stinner2014-11-054-7/+6
| | | | | | | | | Move the _loop attribute from the constructor of _SelectorTransport, _ProactorBasePipeTransport and _UnixWritePipeTransport classes to the constructor of the _FlowControlMixin class. Add also an assertion to explicit that the parent class must ensure that the loop is defined (not None)
* Issue #22641: In asyncio, the default SSL context for client connections is ↵Antoine Pitrou2014-10-152-7/+19
| | | | now created using ssl.create_default_context(), for stronger security.
* Issue #18643: asyncio.windows_utils now reuse socket.socketpair() on Windows ifVictor Stinner2014-10-141-41/+43
| | | | | | | | | available Since Python 3.5, socket.socketpair() is now also available on Windows. Make csock blocking before calling the accept() method, and fix also a typo in an error message.
* asyncio: enhance protocol representationVictor Stinner2014-10-122-2/+13
| | | | Add "closed" or "closing" to repr() of selector and proactor transports
* Issue #22601: run_forever() now consumes BaseException of the temporary taskVictor Stinner2014-10-111-1/+9
| | | | | If the coroutine raised a BaseException, consume the exception to not log a warning. The caller doesn't have access to the local task.
* Issue #22448: asyncio, cleanup _run_once(), only iterate once to remove delayedVictor Stinner2014-09-301-4/+7
| | | | calls that were cancelled.
* asyncio: Improve canceled timer handles cleanup. Closes issue #22448.Yury Selivanov2014-09-252-16/+57
| | | | Patch by Joshua Moore-Oliva.
* asyncio.unix_events: Move import statement to match tulip codeYury Selivanov2014-09-251-1/+2
|
* Apply asyncio Task English fixes to docstrings as well.R David Murray2014-09-241-9/+10
| | | | Also fixed the phrasing in a comment.
* asyncio, Tulip issue 206: In debug mode, keep the callback in theVictor Stinner2014-09-171-13/+19
| | | | representation of Handle and TimerHandle after cancel().
* Issue #22369: Change "context manager protocol" to "context management ↵Serhiy Storchaka2014-09-101-2/+2
| | | | protocol".
* asyncio, Tulip issue 205: Fix a race condition in ↵Victor Stinner2014-08-311-13/+31
| | | | | | | | | | | | | | | | | | | | | | BaseSelectorEventLoop.sock_connect() There is a race condition in create_connection() used with wait_for() to have a timeout. sock_connect() registers the file descriptor of the socket to be notified of write event (if connect() raises BlockingIOError). When create_connection() is cancelled with a TimeoutError, sock_connect() coroutine gets the exception, but it doesn't unregister the file descriptor for write event. create_connection() gets the TimeoutError and closes the socket. If you call again create_connection(), the new socket will likely gets the same file descriptor, which is still registered in the selector. When sock_connect() calls add_writer(), it tries to modify the entry instead of creating a new one. This issue was originally reported in the Trollius project, but the bug comes from Tulip in fact (Trollius is based on Tulip): https://bitbucket.org/enovance/trollius/issue/15/after-timeouterror-on-wait_for This change fixes the race condition. It also makes sock_connect() more reliable (and portable) is sock.connect() raises an InterruptedError.
* asyncio, 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.
* asyncio, tulip issue 203: Add _FlowControlMixin.get_write_buffer_limits() methodVictor Stinner2014-08-251-0/+3
|
* asyncio: sync with TulipVictor Stinner2014-08-256-35/+78
| | | | | | | | | | | | | | | | | | | | | | | * PipeServer.close() now cancels the "accept pipe" future which cancels the overlapped operation. * Fix _SelectorTransport.__repr__() if the transport was closed * Fix debug log in BaseEventLoop.create_connection(): get the socket object from the transport because SSL transport closes the old socket and creates a new SSL socket object. Remove also the _SelectorSslTransport._rawsock attribute: it contained the closed socket (not very useful) and it was not used. * Issue #22063: socket operations (sock_recv, sock_sendall, sock_connect, sock_accept) of the proactor event loop don't raise an exception in debug mode if the socket are in blocking mode. Overlapped operations also work on blocking sockets. * Fix unit tests in debug mode: mock a non-blocking socket for socket operations which now raise an exception if the socket is blocking. * _fatal_error() method of _UnixReadPipeTransport and _UnixWritePipeTransport now log all exceptions in debug mode * Don't log expected errors in unit tests * Tulip issue 200: _WaitHandleFuture._unregister_wait() now catchs and logs exceptions. * Tulip issue 200: Log errors in debug mode instead of simply ignoring them.
* Close #22063: socket operations (socket,recv, sock_sendall, sock_connect,Victor Stinner2014-07-292-0/+16
| | | | | sock_accept) now raise an exception in debug mode if sockets are in blocking mode.
* asyncio: Use the new os.set_blocking() function of Python 3.5 if availableVictor Stinner2014-07-291-4/+8
|
* asyncio: sync with TulipVictor Stinner2014-07-294-64/+88
| | | | | | | | | | | | | | | | | | | | | | | | * _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
* asyncio, tulip issue 196: ProactorIocp._register() now registers the overlappedVictor Stinner2014-07-271-15/+38
| | | | | | | | | | | | | | | | in the _cache dictionary, even if we already got the result. We need to keep a reference to the overlapped object, otherwise the memory may be reused and GetQueuedCompletionStatus() may use random bytes and behaves badly. There is still a hack for ConnectNamedPipe(): the overlapped object is not register into _cache if the overlapped object completed directly. Log also an error in debug mode in ProactorIocp._loop() if we get an unexpected event. Add a protection in ProactorIocp.close() to avoid blocking, even if it should not happen. I still don't understand exactly why some the completion of some overlapped objects are not notified.
* Accept optional lock object in Condition ctor (tulip issue #198)Andrew Svetlov2014-07-261-3/+6
|
* Tulip issue 196: _OverlappedFuture.set_result() now clears its reference to theVictor Stinner2014-07-251-5/+11
| | | | | overlapped object. IocpProactor._poll() now also ignores false alarms: GetQueuedCompletionStatus() returns the overlapped but it is still pending.
* asyncio: sync with TulipVictor Stinner2014-07-252-1/+9
| | | | | | | | * Tulip issue #196: IocpProactor._poll() clears the reference to the overlapped operation when the operation is done. It would be better to clear the reference in a new _OverlappedFuture.set_result() method, but it cannot be done yet because of a weird bug. * BaseSelectorEventLoop._write_to_self() now logs errors in debug mode.
* asyncio: sync with TulipVictor Stinner2014-07-252-27/+52
| | | | | | | | | | | | * Fix _WaitHandleFuture.cancel(): return the result of the parent cancel() method. * _OverlappedFuture.cancel() now clears its reference to the overlapped object. Make also the _OverlappedFuture.ov attribute private. * Check if _WaitHandleFuture completed before unregistering it in the callback. Add also _WaitHandleFuture._poll() and repr(_WaitHandleFuture). * _WaitHandleFuture now unregisters its wait handler if WaitForSingleObject() raises an exception. * _OverlappedFuture.set_exception() now cancels the overlapped operation.
* asyncio: sync with TulipVictor Stinner2014-07-241-20/+46
| | | | | | | | | | | | | | | | | | | | | | 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).
* Issue #20055: Fix BaseEventLoop.stop() docstring, incomplete sentence.Victor Stinner2014-07-241-3/+3
| | | | Patch written by Saimadhav Heblikar.