summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/base_events.py
Commit message (Collapse)AuthorAgeFilesLines
* Issue #27392: Add loop.connect_accepted_socket().Yury Selivanov2016-07-121-4/+24
| | | | Patch by Jim Fulton.
* Issue #27136: Fix DNS static resolution; don't use it in getaddrinfoYury Selivanov2016-06-081-69/+47
| | | | Patch by A. Jesse Jiryu Davis
* asyncio: Fix getaddrinfo to accept service names (for port)Yury Selivanov2016-06-021-3/+19
| | | | Patch by A. Jesse Jiryu Davis
* asyncio: Support host=b'' for getaddrinfoYury Selivanov2016-06-021-1/+1
|
* asyncio: Fix BytesWarning (use typed=True in lru_cache for _ipaddr_info)Yury Selivanov2016-05-211-1/+1
|
* asyncio: Fix getaddrinfo to accept None/str/bytes for 'port' argYury Selivanov2016-05-201-0/+5
| | | | Patch by A. Jesse Jiryu Davis.
* Issue #27041: asyncio: Add loop.create_future methodYury Selivanov2016-05-161-7/+11
|
* Issue #27040: Add loop.get_exception_handler methodYury Selivanov2016-05-161-0/+5
|
* asyncio: Don't log ConnectionAbortedErrorVictor Stinner2016-04-011-0/+6
| | | | | Issue #26509: In fatal error handlers, don't log ConnectionAbortedError which occur on Windows.
* asyncio: Remove duplicate bind addresses in create_server.Yury Selivanov2016-03-021-2/+5
| | | | Patch by Sebastien Bourdeauducq (issue #26338)
* asyncio: Skip getaddrinfo if host is already resolved.Yury Selivanov2015-12-171-39/+80
| | | | | | | | | | | | | getaddrinfo takes an exclusive lock on some platforms, causing clients to queue up waiting for the lock if many names are being resolved concurrently. Users may want to handle name resolution in their own code, for the sake of caching, using an alternate resolver, or to measure DNS duration separately from connection duration. Skip getaddrinfo if the "host" passed into create_connection is already resolved. See https://github.com/python/asyncio/pull/302 for details. Patch by A. Jesse Jiryu Davis.
* Issue #25593: Change semantics of EventLoop.stop().Guido van Rossum2015-11-191-16/+9
|
* Issue #23972: updates to asyncio datagram API. By Chris Laws.Guido van Rossum2015-10-051-66/+108
|
* Issue #23630, asyncio: host parameter of loop.create_server() can now be aVictor Stinner2015-09-211-7/+28
| | | | sequence of strings. Patch written by Yann Sionneau.
* asyncio: Sync with upstream (compat module)Yury Selivanov2015-08-041-1/+2
|
* asyncio: Sync with mainstreamYury Selivanov2015-08-041-1/+1
|
* asyncio: Make sure sys.set_coroutine_wrapper is called *only* when loop is ↵Yury Selivanov2015-05-121-35/+45
| | | | | | | | | | | | running. Previous approach of installing coroutine wrapper in loop.set_debug() and uninstalling it in loop.close() was very fragile. Most of asyncio tests do not call loop.close() at all. Since coroutine wrapper is a global setting, we have to make sure that it's only set when the loop is running, and is automatically unset when it stops running. Issue #24017.
* asyncio: Support PEP 492. Issue #24017.Yury Selivanov2015-05-121-9/+38
|
* asyncio: async() function is deprecated in favour of ensure_future().Yury Selivanov2015-05-111-1/+1
|
* Sync asyncio changes from the main repo.Yury Selivanov2015-05-111-11/+33
|
* asyncio: BaseEventLoop: rename _owner to _thread_idVictor Stinner2015-02-051-6/+6
|
* asyncio: Only call _check_resolved_address() in debug modeVictor Stinner2015-02-041-16/+32
| | | | | | | | | | | | | | | | * _check_resolved_address() is implemented with getaddrinfo() which is slow * If available, use socket.inet_pton() instead of socket.getaddrinfo(), because it is much faster Microbenchmark (timeit) on Fedora 21 (Python 3.4, Linux 3.17, glibc 2.20) to validate the IPV4 address "127.0.0.1" or the IPv6 address "::1": * getaddrinfo() 10.4 usec per loop * inet_pton(): 0.285 usec per loop On glibc older than 2.14, getaddrinfo() always requests the list of all local IP addresses to the kernel (using a NETLINK socket). getaddrinfo() has other known issues, it's better to avoid it when it is possible.
* Issue #23243, asyncio: Emit a ResourceWarning when an event loop or a transportVictor Stinner2015-01-291-0/+11
| | | | is not explicitly closed. Close also explicitly transports in test_sslproto.
* asyncio: sync with TulipVictor Stinner2015-01-271-1/+2
| | | | | | | | | | * Remove unused SSLProtocol._closing attribute * test_sslproto: skip test if ssl module is missing * Python issue #23208: Don't use the traceback of the current handle if we already know the traceback of the source. The handle may be more revelant, but having 3 tracebacks (handle, source, exception) becomes more difficult to read. The handle may be preferred later but it requires more work to make this choice.
* Issue #23208, asyncio: Add BaseEventLoop._current_handleVictor Stinner2015-01-261-6/+19
| | | | | | | | | In debug mode, BaseEventLoop._run_once() now sets the BaseEventLoop._current_handle attribute to the handle currently executed. In release mode or when no handle is executed, the attribute is None. BaseEventLoop.default_exception_handler() displays the traceback of the current handle if available.
* asyncio: Close transports on errorVictor Stinner2015-01-261-3/+21
| | | | | Fix create_datagram_endpoint(), connect_read_pipe() and connect_write_pipe(): close the transport if the task is cancelled or on error.
* asyncio: BaseEventLoop._create_connection_transport() catchs any exception, notVictor Stinner2015-01-211-1/+1
| | | | only Exception
* asyncio: pyflakes, remove unused importVictor Stinner2015-01-211-1/+1
| | | | tests: Remove unused function; inline another function
* asyncio: sync with TulipVictor Stinner2015-01-141-1/+6
| | | | | | | | | | | | | | | | | | | | | | | * PipeHandle now uses None instead of -1 for a closed handle * Sort imports in windows_utils. * Fix test_events on Python older than 3.5. Skip SSL tests on the ProactorEventLoop if ssl.MemoryIO is missing * Fix BaseEventLoop._create_connection_transport(). Close the transport if the creation of the transport (if the waiter) gets an exception. * _ProactorBasePipeTransport now sets _sock to None when the transport is closed. * Fix BaseSubprocessTransport.close(). Ignore pipes for which the protocol is not set yet (still equal to None). * TestLoop.close() now calls the close() method of the parent class (BaseEventLoop). * Cleanup BaseSelectorEventLoop: create the protocol on a separated line for readability and ease debugging. * Fix BaseSubprocessTransport._kill_wait(). Set the _returncode attribute, so close() doesn't try to terminate the process. * Tests: explicitly close event loops and transports * UNIX pipe transports: add closed/closing in repr(). Add "closed" or "closing" state in the __repr__() method of _UnixReadPipeTransport and _UnixWritePipeTransport classes.
* asyncio: Truncate to 80 columnsVictor Stinner2015-01-081-2/+2
|
* asyncio: _make_ssl_transport: make the waiter parameter optionalVictor Stinner2015-01-081-1/+1
|
* Issue #23046: Expose the BaseEventLoop class in the asyncio namespaceVictor Stinner2015-01-061-1/+1
|
* Issue #22926: In debug mode, call_soon(), call_at() and call_later() methods ofVictor Stinner2014-12-261-18/+20
| | | | | | | | | | 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.
* Issue #23074: asyncio.get_event_loop() now raises an exception if the threadVictor Stinner2014-12-181-1/+1
| | | | has no event loop even if assertions are disabled.
* 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.
* Closes #22922: More EventLoop methods fail if the loop is closed. Initial patchVictor Stinner2014-12-041-0/+4
| | | | | | | 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: Coroutine objects are now rejected with a TypeError by the followingVictor Stinner2014-11-201-4/+7
| | | | | | | | | | | | | | 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).
* 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-251-7/+37
| | | | Patch by Joshua Moore-Oliva.
* asyncio: sync with TulipVictor Stinner2014-08-251-0/+7
| | | | | | | | | | | | | | | | | | | | | | | * 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.
* Issue #20055: Fix BaseEventLoop.stop() docstring, incomplete sentence.Victor Stinner2014-07-241-3/+3
| | | | Patch written by Saimadhav Heblikar.
* asyncio: sync with TulipVictor Stinner2014-07-141-39/+92
| | | | | | | | | | | | | | | | | | | | * Tulip issue #184: Log subprocess events in debug mode - Log stdin, stdout and stderr transports and protocols - Log process identifier (pid) - Log connection of pipes - Log process exit - Log Process.communicate() tasks: feed stdin, read stdout and stderr - Add __repr__() method to many classes related to subprocesses * Add BaseSubprocessTransport._pid attribute. Store the pid so it is still accessible after the process exited. It's more convinient for debug. * create_connection(): add the socket in the "connected to" debug log * Clean up some docstrings and comments. Remove unused unimplemented _read_from_self().
* asyncio: sync with TulipVictor Stinner2014-07-121-4/+52
| | | | | | | | | | | | | | | | | | | * Tulip issue #183: log socket events in debug mode - Log most important socket events: socket connected, new client, connection reset or closed by peer (EOF), etc. - Log time elapsed in DNS resolution (getaddrinfo) - Log pause/resume reading - Log time of SSL handshake - Log SSL handshake errors - Add a __repr__() method to many classes * Fix ProactorEventLoop() in debug mode. ProactorEventLoop._make_self_pipe() doesn't call call_soon() directly because it checks for the current loop which fails, because the method is called to build the event loop. * Cleanup _ProactorReadPipeTransport constructor. Not need to set again _read_fut attribute to None, it is already done in the base class.
* asyncio: improve the documentation of serversVictor Stinner2014-07-111-1/+3
| | | | | | - Fix the documentation of Server.close(): it closes sockets - Replace AbstractServer with Server - Document Server.sockets attribute
* asyncio, Tulip issue 180: Make Server attributes and methods privateVictor Stinner2014-07-111-20/+21
| | | | | | | - loop, waiters and active_count attributes are now private - attach(), detach() and wakeup() methods are now private The sockets attribute remains public.
* asyncio: sync with TulipVictor Stinner2014-07-111-7/+14
| | | | | | | | | | * Tulip issue #182: Improve logs of BaseEventLoop._run_once() - Don't log non-blocking poll - Only log polling with a timeout if it gets events or if it timed out after more than 1 second. * Fix some pyflakes warnings: remove unused imports
* asyncio: sync with TulipVictor Stinner2014-07-101-1/+4
| | | | | | | - repr(Task) and repr(CoroWrapper) now also includes where these objects were 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. - Fix create_task(): truncate the traceback to hide the call to create_task().
* asyncion, Tulip issue 181: BaseEventLoop.create_datagram_endpoint() now waitsVictor Stinner2014-07-081-2/+5
| | | | | until protocol.connection_made() has been called. Document also why transport constructors use a waiter.
* asyncio: sync with TulipVictor Stinner2014-07-081-0/+6
| | | | | | | | | | | - Tulip issue 185: Add a create_task() method to event loops. 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. - tests: fix a warning - fix typo in the name of a test function - Update AbstractEventLoop: add new event loop methods; update also the unit test