From c10e8bf2b712cea5b76f806a5076ac749ee92ab6 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sat, 2 Nov 2019 13:44:04 -0700 Subject: [PATCH 001/157] Bump version to v0.13.0+dev --- trio/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trio/_version.py b/trio/_version.py index 52bca16bec..56ce2746f8 100644 --- a/trio/_version.py +++ b/trio/_version.py @@ -1,3 +1,3 @@ # This file is imported from __init__.py and exec'd from setup.py -__version__ = "0.13.0" +__version__ = "0.13.0+dev" From 7486ebbada4e5a0cc14449282517f28597f7ec9f Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sat, 2 Nov 2019 23:33:25 -0700 Subject: [PATCH 002/157] Add tests for our event loop surviving an unexpected fd closure These tests currently cause both epoll and Windows backends to crash/deadlock. --- trio/_core/tests/test_io.py | 87 +++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 3 deletions(-) diff --git a/trio/_core/tests/test_io.py b/trio/_core/tests/test_io.py index 466558d8a7..91903a833b 100644 --- a/trio/_core/tests/test_io.py +++ b/trio/_core/tests/test_io.py @@ -4,6 +4,7 @@ import select import random import errno +from contextlib import suppress from ... import _core from ...testing import wait_all_tasks_blocked, Sequencer, assert_checkpoints @@ -300,10 +301,8 @@ async def test_wait_on_invalid_object(): fileno = s.fileno() # We just closed the socket and don't do anything else in between, so # we can be confident that the fileno hasn't be reassigned. - with pytest.raises(OSError) as excinfo: + with pytest.raises(OSError): await wait(fileno) - exc = excinfo.value - assert exc.errno == errno.EBADF or exc.winerror == errno.ENOTSOCK async def test_io_manager_statistics(): @@ -352,3 +351,85 @@ def check(*, expected_readers, expected_writers): # 1 for call_soon_task check(expected_readers=1, expected_writers=0) + + +async def test_can_survive_unnotified_close(): + # This should never happen -- users should call notify_closing when they + # close things. But, just in case they don't, we would still like to avoid + # exploding. Acceptable behaviors: + # - wait_* never return, but can be cancelled cleanly + # - wait_* exit cleanly + # - wait_* raise an OSError + # + # Not acceptable: + # - getting stuck in an uncancellable state + # - TrioInternalError blowing up the whole run + + async def allow_OSError(async_func, *args): + with suppress(OSError): + await async_func(*args) + + with stdlib_socket.socket() as s: + async with trio.open_nursery() as nursery: + nursery.start_soon(allow_OSError, trio.hazmat.wait_readable, s) + await wait_all_tasks_blocked() + s.close() + await wait_all_tasks_blocked() + nursery.cancel_scope.cancel() + + # We hit different paths on Windows depending on whether we close the last + # handle to the object (which produces a LOCAL_CLOSE notification and + # wakes up wait_readable), or only close one of the handles (which leaves + # wait_readable pending until cancelled). + with stdlib_socket.socket() as s, s.dup() as s2: + async with trio.open_nursery() as nursery: + nursery.start_soon(allow_OSError, trio.hazmat.wait_readable, s) + await wait_all_tasks_blocked() + s.close() + await wait_all_tasks_blocked() + nursery.cancel_scope.cancel() + + # A more elaborate case, with two tasks waiting. On windows and epoll, + # the two tasks get muxed together onto a single underlying wait + # operation. So when they're cancelled, there's a brief moment where one + # of the tasks is cancelled but the other isn't, so we try to re-issue the + # underlying wait operation. But here, the handle we were going to use to + # do that has been pulled out from under our feet... so test that we can + # survive this. + a, b = stdlib_socket.socketpair() + with a, b, a.dup() as a2: + a.setblocking(False) + b.setblocking(False) + fill_socket(a) + async with trio.open_nursery() as nursery: + nursery.start_soon(allow_OSError, trio.hazmat.wait_readable, a) + nursery.start_soon(allow_OSError, trio.hazmat.wait_writable, a) + await wait_all_tasks_blocked() + a.close() + nursery.cancel_scope.cancel() + + # A similar case, but now the single-task-wakeup happens due to I/O + # arriving, not a cancellation, so the operation gets re-issued from + # handle_io context rather than abort context. + a, b = stdlib_socket.socketpair() + with a, b, a.dup() as a2: + print(f"a={a.fileno()}, b={b.fileno()}, a2={a2.fileno()}") + a.setblocking(False) + b.setblocking(False) + fill_socket(a) + e = trio.Event() + async def wait_readable_then_set(): + await trio.hazmat.wait_readable(a) + e.set() + + async with trio.open_nursery() as nursery: + nursery.start_soon(allow_OSError, wait_readable_then_set) + nursery.start_soon(allow_OSError, trio.hazmat.wait_writable, a) + await wait_all_tasks_blocked() + a.close() + b.send(b"x") + # Make sure that the wakeup has been received and everything has + # settled before cancelling the wait_writable. + await e.wait() + await wait_all_tasks_blocked() + nursery.cancel_scope.cancel() From 2be42dc188c618b1b58482d518641e67d34ec106 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sat, 2 Nov 2019 23:34:19 -0700 Subject: [PATCH 003/157] Rework epoll backend to be more robust + maybe faster Switched to EPOLLONESHOT. Added a long comment explaining why. Epoll backend now passes the tests for unnotified-close, and also does one less syscall per call to wait_*. --- trio/_core/_io_epoll.py | 267 +++++++++++++++++++++++++++++++--------- 1 file changed, 209 insertions(+), 58 deletions(-) diff --git a/trio/_core/_io_epoll.py b/trio/_core/_io_epoll.py index 9fae320b23..9c068559e0 100644 --- a/trio/_core/_io_epoll.py +++ b/trio/_core/_io_epoll.py @@ -1,6 +1,8 @@ import select import attr import outcome +import copy +from collections import defaultdict from .. import _core from ._run import _public @@ -12,39 +14,185 @@ class _EpollStatistics: tasks_waiting_write = attr.ib() backend = attr.ib(default="epoll") +# Some facts about epoll +# ---------------------- +# +# Internally, an epoll object is sort of like a WeakKeyDictionary where the +# keys are tuples of (fd number, file object). When you call epoll_ctl, you +# pass in an fd; that gets converted to an (fd number, file object) tuple by +# looking up the fd in the process's fd table at the time of the call. When an +# event happens on the file object, epoll_wait drops the file object part, and +# just returns the fd number in its event. So from the outside it looks like +# it's keeping a table of fds, but really it's a bit more complicated. This +# has some subtle consequences. +# +# In general, file objects inside the kernel are reference counted. Each entry +# in a process's fd table holds a reference to the file objects, and most +# operations that use file objects take a temporary reference while they're +# working. So when you call close() on an fd, that might or might not cause +# the file object to be deallocated -- it depends on whether there are any +# other fds referring to that file object. Some common ways this can happen: +# +# - after calling dup(), you have two fds in the same process referring to the +# same file object. Even if you close one, the file object will be kept +# alive by the other. +# - when calling fork(), the child inherits a copy of the parent's fd table, +# so all the file objects get another reference. (But if the fork() is +# followed by exec(), then all of the child's fds that have the CLOEXEC flag +# set will be closed at that point.) +# - most syscalls that work on fds take a reference to the underlying file +# object while they're running. So e.g. if there's a thread blocked in +# read(fd), and then another thread calls close(fd), the underlying file +# object won't actually be closed until after read() returns. +# +# However, epoll does *not* take a reference to the file objects in its set +# (that's what makes it similar to a WeakKeyDictionary). File objects inside +# an epoll interest set will be deallocated if all *other* references to them +# are closed, and then the epoll object will automatically deregister that +# file object and stop reporting events on it. So that's quite handy. +# +# But, what happens if we do: +# +# fd1 = open(...) +# epoll_ctl(EPOLL_CTL_ADD, fd1, ...) +# fd2 = dup(fd1) +# close(fd1) +# +# ? In this case, the dup() keeps the underlying file object alive, so it +# remains registered in the epoll object's interest set, as the tuple (fd1, +# file object). But, fd1 no longer refers to this file object! You might think +# there was some magic to handle this, but unfortunately no; the consequences +# are totally predictable from what I said above: +# +# If any events occur on the file object, then epoll will report them as +# happening on fd1, even though that doesn't make sense. +# +# So perhaps we would like to deregister fd1 to stop getting events. But how? +# When we call epoll_ctl, we have to pass an fd number, which will get +# expanded to an (fd number, file object) tuple. We can't pass fd1, because +# when epoll_ctl tries to look it up, it won't find our file object. And we +# can't pass fd2, because that will get expanded to (fd2, file object), which +# is a different lookup key. In fact, in this case it is *impossible* to +# de-register this fd! +# +# It is even possible that fd1 will get assigned to another file object, and +# then we can have multiple keys registered simultaneously using the same fd +# number, like: (fd1, file object 1), (fd1, file object 2) +# epoll will happily report events on either file object as having happened on +# "fd1". +# +# And what makes this particularly nasty is that suppose the old file object +# becomes, say, readable. That means that every time we call epoll_wait, it +# will return immediately to tell us that "fd1" is readable. Normally, we +# would handle this by de-registering fd1, waking up wait_readable, then the +# user will call read() or recv() or something, etc., so it's fine. But if +# this happens on a stale fd where we can't remove the registration, then we +# might get stuck in a state where epoll_ctl *always* returns immediately, so +# our event loop becomes unable to sleep, and now our program is burning 100% +# of the CPU doing nothing. +# +# +# What does this mean for Trio? +# ----------------------------- +# +# Since we don't control the user's code, we have no way to guarantee that we +# don't get stuck in the pathological situation described above. For example, +# a user could call wait_readable(fd) in one task, and then while that's +# running, they might close(fd) from another task. In this situation, they're +# *supposed* to call notify_closing(fd) to let us know what's happening, so we +# can interrupt the wait_readable() call and avoid getting into this mess. And +# that's the only thing that can possibly work correctly in all cases. But +# sometimes code has bugs. So we would like to be able to at least survive +# this without corrupting Trio's internal state or otherwise causing the whole +# program to explode messily. +# +# Our solution: we always use EPOLLONESHOT when registering an fd with epoll. +# This way, we might get *one* spurious event on a stale fd, but then epoll +# will automatically quiet it until we explicitly say that we want more +# events... which on a stale fd we can't do, so that will never happen, and we +# avoid getting stuck in a busy-loop. And this might even cause some wait_* +# function to return before it should have... but in general, the wait_* +# functions are allowed to have some spurious wakeups; the user code will just +# attempt the operation, get EWOULDBLOCK, and call wait_* again. +# +# (We could also get a spurious BusyResourceError, but at least that doesn't +# corrupt the whole program.) +# +# As a bonus, EPOLLONESHOT also saves us having to explicitly deregister fds, +# so it's a bit more efficient in the normal case too. +# +# However, EPOLLONESHOT has a few trade-offs: +# +# First, you can't combine EPOLLONESHOT with EPOLLEXCLUSIVE. This is a bit sad +# in one somewhat rare case: if you have a multi-process server where a group +# of processes all share the same listening socket, then EPOLLEXCLUSIVE can be +# used to avoid "thundering herd" problems when a new connection comes in. But +# this isn't too bad. It's not clear if EPOLLEXCLUSIVE even works here anyway: +# +# https://stackoverflow.com/questions/41582560/how-does-epolls-epollexclusive-mode-interact-with-level-triggering +# +# And if we really need to support this, we could always add support through +# some specialized API in the future. +# +# Second, EPOLLONESHOT does not actually *deregister* the fd after delivering +# an event (EPOLL_CTL_DEL). Instead, it keeps the fd registered, but +# effectively does an EPOLL_CTL_MOD to set the fd's interest flags to +# all-zeros. +# +# So one possible problem would be that the epoll object will end up keeping +# the underlying file object alive. Fortunately, that doesn't happen, as +# described above – if we have a stale fd that's been silenced by +# EPOLLONESHOT, then I guess it wastes a bit of kernel memory remembering this +# fd that can never be revived, but when the underlying file object is +# eventually closed, that memory will be reclaimed. So that's OK. +# +# The other issue is that when someon calls wait_*, using EPOLLONESHOT means +# that if we have ever waited for this fd before, we have to use EPOLL_CTL_MOD +# to re-enable it; but if it's a new fd, we have to use EPOLL_CTL_ADD. How do +# we know which to use? There's no reasonable way to track which fds are +# currently registered -- remember, we're assuming the user might have gone +# and rearranged their fds without telling us! +# +# Fortunately, this also has a simple solution: usually, if we wait on a +# socket or other fd once, we will probably wait lots of times. And the epoll +# object itself knows which fds it already has registered. So when an fd comes +# in, we optimistically assume that it's been waited on before, and try doing +# EPOLL_CTL_MOD. If that failed with an ENOENT error, then we try again with +# EPOLL_CTL_ADD. +# +# So that's why this code is the way it is. And now you know more than you +# wanted to about how epoll works. + @attr.s(slots=True, eq=False) class EpollWaiters: read_task = attr.ib(default=None) write_task = attr.ib(default=None) + current_flags = attr.ib(default=0) - def flags(self): - flags = 0 - if self.read_task is not None: - flags |= select.EPOLLIN - if self.write_task is not None: - flags |= select.EPOLLOUT - if not flags: - return None - # XX not sure if EPOLLEXCLUSIVE is actually safe... I think - # probably we should use it here unconditionally, but: - # https://stackoverflow.com/questions/41582560/how-does-epolls-epollexclusive-mode-interact-with-level-triggering - - # flags |= select.EPOLLEXCLUSIVE - # We used to use ONESHOT here also, but it turns out that it's - # confusing/complicated: you can't use ONESHOT+EPOLLEXCLUSIVE - # together, you ONESHOT doesn't delete the registration but just - # "disables" it so you re-enable with CTL rather than ADD (or - # something?)... - # https://lkml.org/lkml/2016/2/4/541 - return flags + def wake_all(self, exc): + try: + current_task = _core.current_task() + except RuntimeError: + current_task = None + raise_at_end = False + for attr_name in ["read_task", "write_task"]: + task = getattr(self, attr_name) + if task is not None: + if task is current_task: + raise_at_end = True + else: + _core.reschedule(task, outcome.Error(copy.copy(exc))) + setattr(self, attr_name, None) + if raise_at_end: + raise exc @attr.s(slots=True, eq=False, hash=False) class EpollIOManager: _epoll = attr.ib(factory=select.epoll) # {fd: EpollWaiters} - _registered = attr.ib(factory=dict) + _registered = attr.ib(factory=lambda: defaultdict(EpollWaiters)) def statistics(self): tasks_waiting_read = 0 @@ -69,6 +217,8 @@ def handle_io(self, timeout): events = self._epoll.poll(timeout, max_events) for fd, flags in events: waiters = self._registered[fd] + # EPOLLONESHOT always clears the flags + waiters.current_flags = 0 # Clever hack stolen from selectors.EpollSelector: an event # with EPOLLHUP or EPOLLERR flags wakes both readers and # writers. @@ -78,40 +228,51 @@ def handle_io(self, timeout): if flags & ~select.EPOLLOUT and waiters.read_task is not None: _core.reschedule(waiters.read_task) waiters.read_task = None - self._update_registrations(fd, True) + self._update_registrations(fd) - def _update_registrations(self, fd, currently_registered): + def _update_registrations(self, fd): waiters = self._registered[fd] - flags = waiters.flags() - if flags is None: - assert currently_registered + wanted_flags = 0 + if waiters.read_task is not None: + wanted_flags |= select.EPOLLIN + if waiters.write_task is not None: + wanted_flags |= select.EPOLLOUT + if wanted_flags != waiters.current_flags: + try: + try: + # First try EPOLL_CTL_MOD + self._epoll.modify(fd, wanted_flags | select.EPOLLONESHOT) + except OSError: + # If that fails, it might be a new fd; try EPOLL_CTL_ADD + self._epoll.register(fd, wanted_flags | select.EPOLLONESHOT) + waiters.current_flags = wanted_flags + except OSError as exc: + # If everything fails, probably it's a bad fd, e.g. because + # the fd was closed behind our back. In this case we don't + # want to try to unregister the fd, because that will probably + # fail too. Just clear our state and wake everyone up. + del self._registered[fd] + # This could raise (in case we're calling this inside one of + # the to-be-woken tasks), so we have to do it last. + waiters.wake_all(exc) + return + if not wanted_flags: del self._registered[fd] - self._epoll.unregister(fd) - else: - if currently_registered: - self._epoll.modify(fd, flags) - else: - self._epoll.register(fd, flags) - - # Public (hazmat) API: async def _epoll_wait(self, fd, attr_name): if not isinstance(fd, int): fd = fd.fileno() - currently_registered = (fd in self._registered) - if not currently_registered: - self._registered[fd] = EpollWaiters() waiters = self._registered[fd] if getattr(waiters, attr_name) is not None: raise _core.BusyResourceError( "another task is already reading / writing this fd" ) setattr(waiters, attr_name, _core.current_task()) - self._update_registrations(fd, currently_registered) + self._update_registrations(fd) def abort(_): - setattr(self._registered[fd], attr_name, None) - self._update_registrations(fd, True) + setattr(waiters, attr_name, None) + self._update_registrations(fd) return _core.Abort.SUCCEEDED await _core.wait_task_rescheduled(abort) @@ -128,21 +289,11 @@ async def wait_writable(self, fd): def notify_closing(self, fd): if not isinstance(fd, int): fd = fd.fileno() - if fd not in self._registered: - return - - waiters = self._registered[fd] - - def interrupt(task): - exc = _core.ClosedResourceError("another task closed this fd") - _core.reschedule(task, outcome.Error(exc)) - - if waiters.write_task is not None: - interrupt(waiters.write_task) - waiters.write_task = None - - if waiters.read_task is not None: - interrupt(waiters.read_task) - waiters.read_task = None - - self._update_registrations(fd, True) + self._registered[fd].wake_all( + _core.ClosedResourceError("another task closed this fd") + ) + del self._registered[fd] + try: + self._epoll.unregister(fd) + except (OSError, ValueError): + pass From bcc0c47d82af5b40640ef5146306d9b1a0bcd611 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sat, 2 Nov 2019 23:58:03 -0700 Subject: [PATCH 004/157] Rework windows backend to survive unnotified close tests --- trio/_core/_io_windows.py | 66 +++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/trio/_core/_io_windows.py b/trio/_core/_io_windows.py index c4a5d176e4..45f8cafafb 100644 --- a/trio/_core/_io_windows.py +++ b/trio/_core/_io_windows.py @@ -2,6 +2,7 @@ from contextlib import contextmanager import enum import socket +import copy import outcome import attr @@ -264,13 +265,14 @@ def _afd_helper_handle(): ) -# Annoyingly, while the API makes it *seem* like you can happily issue -# as many independent AFD_POLL operations as you want without them interfering -# with each other, in fact if you issue two AFD_POLL operations for the same -# socket at the same time, then Windows gets super confused. For example, if -# we issue one operation from wait_readable, and another independent operation -# from wait_writable, then Windows may complete the wait_writable operation -# when the socket becomes readable. +# Annoyingly, while the API makes it *seem* like you can happily issue as many +# independent AFD_POLL operations as you want without them interfering with +# each other, in fact if you issue two AFD_POLL operations for the same socket +# at the same time with notification going to the same IOCP port, then Windows +# gets super confused. For example, if we issue one operation from +# wait_readable, and another independent operation from wait_writable, then +# Windows may complete the wait_writable operation when the socket becomes +# readable. # # To avoid this, we have to coalesce all the operations on a single socket # into one, and when the set of waiters changes we have to throw away the old @@ -281,6 +283,23 @@ class AFDWaiters: write_task = attr.ib(default=None) current_op = attr.ib(default=None) + def wake_all(self, exc): + try: + current_task = _core.current_task() + except RuntimeError: + current_task = None + raise_at_end = False + for attr_name in ["read_task", "write_task"]: + task = getattr(self, attr_name) + if task is not None: + if task is current_task: + raise_at_end = True + else: + _core.reschedule(task, outcome.Error(copy.copy(exc))) + setattr(self, attr_name, None) + if raise_at_end: + raise exc + # We also need to bundle up all the info for a single op into a standalone # object, because we need to keep all these objects alive until the operation @@ -511,8 +530,10 @@ def _refresh_afd(self, base_handle): ) ) except OSError as exc: - if exc.winerror != ErrorCodes.ERROR_NOT_FOUND: # pragma: no cover - raise + if exc.winerror != ErrorCodes.ERROR_NOT_FOUND: + # I don't think this is possible, so if it happens let's + # crash noisily. + raise # pragma: no cover waiters.current_op = None flags = 0 @@ -548,9 +569,15 @@ def _refresh_afd(self, base_handle): ) ) except OSError as exc: - if exc.winerror != ErrorCodes.ERROR_IO_PENDING: # pragma: no cover - raise - + if exc.winerror != ErrorCodes.ERROR_IO_PENDING: + # This could happen if the socket handle got closed behind + # our back while a wait_* call was pending, and we tried + # to re-issue the call. Clear our state and wake up any + # pending calls. + del self._afd_waiters[base_handle] + # Do this last, because it could raise. + waiters.wake_all(exc) + return op = AFDPollOp(lpOverlapped, poll_info, waiters) waiters.current_op = op self._afd_ops[lpOverlapped] = op @@ -564,6 +591,8 @@ async def _afd_poll(self, sock, mode): if getattr(waiters, mode) is not None: raise _core.BusyResourceError setattr(waiters, mode, _core.current_task()) + # Could potentially raise if the handle is somehow invalid; that's OK, + # we let it escape. self._refresh_afd(base_handle) def abort_fn(_): @@ -586,18 +615,7 @@ def notify_closing(self, handle): handle = _get_base_socket(handle) waiters = self._afd_waiters.get(handle) if waiters is not None: - if waiters.read_task is not None: - _core.reschedule( - waiters.read_task, - outcome.Error(_core.ClosedResourceError()) - ) - waiters.read_task = None - if waiters.write_task is not None: - _core.reschedule( - waiters.write_task, - outcome.Error(_core.ClosedResourceError()) - ) - waiters.write_task = None + waiters.wake_all(_core.ClosedResourceError()) self._refresh_afd(handle) ################################################################ From e7e20dd496af841dbbc055869a7cdadddb6317de Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 3 Nov 2019 00:06:32 -0700 Subject: [PATCH 005/157] Remove f-string for 3.5-compat --- trio/_core/tests/test_io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trio/_core/tests/test_io.py b/trio/_core/tests/test_io.py index 91903a833b..cceaf5348e 100644 --- a/trio/_core/tests/test_io.py +++ b/trio/_core/tests/test_io.py @@ -413,7 +413,7 @@ async def allow_OSError(async_func, *args): # handle_io context rather than abort context. a, b = stdlib_socket.socketpair() with a, b, a.dup() as a2: - print(f"a={a.fileno()}, b={b.fileno()}, a2={a2.fileno()}") + print("a={}, b={}, a2={}".format(a.fileno(), b.fileno(), a2.fileno())) a.setblocking(False) b.setblocking(False) fill_socket(a) From 21769e051c6c88679ef29aa9eddb08ac8d2b33f4 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 3 Nov 2019 00:07:07 -0700 Subject: [PATCH 006/157] yapf --- trio/_core/_io_epoll.py | 5 ++++- trio/_core/tests/test_io.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/trio/_core/_io_epoll.py b/trio/_core/_io_epoll.py index 9c068559e0..8988e60bc1 100644 --- a/trio/_core/_io_epoll.py +++ b/trio/_core/_io_epoll.py @@ -14,6 +14,7 @@ class _EpollStatistics: tasks_waiting_write = attr.ib() backend = attr.ib(default="epoll") + # Some facts about epoll # ---------------------- # @@ -244,7 +245,9 @@ def _update_registrations(self, fd): self._epoll.modify(fd, wanted_flags | select.EPOLLONESHOT) except OSError: # If that fails, it might be a new fd; try EPOLL_CTL_ADD - self._epoll.register(fd, wanted_flags | select.EPOLLONESHOT) + self._epoll.register( + fd, wanted_flags | select.EPOLLONESHOT + ) waiters.current_flags = wanted_flags except OSError as exc: # If everything fails, probably it's a bad fd, e.g. because diff --git a/trio/_core/tests/test_io.py b/trio/_core/tests/test_io.py index cceaf5348e..5e27f50033 100644 --- a/trio/_core/tests/test_io.py +++ b/trio/_core/tests/test_io.py @@ -418,6 +418,7 @@ async def allow_OSError(async_func, *args): b.setblocking(False) fill_socket(a) e = trio.Event() + async def wait_readable_then_set(): await trio.hazmat.wait_readable(a) e.set() From f5508e57bd039584d160bee85ea783c3ad5abf35 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 3 Nov 2019 00:11:24 -0700 Subject: [PATCH 007/157] Tell flake8 to stop complaining We know that these lines have variables that we don't otherwise use... they're holding OS resources open. --- trio/_core/tests/test_io.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trio/_core/tests/test_io.py b/trio/_core/tests/test_io.py index 5e27f50033..e4b0625846 100644 --- a/trio/_core/tests/test_io.py +++ b/trio/_core/tests/test_io.py @@ -381,7 +381,7 @@ async def allow_OSError(async_func, *args): # handle to the object (which produces a LOCAL_CLOSE notification and # wakes up wait_readable), or only close one of the handles (which leaves # wait_readable pending until cancelled). - with stdlib_socket.socket() as s, s.dup() as s2: + with stdlib_socket.socket() as s, s.dup() as s2: # noqa: F841 async with trio.open_nursery() as nursery: nursery.start_soon(allow_OSError, trio.hazmat.wait_readable, s) await wait_all_tasks_blocked() @@ -397,7 +397,7 @@ async def allow_OSError(async_func, *args): # do that has been pulled out from under our feet... so test that we can # survive this. a, b = stdlib_socket.socketpair() - with a, b, a.dup() as a2: + with a, b, a.dup() as a2: # noqa: F841 a.setblocking(False) b.setblocking(False) fill_socket(a) @@ -412,7 +412,7 @@ async def allow_OSError(async_func, *args): # arriving, not a cancellation, so the operation gets re-issued from # handle_io context rather than abort context. a, b = stdlib_socket.socketpair() - with a, b, a.dup() as a2: + with a, b, a.dup() as a2: # noqa: F841 print("a={}, b={}, a2={}".format(a.fileno(), b.fileno(), a2.fileno())) a.setblocking(False) b.setblocking(False) From 64aa779bb1dd407a0bdc075a6ff3144c38cc9c00 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 3 Nov 2019 00:37:12 -0700 Subject: [PATCH 008/157] Fix trivial typo in start_soon docstring. --- trio/_core/_run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trio/_core/_run.py b/trio/_core/_run.py index 905f477165..faf4c1371b 100644 --- a/trio/_core/_run.py +++ b/trio/_core/_run.py @@ -856,7 +856,7 @@ def aborted(raise_cancel): return MultiError(self._pending_excs) def start_soon(self, async_fn, *args, name=None): - """ Creates a child task, scheduling ``await async_fn(*args)``. + """Creates a child task, scheduling ``await async_fn(*args)``. This and :meth:`start` are the two fundamental methods for creating concurrent tasks in Trio. From affb6de754094f11401c257853a65e1c99ded16d Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 3 Nov 2019 00:37:23 -0700 Subject: [PATCH 009/157] Attempt to fix macOS/kqueue handling of unnotified close --- trio/_core/_io_kqueue.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/trio/_core/_io_kqueue.py b/trio/_core/_io_kqueue.py index 82d134712a..baf1427de6 100644 --- a/trio/_core/_io_kqueue.py +++ b/trio/_core/_io_kqueue.py @@ -120,7 +120,17 @@ async def _wait_common(self, fd, filter): def abort(_): event = select.kevent(fd, filter, select.KQ_EV_DELETE) - self._kqueue.control([event], 0) + try: + self._kqueue.control([event], 0) + except FileNotFoundError: + # kqueue tracks individual fds (*not* the underlying file + # object, see _io_epoll.py for a long discussion of why this + # matters), and automatically deregisters an event if the fd + # is closed. So if kqueue.control says that it doesn't know + # about this event, then probably it's because the fd was + # closed behind our backs. (Too bad it doesn't tell us that + # this happened... oh well, you can't have everything.) + pass return _core.Abort.SUCCEEDED await self.wait_kevent(fd, filter, abort) From 97e44711759ddea53f1bf681e4e335a913c33b95 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 3 Nov 2019 15:08:44 -0800 Subject: [PATCH 010/157] Fix bug in test_can_survive_unnotified_close, should work on macOS now --- trio/_core/tests/test_io.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/trio/_core/tests/test_io.py b/trio/_core/tests/test_io.py index e4b0625846..ba12b1a57d 100644 --- a/trio/_core/tests/test_io.py +++ b/trio/_core/tests/test_io.py @@ -419,13 +419,20 @@ async def allow_OSError(async_func, *args): fill_socket(a) e = trio.Event() - async def wait_readable_then_set(): - await trio.hazmat.wait_readable(a) + # We want to wait for the kernel to process the wakeup on 'a', if any. + # But depending on the platform, we might not get a wakeup on 'a'. So + # we put one task to sleep waiting on 'a', and we put a second task to + # sleep waiting on 'a2', with the idea that the 'a2' notification will + # definitely arrive, and when it does then we can assume that whatever + # notification was going to arrive for 'a' has also arrived. + async def wait_readable_a2_then_set(): + await trio.hazmat.wait_readable(a2) e.set() async with trio.open_nursery() as nursery: - nursery.start_soon(allow_OSError, wait_readable_then_set) + nursery.start_soon(allow_OSError, trio.hazmat.wait_readable, a) nursery.start_soon(allow_OSError, trio.hazmat.wait_writable, a) + nursery.start_soon(allow_OSError, wait_readable_a2_then_set) await wait_all_tasks_blocked() a.close() b.send(b"x") From ff750f246b89facfce65785ecd9d59ed8986d5e4 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 3 Nov 2019 15:19:42 -0800 Subject: [PATCH 011/157] Add newsfragment --- newsfragments/1272.feature.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 newsfragments/1272.feature.rst diff --git a/newsfragments/1272.feature.rst b/newsfragments/1272.feature.rst new file mode 100644 index 0000000000..89fce435a3 --- /dev/null +++ b/newsfragments/1272.feature.rst @@ -0,0 +1,16 @@ +If you're using Trio's low-level interfaces like +`trio.hazmat.wait_readable` or similar, and then you close a socket or +file descriptor, you're supposed to call `trio.hazmat.notify_closing` +first so Trio can clean up properly. But what if you forgot? In the +past, Trio would tend to either deadlock or explode spectacularly. +Now, it's much more robust to this situation, and should generally +survive. (But note that "survive" is not the same as "give you the +results you were expecting", so you should still call +`~trio.hazmat.notify_closing` when appropriate. This is about harm +reduction and making it easier to debug this kind of mistake, not +something you should rely on.) + +If you're using higher-level interfaces outside of the `trio.hazmat` +module, then you don't need to worry about any of this; those +intefaces already take care of calling `~trio.hazmat.notify_closing` +for you. From 1272dc29b4e2f11203c3e2cb27c74e6ac2935ddb Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 3 Nov 2019 17:55:54 -0800 Subject: [PATCH 012/157] [ci] Test Python 3.8 on Linux/Windows, and bump Python versions (#1288) * [ci] Test Python 3.8 on Linux/Windows, and bump Python versions We can't test macOS 3.8 until Azure deploys it: https://github.com/microsoft/azure-pipelines-image-generation/issues/1317 ...but we can get started on Linux and Windows already. * Add new socket constants for 3.8 * Fix name of travis nightly build --- .travis.yml | 6 ++++-- azure-pipelines.yml | 14 ++++++++++---- trio/socket.py | 3 ++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index e3fdb79e6c..55215fd2c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,9 @@ dist: xenial matrix: include: - - python: 3.6 + - python: 3.8 env: CHECK_DOCS=1 - - python: 3.6 + - python: 3.8 env: CHECK_FORMATTING=1 # The pypy tests are slow, so we list them first - python: pypy3 @@ -19,10 +19,12 @@ matrix: - python: 3.5 - python: 3.6 - python: 3.7 + - python: 3.8 - python: 3.5-dev - python: 3.6-dev - python: 3.7-dev - python: 3.8-dev + - python: nightly script: - ./ci.sh diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 228e8398e6..74ebedde10 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -50,11 +50,11 @@ jobs: # installer. So we put them at the top, so they can get started # earlier. "with IFS LSP, Python 3.7, 64 bit": - python.version: '3.7.2' + python.version: '3.7.5' python.pkg: 'python' lsp: 'http://www.proxifier.com/download/ProxifierSetup.exe' "with non-IFS LSP, Python 3.7, 64 bit": - python.version: '3.7.2' + python.version: '3.7.5' python.pkg: 'python' lsp: 'http://download.pctools.com/mirror/updates/9.0.0.2308-SDavfree-lite_en.exe' "Python 3.5, 32 bit": @@ -70,10 +70,16 @@ jobs: python.version: '3.6.8' python.pkg: 'python' "Python 3.7, 32 bit": - python.version: '3.7.2' + python.version: '3.7.5' python.pkg: 'pythonx86' "Python 3.7, 64 bit": - python.version: '3.7.2' + python.version: '3.7.5' + python.pkg: 'python' + "Python 3.8, 32 bit": + python.version: '3.8.0' + python.pkg: 'pythonx86' + "Python 3.8, 64 bit": + python.version: '3.8.0' python.pkg: 'python' steps: diff --git a/trio/socket.py b/trio/socket.py index 3464679394..bd6758af17 100644 --- a/trio/socket.py +++ b/trio/socket.py @@ -104,7 +104,8 @@ CAN_BCM_RX_CHECK_DLC, CAN_BCM_RX_FILTER_ID, CAN_BCM_RX_NO_AUTOTIMER, CAN_BCM_RX_RTR_FRAME, CAN_BCM_SETTIMER, CAN_BCM_STARTTIMER, CAN_BCM_TX_ANNOUNCE, CAN_BCM_TX_COUNTEVT, CAN_BCM_TX_CP_CAN_ID, - CAN_BCM_TX_RESET_MULTI_IDX + CAN_BCM_TX_RESET_MULTI_IDX, IPPROTO_CBT, IPPROTO_ICLFXBM, IPPROTO_IGP, + IPPROTO_L2TP, IPPROTO_PGM, IPPROTO_RDP, IPPROTO_ST ) except ImportError: pass From 0aa19ac05a6b77976cecddccc47bf55e2c0c76b1 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 3 Nov 2019 20:27:34 -0800 Subject: [PATCH 013/157] Do a pass to clean up some prose --- newsfragments/1272.feature.rst | 2 +- trio/_core/_io_epoll.py | 152 +++++++++++++++++---------------- trio/_core/_io_kqueue.py | 11 +-- 3 files changed, 87 insertions(+), 78 deletions(-) diff --git a/newsfragments/1272.feature.rst b/newsfragments/1272.feature.rst index 89fce435a3..3f540b93e5 100644 --- a/newsfragments/1272.feature.rst +++ b/newsfragments/1272.feature.rst @@ -1,7 +1,7 @@ If you're using Trio's low-level interfaces like `trio.hazmat.wait_readable` or similar, and then you close a socket or file descriptor, you're supposed to call `trio.hazmat.notify_closing` -first so Trio can clean up properly. But what if you forgot? In the +first so Trio can clean up properly. But what if you forget? In the past, Trio would tend to either deadlock or explode spectacularly. Now, it's much more robust to this situation, and should generally survive. (But note that "survive" is not the same as "give you the diff --git a/trio/_core/_io_epoll.py b/trio/_core/_io_epoll.py index 8988e60bc1..9241f34066 100644 --- a/trio/_core/_io_epoll.py +++ b/trio/_core/_io_epoll.py @@ -28,38 +28,41 @@ class _EpollStatistics: # has some subtle consequences. # # In general, file objects inside the kernel are reference counted. Each entry -# in a process's fd table holds a reference to the file objects, and most -# operations that use file objects take a temporary reference while they're -# working. So when you call close() on an fd, that might or might not cause -# the file object to be deallocated -- it depends on whether there are any -# other fds referring to that file object. Some common ways this can happen: +# in a process's fd table holds a strong reference to the corresponding file +# object, and most operations that use file objects take a temporary strong +# reference while they're working. So when you call close() on an fd, that +# might or might not cause the file object to be deallocated -- it depends on +# whether there are any other references to that file object. Some common ways +# this can happen: # # - after calling dup(), you have two fds in the same process referring to the -# same file object. Even if you close one, the file object will be kept -# alive by the other. +# same file object. Even if you close one fd (= remove that entry from the +# fd table), the file object will be kept alive by the other fd. # - when calling fork(), the child inherits a copy of the parent's fd table, # so all the file objects get another reference. (But if the fork() is # followed by exec(), then all of the child's fds that have the CLOEXEC flag # set will be closed at that point.) -# - most syscalls that work on fds take a reference to the underlying file -# object while they're running. So e.g. if there's a thread blocked in -# read(fd), and then another thread calls close(fd), the underlying file -# object won't actually be closed until after read() returns. +# - most syscalls that work on fds take a strong reference to the underlying +# file object while they're using it. So there's one thread blocked in +# read(fd), and then another thread calls close() on the last fd referring +# to that object, the underlying file won't actually be closed until +# after read() returns. # -# However, epoll does *not* take a reference to the file objects in its set -# (that's what makes it similar to a WeakKeyDictionary). File objects inside -# an epoll interest set will be deallocated if all *other* references to them -# are closed, and then the epoll object will automatically deregister that -# file object and stop reporting events on it. So that's quite handy. +# However, epoll does *not* take a reference to any of the file objects in its +# interest set (that's what makes it similar to a WeakKeyDictionary). File +# objects inside an epoll interest set will be deallocated if all *other* +# references to them are closed. And when that happens, the epoll object will +# automatically deregister that file object and stop reporting events on it. +# So that's quite handy. # -# But, what happens if we do: +# But, what happens if we do this? # # fd1 = open(...) # epoll_ctl(EPOLL_CTL_ADD, fd1, ...) # fd2 = dup(fd1) # close(fd1) # -# ? In this case, the dup() keeps the underlying file object alive, so it +# In this case, the dup() keeps the underlying file object alive, so it # remains registered in the epoll object's interest set, as the tuple (fd1, # file object). But, fd1 no longer refers to this file object! You might think # there was some magic to handle this, but unfortunately no; the consequences @@ -68,98 +71,103 @@ class _EpollStatistics: # If any events occur on the file object, then epoll will report them as # happening on fd1, even though that doesn't make sense. # -# So perhaps we would like to deregister fd1 to stop getting events. But how? -# When we call epoll_ctl, we have to pass an fd number, which will get -# expanded to an (fd number, file object) tuple. We can't pass fd1, because -# when epoll_ctl tries to look it up, it won't find our file object. And we -# can't pass fd2, because that will get expanded to (fd2, file object), which -# is a different lookup key. In fact, in this case it is *impossible* to -# de-register this fd! +# Perhaps we would like to deregister fd1 to stop getting nonsensical events. +# But how? When we call epoll_ctl, we have to pass an fd number, which will +# get expanded to an (fd number, file object) tuple. We can't pass fd1, +# because when epoll_ctl tries to look it up, it won't find our file object. +# And we can't pass fd2, because that will get expanded to (fd2, file object), +# which is a different lookup key. In fact, it's *impossible* to de-register +# this fd! # -# It is even possible that fd1 will get assigned to another file object, and -# then we can have multiple keys registered simultaneously using the same fd -# number, like: (fd1, file object 1), (fd1, file object 2) -# epoll will happily report events on either file object as having happened on +# We could even have fd1 get assigned to another file object, and then we can +# have multiple keys registered simultaneously using the same fd number, like: +# (fd1, file object 1), (fd1, file object 2). And if events happen on either +# file object, then epoll will happily report that something happened to # "fd1". # -# And what makes this particularly nasty is that suppose the old file object +# Now here's what makes this especially nasty: suppose the old file object # becomes, say, readable. That means that every time we call epoll_wait, it # will return immediately to tell us that "fd1" is readable. Normally, we -# would handle this by de-registering fd1, waking up wait_readable, then the -# user will call read() or recv() or something, etc., so it's fine. But if -# this happens on a stale fd where we can't remove the registration, then we -# might get stuck in a state where epoll_ctl *always* returns immediately, so -# our event loop becomes unable to sleep, and now our program is burning 100% -# of the CPU doing nothing. +# would handle this by de-registering fd1, waking up the corresponding call to +# wait_readable, then the user will call read() or recv() or something, and +# we're fine. But if this happens on a stale fd where we can't remove the +# registration, then we might get stuck in a state where epoll_wait *always* +# returns immediately, so our event loop becomes unable to sleep, and now our +# program is burning 100% of the CPU doing nothing, with no way out. # # # What does this mean for Trio? # ----------------------------- # # Since we don't control the user's code, we have no way to guarantee that we -# don't get stuck in the pathological situation described above. For example, -# a user could call wait_readable(fd) in one task, and then while that's +# don't get stuck with stale fd's in our epoll interest set. For example, a +# user could call wait_readable(fd) in one task, and then while that's # running, they might close(fd) from another task. In this situation, they're # *supposed* to call notify_closing(fd) to let us know what's happening, so we # can interrupt the wait_readable() call and avoid getting into this mess. And # that's the only thing that can possibly work correctly in all cases. But -# sometimes code has bugs. So we would like to be able to at least survive -# this without corrupting Trio's internal state or otherwise causing the whole -# program to explode messily. +# sometimes user code has bugs. So if this does happen, we'd like to degrade +# gracefully, and survive without corrupting Trio's internal state or +# otherwise causing the whole program to explode messily. # -# Our solution: we always use EPOLLONESHOT when registering an fd with epoll. -# This way, we might get *one* spurious event on a stale fd, but then epoll -# will automatically quiet it until we explicitly say that we want more -# events... which on a stale fd we can't do, so that will never happen, and we -# avoid getting stuck in a busy-loop. And this might even cause some wait_* -# function to return before it should have... but in general, the wait_* -# functions are allowed to have some spurious wakeups; the user code will just -# attempt the operation, get EWOULDBLOCK, and call wait_* again. +# Our solution: we always use EPOLLONESHOT. This way, we might get *one* +# spurious event on a stale fd, but then epoll will automatically silence it +# until we explicitly say that we want more events... and if we have a stale +# fd, then we actually can't re-enable it! So we can't get stuck in an +# infinite busy-loop. If there's a stale fd hanging around, then it might +# cause a spurious `BusyResourceError`, or cause one wait_* call to return +# before it should have... but in general, the wait_* functions are allowed to +# have some spurious wakeups; the user code will just attempt the operation, +# get EWOULDBLOCK, and call wait_* again. And the program as a whole will +# survive, any exceptions will propagate, etc. # -# (We could also get a spurious BusyResourceError, but at least that doesn't -# corrupt the whole program.) +# As a bonus, EPOLLONESHOT also saves us having to explicitly deregister fds +# on the normal wakeup path, so it's a bit more efficient in general. # -# As a bonus, EPOLLONESHOT also saves us having to explicitly deregister fds, -# so it's a bit more efficient in the normal case too. -# -# However, EPOLLONESHOT has a few trade-offs: +# However, EPOLLONESHOT has a few trade-offs to consider: # # First, you can't combine EPOLLONESHOT with EPOLLEXCLUSIVE. This is a bit sad # in one somewhat rare case: if you have a multi-process server where a group # of processes all share the same listening socket, then EPOLLEXCLUSIVE can be # used to avoid "thundering herd" problems when a new connection comes in. But -# this isn't too bad. It's not clear if EPOLLEXCLUSIVE even works here anyway: +# this isn't too bad. It's not clear if EPOLLEXCLUSIVE even works for us +# anyway: # # https://stackoverflow.com/questions/41582560/how-does-epolls-epollexclusive-mode-interact-with-level-triggering # -# And if we really need to support this, we could always add support through -# some specialized API in the future. +# And it's not clear that EPOLLEXCLUSIVE is a great approach either: +# +# https://blog.cloudflare.com/the-sad-state-of-linux-socket-balancing/ +# +# And if we do need to support this, we could always add support through some +# more-specialized API in the future. So this isn't a blocker to using +# EPOLLONESHOT. # # Second, EPOLLONESHOT does not actually *deregister* the fd after delivering # an event (EPOLL_CTL_DEL). Instead, it keeps the fd registered, but # effectively does an EPOLL_CTL_MOD to set the fd's interest flags to -# all-zeros. +# all-zeros. So we could still end up with an fd hanging around in the +# interest set for a long time, even if we're not using it. # -# So one possible problem would be that the epoll object will end up keeping -# the underlying file object alive. Fortunately, that doesn't happen, as -# described above – if we have a stale fd that's been silenced by -# EPOLLONESHOT, then I guess it wastes a bit of kernel memory remembering this -# fd that can never be revived, but when the underlying file object is -# eventually closed, that memory will be reclaimed. So that's OK. +# Fortunately, this isn't a problem, because it's only a weak reference – if +# we have a stale fd that's been silenced by EPOLLONESHOT, then it wastes a +# tiny bit of kernel memory remembering this fd that can never be revived, but +# when the underlying file object is eventually closed, that memory will be +# reclaimed. So that's OK. # -# The other issue is that when someon calls wait_*, using EPOLLONESHOT means +# The other issue is that when someone calls wait_*, using EPOLLONESHOT means # that if we have ever waited for this fd before, we have to use EPOLL_CTL_MOD # to re-enable it; but if it's a new fd, we have to use EPOLL_CTL_ADD. How do -# we know which to use? There's no reasonable way to track which fds are +# we know which one to use? There's no reasonable way to track which fds are # currently registered -- remember, we're assuming the user might have gone # and rearranged their fds without telling us! # -# Fortunately, this also has a simple solution: usually, if we wait on a -# socket or other fd once, we will probably wait lots of times. And the epoll +# Fortunately, this also has a simple solution: if we wait on a socket or +# other fd once, then we'll probably wait on it lots of times. And the epoll # object itself knows which fds it already has registered. So when an fd comes # in, we optimistically assume that it's been waited on before, and try doing -# EPOLL_CTL_MOD. If that failed with an ENOENT error, then we try again with -# EPOLL_CTL_ADD. +# EPOLL_CTL_MOD. And if that fails with an ENOENT error, then we try again +# with EPOLL_CTL_ADD. # # So that's why this code is the way it is. And now you know more than you # wanted to about how epoll works. @@ -218,7 +226,7 @@ def handle_io(self, timeout): events = self._epoll.poll(timeout, max_events) for fd, flags in events: waiters = self._registered[fd] - # EPOLLONESHOT always clears the flags + # EPOLLONESHOT always clears the flags when an event is delivered waiters.current_flags = 0 # Clever hack stolen from selectors.EpollSelector: an event # with EPOLLHUP or EPOLLERR flags wakes both readers and diff --git a/trio/_core/_io_kqueue.py b/trio/_core/_io_kqueue.py index baf1427de6..e3989152ea 100644 --- a/trio/_core/_io_kqueue.py +++ b/trio/_core/_io_kqueue.py @@ -125,11 +125,12 @@ def abort(_): except FileNotFoundError: # kqueue tracks individual fds (*not* the underlying file # object, see _io_epoll.py for a long discussion of why this - # matters), and automatically deregisters an event if the fd - # is closed. So if kqueue.control says that it doesn't know - # about this event, then probably it's because the fd was - # closed behind our backs. (Too bad it doesn't tell us that - # this happened... oh well, you can't have everything.) + # distinction matters), and automatically deregisters an event + # if the fd is closed. So if kqueue.control says that it + # doesn't know about this event, then probably it's because + # the fd was closed behind our backs. (Too bad it doesn't tell + # us that this happened... oh well, you can't have + # everything.) pass return _core.Abort.SUCCEEDED From 3633ade0c74dcfbc81bb7512d97b174e601dcb34 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 3 Nov 2019 20:32:45 -0800 Subject: [PATCH 014/157] Factor out some shared code from _io_windows and _io_epoll This also fixes Windows coverage, which is nice --- trio/_core/_io_common.py | 22 ++++++++++++++++++++++ trio/_core/_io_epoll.py | 25 ++++--------------------- trio/_core/_io_windows.py | 24 +++--------------------- 3 files changed, 29 insertions(+), 42 deletions(-) create mode 100644 trio/_core/_io_common.py diff --git a/trio/_core/_io_common.py b/trio/_core/_io_common.py new file mode 100644 index 0000000000..9891849bc9 --- /dev/null +++ b/trio/_core/_io_common.py @@ -0,0 +1,22 @@ +import copy +import outcome +from .. import _core + + +# Utility function shared between _io_epoll and _io_windows +def wake_all(waiters, exc): + try: + current_task = _core.current_task() + except RuntimeError: + current_task = None + raise_at_end = False + for attr_name in ["read_task", "write_task"]: + task = getattr(waiters, attr_name) + if task is not None: + if task is current_task: + raise_at_end = True + else: + _core.reschedule(task, outcome.Error(copy.copy(exc))) + setattr(waiters, attr_name, None) + if raise_at_end: + raise exc diff --git a/trio/_core/_io_epoll.py b/trio/_core/_io_epoll.py index 9241f34066..5d73a58c84 100644 --- a/trio/_core/_io_epoll.py +++ b/trio/_core/_io_epoll.py @@ -1,11 +1,10 @@ import select import attr -import outcome -import copy from collections import defaultdict from .. import _core from ._run import _public +from ._io_common import wake_all @attr.s(slots=True, eq=False, frozen=True) @@ -179,23 +178,6 @@ class EpollWaiters: write_task = attr.ib(default=None) current_flags = attr.ib(default=0) - def wake_all(self, exc): - try: - current_task = _core.current_task() - except RuntimeError: - current_task = None - raise_at_end = False - for attr_name in ["read_task", "write_task"]: - task = getattr(self, attr_name) - if task is not None: - if task is current_task: - raise_at_end = True - else: - _core.reschedule(task, outcome.Error(copy.copy(exc))) - setattr(self, attr_name, None) - if raise_at_end: - raise exc - @attr.s(slots=True, eq=False, hash=False) class EpollIOManager: @@ -265,7 +247,7 @@ def _update_registrations(self, fd): del self._registered[fd] # This could raise (in case we're calling this inside one of # the to-be-woken tasks), so we have to do it last. - waiters.wake_all(exc) + wake_all(waiters, exc) return if not wanted_flags: del self._registered[fd] @@ -300,7 +282,8 @@ async def wait_writable(self, fd): def notify_closing(self, fd): if not isinstance(fd, int): fd = fd.fileno() - self._registered[fd].wake_all( + wake_all( + self._registered[fd], _core.ClosedResourceError("another task closed this fd") ) del self._registered[fd] diff --git a/trio/_core/_io_windows.py b/trio/_core/_io_windows.py index 45f8cafafb..7e452177d1 100644 --- a/trio/_core/_io_windows.py +++ b/trio/_core/_io_windows.py @@ -2,13 +2,12 @@ from contextlib import contextmanager import enum import socket -import copy -import outcome import attr from .. import _core from ._run import _public +from ._io_common import wake_all from ._windows_cffi import ( ffi, @@ -283,23 +282,6 @@ class AFDWaiters: write_task = attr.ib(default=None) current_op = attr.ib(default=None) - def wake_all(self, exc): - try: - current_task = _core.current_task() - except RuntimeError: - current_task = None - raise_at_end = False - for attr_name in ["read_task", "write_task"]: - task = getattr(self, attr_name) - if task is not None: - if task is current_task: - raise_at_end = True - else: - _core.reschedule(task, outcome.Error(copy.copy(exc))) - setattr(self, attr_name, None) - if raise_at_end: - raise exc - # We also need to bundle up all the info for a single op into a standalone # object, because we need to keep all these objects alive until the operation @@ -576,7 +558,7 @@ def _refresh_afd(self, base_handle): # pending calls. del self._afd_waiters[base_handle] # Do this last, because it could raise. - waiters.wake_all(exc) + wake_all(waiters, exc) return op = AFDPollOp(lpOverlapped, poll_info, waiters) waiters.current_op = op @@ -615,7 +597,7 @@ def notify_closing(self, handle): handle = _get_base_socket(handle) waiters = self._afd_waiters.get(handle) if waiters is not None: - waiters.wake_all(_core.ClosedResourceError()) + wake_all(waiters, _core.ClosedResourceError()) self._refresh_afd(handle) ################################################################ From 59d07e9fc52f2aad9ce16f1e886a2beb95c339e2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2019 09:13:56 +0000 Subject: [PATCH 015/157] Bump cffi from 1.13.1 to 1.13.2 Bumps [cffi](https://bitbucket.org/cffi/release-doc) from 1.13.1 to 1.13.2. - [Commits](https://bitbucket.org/cffi/release-doc/commits) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 339b47e5b2..5ca7ca52a9 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -10,7 +10,7 @@ async-generator==1.10 atomicwrites==1.3.0 # via pytest attrs==19.3.0 backcall==0.1.0 # via ipython -cffi==1.13.1 # via cryptography +cffi==1.13.2 # via cryptography coverage==4.5.4 # via pytest-cov cryptography==2.8 # via pyopenssl, trustme decorator==4.4.1 # via ipython, traitlets From 039df228bb21d508832feaa81113ce0d718d6f19 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2019 13:54:28 +0000 Subject: [PATCH 016/157] Bump trustme from 0.5.2 to 0.5.3 Bumps [trustme](https://github.com/python-trio/trustme) from 0.5.2 to 0.5.3. - [Release notes](https://github.com/python-trio/trustme/releases) - [Commits](https://github.com/python-trio/trustme/compare/v0.5.2...v0.5.3) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 5ca7ca52a9..cb014979a6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -48,7 +48,7 @@ six==1.12.0 # via astroid, cryptography, packaging, prompt-toolkit sniffio==1.1.0 sortedcontainers==2.1.0 traitlets==4.3.3 # via ipython -trustme==0.5.2 +trustme==0.5.3 typed-ast==1.4.0 ; python_version < "3.8" and implementation_name == "cpython" wcwidth==0.1.7 # via prompt-toolkit, pytest wrapt==1.11.2 # via astroid From df8a04ce20cfa216b10a6c60c882188692c6c47c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2019 05:39:15 +0000 Subject: [PATCH 017/157] Bump pyparsing from 2.4.2 to 2.4.4 Bumps [pyparsing](https://github.com/pyparsing/pyparsing) from 2.4.2 to 2.4.4. - [Release notes](https://github.com/pyparsing/pyparsing/releases) - [Changelog](https://github.com/pyparsing/pyparsing/blob/pyparsing_2.4.4/CHANGES) - [Commits](https://github.com/pyparsing/pyparsing/compare/pyparsing_2.4.2...pyparsing_2.4.4) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 53eefd1d38..d7f3bd6279 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -21,7 +21,7 @@ markupsafe==1.1.1 # via jinja2 outcome==1.0.1 packaging==19.2 # via sphinx pygments==2.4.2 # via sphinx -pyparsing==2.4.2 # via packaging +pyparsing==2.4.4 # via packaging pytz==2019.3 # via babel requests==2.22.0 # via sphinx six==1.12.0 # via packaging diff --git a/test-requirements.txt b/test-requirements.txt index cb014979a6..3a5e751fdc 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -41,7 +41,7 @@ pyflakes==2.1.1 # via flake8 pygments==2.4.2 # via ipython pylint==2.4.2 pyopenssl==19.0.0 -pyparsing==2.4.2 # via packaging +pyparsing==2.4.4 # via packaging pytest-cov==2.8.1 pytest==5.2.2 six==1.12.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets From edc02dcd05616e98a5bc5884ad76484a83a01fbc Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Thu, 7 Nov 2019 23:01:44 -0800 Subject: [PATCH 018/157] [wip] [ci] Run tests in a full-fledged ubuntu 19.10 VM (#1292) * Add CI job to run tests in Ubuntu on Qemu/KVM * Drop docker version of ubuntu-latest test, since the vm test covers it * sudo it harder * Don't switch all runs to bionic - in particular, no pypy3 there! * Someday I will remember an Ubuntu release name correctly. Today is not that day. * Add missing envvar * Fix remaining instances of CODECOV_NAME * moar quotes --- .travis.yml | 16 +++++- azure-pipelines.yml | 30 ------------ ci.sh | 117 +++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 124 insertions(+), 39 deletions(-) diff --git a/.travis.yml b/.travis.yml index 55215fd2c2..d1b072f796 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,23 @@ matrix: - python: pypy3 - language: generic env: PYPY_NIGHTLY_BRANCH=py3.6 + # Qemu tests are also slow + # The unique thing this provides is testing on the given distro's + # kernel, which is important when we use new kernel features. This + # is also good for testing the latest openssl etc., and getting + # early warning of any issues that might happen in the next Ubuntu + # LTS. + - language: generic + # We use bionic for the host, b/c rumor says that Travis's + # 'bionic' systems have nested KVM enabled. + dist: bionic + env: + - "JOB_NAME='Ubuntu 19.10, full VM'" + - "VM_IMAGE=https://cloud-images.ubuntu.com/eoan/current/eoan-server-cloudimg-amd64.img" # 3.5.0 and 3.5.1 have different __aiter__ semantics than all # other versions, so we need to test them specially. Travis's - # xenial dist only provides 3.5.2+. + # newer images only provide 3.5.2+, so we have to request the old + # 'trusty' images. - python: 3.5.0 dist: trusty - python: 3.5 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 74ebedde10..223ad4a09a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,36 +6,6 @@ trigger: jobs: -# Special job that uses a container to check we work on the latest -# tippy-tip ubuntu. The main thing this adds is openssl 1.1.1/TLS 1.3. -# -# Azure has fancy stuff to let you run directly inside a container: -# -# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/container-phases -# -# Unfortunately it's useless for us. Azure carefully sets everything -# up so that you run as a non-root user, but can sudo to get root. But -# the standard images that docker maintains like 'ubuntu' or 'debian' -# don't have sudo installed, which means that if you use 'container: -# ubuntu:rolling' then you simply cannot get root. And it's definitely -# not worth maintaining our own container image just so we can -# preinstall sudo: -# -# https://github.com/MicrosoftDocs/vsts-docs/issues/2939 -- job: "py37_latest_ubuntu" - pool: - vmImage: "ubuntu-16.04" - timeoutInMinutes: 10 - steps: - # This actually reveals the CODECOV_TOKEN in the logs, but - # AFAICT the only thing the token lets you do is upload coverage - # reports, which doesn't seem like a very tempting target for - # malicious hackers. - - bash: | - set -ex - env | sort - sudo docker run -e SYSTEM_JOBIDENTIFIER="$SYSTEM_JOBIDENTIFIER" -e CODECOV_TOKEN="$CODECOV_TOKEN" -v "$PWD:/t" ubuntu:rolling /bin/bash -c "set -ex; cd /t; apt update; apt install -y python3.7-dev python3-virtualenv git build-essential curl; python3.7 -m virtualenv -p python3.7 venv; source venv/bin/activate; source ci.sh" - - job: 'Windows' pool: vmImage: 'vs2017-win2016' diff --git a/ci.sh b/ci.sh index 1daf728aff..a1fcfc288d 100755 --- a/ci.sh +++ b/ci.sh @@ -5,11 +5,13 @@ set -ex -o pipefail # Log some general info about the environment env | sort -if [ "$SYSTEM_JOBIDENTIFIER" != "" ]; then - # azure pipelines - CODECOV_NAME="$SYSTEM_JOBDISPLAYNAME" -else - CODECOV_NAME="${TRAVIS_OS_NAME}-${TRAVIS_PYTHON_VERSION:-unknown}" +if [ "$JOB_NAME" = "" ]; then + if [ "$SYSTEM_JOBIDENTIFIER" != "" ]; then + # azure pipelines + JOB_NAME="$SYSTEM_JOBDISPLAYNAME" + else + JOB_NAME="${TRAVIS_OS_NAME}-${TRAVIS_PYTHON_VERSION:-unknown}" + fi fi # We always want to retry on failure, and we have to set --connect-timeout to @@ -51,7 +53,7 @@ fi ### Travis + macOS ### if [ "$TRAVIS_OS_NAME" = "osx" ]; then - CODECOV_NAME="osx_${MACPYTHON}" + JOB_NAME="osx_${MACPYTHON}" $CURL -Lo macpython.pkg https://www.python.org/ftp/python/${MACPYTHON}/python-${MACPYTHON}-macosx10.6.pkg sudo installer -pkg macpython.pkg -target / ls /Library/Frameworks/Python.framework/Versions/*/bin/ @@ -66,7 +68,7 @@ fi ### PyPy nightly (currently on Travis) ### if [ "$PYPY_NIGHTLY_BRANCH" != "" ]; then - CODECOV_NAME="pypy_nightly_${PYPY_NIGHTLY_BRANCH}" + JOB_NAME="pypy_nightly_${PYPY_NIGHTLY_BRANCH}" $CURL -fLo pypy.tar.bz2 http://buildbot.pypy.org/nightly/${PYPY_NIGHTLY_BRANCH}/pypy-c-jit-latest-linux64.tar.bz2 if [ ! -s pypy.tar.bz2 ]; then # We know: @@ -94,6 +96,105 @@ if [ "$PYPY_NIGHTLY_BRANCH" != "" ]; then source testenv/bin/activate fi +### Qemu virtual-machine inception, on Travis + +if [ "$VM_IMAGE" != "" ]; then + VM_CPU=${VM_CPU:-x86_64} + + sudo apt update + sudo apt install cloud-image-utils qemu-system-x86 + + # If the base image is already present, we don't try downloading it again; + # and we use a scratch image for the actual run, in order to keep the base + # image file pristine. None of this matters when running in CI, but it + # makes local testing much easier. + BASEIMG=$(basename $VM_IMAGE) + if [ ! -e $BASEIMG ]; then + $CURL "$VM_IMAGE" -o $BASEIMG + fi + rm -f os-working.img + qemu-img create -f qcow2 -b $BASEIMG os-working.img + + # This is the test script, that runs inside the VM, using cloud-init. + # + # This script goes through shell expansion, so use \ to quote any + # $variables you want to expand inside the guest. + cloud-localds -H test-host seed.img /dev/stdin << EOF +#!/bin/bash + +set -xeuo pipefail + +# When this script exits, we shut down the machine, which causes the qemu on +# the host to exit +trap "poweroff" exit + +uname -a +echo \$PWD +id +cat /etc/lsb-release +cat /proc/cpuinfo + +# Pass-through JOB_NAME + the env vars that codecov-bash looks at +export JOB_NAME="$JOB_NAME" +export CI="$CI" +export TRAVIS="$TRAVIS" +export TRAVIS_COMMIT="$TRAVIS_COMMIT" +export TRAVIS_PULL_REQUEST_SHA="$TRAVIS_PULL_REQUEST_SHA" +export TRAVIS_JOB_NUMBER="$TRAVIS_JOB_NUMBER" +export TRAVIS_PULL_REQUEST="$TRAVIS_PULL_REQUEST" +export TRAVIS_JOB_ID="$TRAVIS_JOB_ID" +export TRAVIS_REPO_SLUG="$TRAVIS_REPO_SLUG" +export TRAVIS_TAG="$TRAVIS_TAG" +export TRAVIS_BRANCH="$TRAVIS_BRANCH" + +env + +mkdir /host-files +mount -t 9p -o trans=virtio,version=9p2000.L host-files /host-files + +# Install and set up the system Python (assumes Debian/Ubuntu) +apt update +apt install -y python3-dev python3-virtualenv git build-essential curl +python3 -m virtualenv -p python3 /venv +# Uses unbound shell variable PS1, so have to allow that temporarily +set +u +source /venv/bin/activate +set -u + +# And then we re-invoke ourselves! +cd /host-files +./ci.sh + +# We can't pass our exit status out. So if we got this far without error, make +# a marker file where the host can see it. +touch /host-files/SUCCESS +EOF + + rm -f SUCCESS + # Apparently Travis's bionic images have nested virtualization enabled, so + # we can use KVM... but the default user isn't in the appropriate groups + # to use KVM, so we have to use 'sudo' to add that. And then a second + # 'sudo', because by default we have rights to run arbitrary commands as + # root, but we don't have rights to run a command as ourselves but with a + # tweaked group setting. + # + # Travis Linux VMs have 7.5 GiB RAM, so we give our nested VM 6 GiB RAM + # (-m 6144). + sudo sudo -u $USER -g kvm qemu-system-$VM_CPU \ + -enable-kvm \ + -M pc \ + -m 6144 \ + -nographic \ + -drive "file=./os-working.img,if=virtio" \ + -drive "file=./seed.img,if=virtio,format=raw" \ + -net nic \ + -net "user,hostfwd=tcp:127.0.0.1:50022-:22" \ + -virtfs local,path=$PWD,security_model=mapped-file,mount_tag=host-files + + test -e SUCCESS + exit +fi + ################################################################ # We have a Python environment! ################################################################ @@ -177,7 +278,7 @@ else # but azure is broken: # https://developercommunity.visualstudio.com/content/problem/743824/bash-task-on-windows-suddenly-fails-with-bash-devf.html $CURL -o codecov.sh https://codecov.io/bash - bash codecov.sh -n "${CODECOV_NAME}" -F "$FLAG" + bash codecov.sh -n "${JOB_NAME}" -F "$FLAG" fi $PASSED From 303d71649de85f574ad8abf1f791cad88852fda3 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Fri, 8 Nov 2019 16:52:04 -0800 Subject: [PATCH 019/157] Work around openssl Connection(Reset|Aborted)Error on Windows Fixes gh-1293, I hope. --- trio/tests/test_ssl.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/trio/tests/test_ssl.py b/trio/tests/test_ssl.py index dbdd882c43..0ac217bb4c 100644 --- a/trio/tests/test_ssl.py +++ b/trio/tests/test_ssl.py @@ -107,6 +107,22 @@ def ssl_echo_serve_sync(sock, *, expect_fail=False): pass return wrapped.sendall(data) + # This is an obscure workaround for an openssl bug. In server mode, in + # some versions, openssl sends some extra data at the end of do_handshake + # that it shouldn't send. Normally this is harmless, but, if the other + # side shuts down the connection before it reads that data, it might cause + # the OS to report a ECONNREST or even ECONNABORTED (which is just wrong, + # since ECONNABORTED is supposed to mean that connect() failed, but what + # can you do). In this case the other side did nothing wrong, but there's + # no way to recover, so we let it pass, and just cross our fingers its not + # hiding any (other) real bugs. For more details see: + # + # https://github.com/python-trio/trio/issues/1293 + # + # Also, this happens frequently but non-deterministically, so we have to + # 'no cover' it to avoid coverage flapping. + except (ConnectionResetError, ConnectionAbortedError): # pragma: no cover + return except Exception as exc: if expect_fail: print("ssl_echo_serve_sync got error as expected:", exc) From 121c933d0259daf24bac98dc1fa3d6f6ad987315 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 9 Nov 2019 04:58:15 +0000 Subject: [PATCH 020/157] Bump astroid from 2.3.2 to 2.3.3 Bumps [astroid](https://github.com/PyCQA/astroid) from 2.3.2 to 2.3.3. - [Release notes](https://github.com/PyCQA/astroid/releases) - [Changelog](https://github.com/PyCQA/astroid/blob/astroid-2.3.3/ChangeLog) - [Commits](https://github.com/PyCQA/astroid/compare/astroid-2.3.2...astroid-2.3.3) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 3a5e751fdc..01d1c8c1d3 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,12 +5,12 @@ # pip-compile --output-file test-requirements.txt test-requirements.in # astor==0.8.0 -astroid==2.3.2 # via pylint +astroid==2.3.3 # via pylint async-generator==1.10 atomicwrites==1.3.0 # via pytest attrs==19.3.0 backcall==0.1.0 # via ipython -cffi==1.13.2 # via cryptography +cffi==1.13.2 coverage==4.5.4 # via pytest-cov cryptography==2.8 # via pyopenssl, trustme decorator==4.4.1 # via ipython, traitlets From f209114b261f2922cc15ce7ab9af3835b6163408 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 10 Nov 2019 04:47:02 -0800 Subject: [PATCH 021/157] [ci] Try retrying curl if it fails (#1300) The hope is that this will finally resolve gh-1231. --- ci.sh | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/ci.sh b/ci.sh index a1fcfc288d..a0fc87387b 100755 --- a/ci.sh +++ b/ci.sh @@ -14,10 +14,21 @@ if [ "$JOB_NAME" = "" ]; then fi fi -# We always want to retry on failure, and we have to set --connect-timeout to -# work around a curl bug: -# https://github.com/curl/curl/issues/4461 -CURL="curl --connect-timeout 5 --retry 5" +# Curl's built-in retry system is not very robust; it gives up on lots of +# network errors that we want to retry on. Wget might work better, but it's +# not installed on azure pipelines's windows boxes. So... let's try some good +# old-fashioned brute force. (This is also a convenient place to put options +# we always want, like -f to tell curl to give an error if the server sends an +# error response, and -L to follow redirects.) +function curl-harder() { + for BACKOFF in 0 1 2 4 8 15 15 15 15; do + sleep $BACKOFF + if curl -fL --connect-timeout 5 "$@"; then + return 0 + fi + done + return 1 +} ################################################################ # Bootstrap python environment, if necessary @@ -54,12 +65,13 @@ fi if [ "$TRAVIS_OS_NAME" = "osx" ]; then JOB_NAME="osx_${MACPYTHON}" - $CURL -Lo macpython.pkg https://www.python.org/ftp/python/${MACPYTHON}/python-${MACPYTHON}-macosx10.6.pkg + curl-harder -o macpython.pkg https://www.python.org/ftp/python/${MACPYTHON}/python-${MACPYTHON}-macosx10.6.pkg sudo installer -pkg macpython.pkg -target / ls /Library/Frameworks/Python.framework/Versions/*/bin/ PYTHON_EXE=/Library/Frameworks/Python.framework/Versions/*/bin/python3 # The pip in older MacPython releases doesn't support a new enough TLS - $CURL https://bootstrap.pypa.io/get-pip.py | sudo $PYTHON_EXE + curl-harder -o get-pip.py https://bootstrap.pypa.io/get-pip.py + sudo $PYTHON_EXE get-pip.py sudo $PYTHON_EXE -m pip install virtualenv $PYTHON_EXE -m virtualenv testenv source testenv/bin/activate @@ -69,11 +81,10 @@ fi if [ "$PYPY_NIGHTLY_BRANCH" != "" ]; then JOB_NAME="pypy_nightly_${PYPY_NIGHTLY_BRANCH}" - $CURL -fLo pypy.tar.bz2 http://buildbot.pypy.org/nightly/${PYPY_NIGHTLY_BRANCH}/pypy-c-jit-latest-linux64.tar.bz2 + curl-harder -o pypy.tar.bz2 http://buildbot.pypy.org/nightly/${PYPY_NIGHTLY_BRANCH}/pypy-c-jit-latest-linux64.tar.bz2 if [ ! -s pypy.tar.bz2 ]; then # We know: - # - curl succeeded (200 response code; -f means "exit with error if - # server returns 4xx or 5xx") + # - curl succeeded (200 response code) # - nonetheless, pypy.tar.bz2 does not exist, or contains no data # This isn't going to work, and the failure is not informative of # anything involving Trio. @@ -110,7 +121,7 @@ if [ "$VM_IMAGE" != "" ]; then # makes local testing much easier. BASEIMG=$(basename $VM_IMAGE) if [ ! -e $BASEIMG ]; then - $CURL "$VM_IMAGE" -o $BASEIMG + curl-harder "$VM_IMAGE" -o $BASEIMG fi rm -f os-working.img qemu-img create -f qcow2 -b $BASEIMG os-working.img @@ -226,7 +237,7 @@ else # up. if [ "$LSP" != "" ]; then echo "Installing LSP from ${LSP}" - $CURL -o lsp-installer.exe "$LSP" + curl-harder -o lsp-installer.exe "$LSP" # Double-slashes are how you tell windows-bash that you want a single # slash, and don't treat this as a unix-style filename that needs to # be replaced by a windows-style filename. @@ -277,7 +288,7 @@ else # bash <(curl ...) # but azure is broken: # https://developercommunity.visualstudio.com/content/problem/743824/bash-task-on-windows-suddenly-fails-with-bash-devf.html - $CURL -o codecov.sh https://codecov.io/bash + curl-harder -o codecov.sh https://codecov.io/bash bash codecov.sh -n "${JOB_NAME}" -F "$FLAG" fi From 14b14b75cda42cc7ef8f19fbd436f0e4081ebf65 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 10 Nov 2019 04:47:55 -0800 Subject: [PATCH 022/157] Test on macOS + CPython 3.8 (#1297) The Azure folks are claiming that the 3.8 rollout is basically done, so let's give it a try. --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 223ad4a09a..598724041d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -105,6 +105,8 @@ jobs: python.version: '3.6' "Python 3.7": python.version: '3.7' + "Python 3.8": + python.version: '3.8' steps: - task: UsePythonVersion@0 From f311194c198351faa04a9d9e37ca7bcb25cfb4eb Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 10 Nov 2019 04:51:54 -0800 Subject: [PATCH 023/157] =?UTF-8?q?[ci]=20Attempt=20to=20speed=20up=20CI?= =?UTF-8?q?=20by=20moving=20more=20jobs=20from=20Travis=20=E2=86=92=20Azur?= =?UTF-8?q?e=20(#1301)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only Travis has Python dev builds, an up-to-date pypy build, or nested virtualization. But we can at least move the more generic stuff over to Azure to take advantage of the higher parallelization. --- .travis.yml | 8 ------ azure-pipelines.yml | 65 ++++++++++++++++++++++++--------------------- 2 files changed, 35 insertions(+), 38 deletions(-) diff --git a/.travis.yml b/.travis.yml index d1b072f796..8ae5d0445f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,6 @@ dist: xenial matrix: include: - - python: 3.8 - env: CHECK_DOCS=1 - - python: 3.8 - env: CHECK_FORMATTING=1 # The pypy tests are slow, so we list them first - python: pypy3 - language: generic @@ -30,10 +26,6 @@ matrix: # 'trusty' images. - python: 3.5.0 dist: trusty - - python: 3.5 - - python: 3.6 - - python: 3.7 - - python: 3.8 - python: 3.5-dev - python: 3.6-dev - python: 3.7-dev diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 598724041d..a6c84408c1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,7 +8,7 @@ jobs: - job: 'Windows' pool: - vmImage: 'vs2017-win2016' + vmImage: 'windows-latest' timeoutInMinutes: 20 strategy: # Python version list: @@ -64,38 +64,43 @@ jobs: testRunTitle: 'Windows $(python.pkg) $(python.version)' condition: succeededOrFailed() -# Currently broken for unclear reasons probably related to openssl v1.1.1: -# https://github.com/python-trio/trio/pull/827#issuecomment-457139883 -# -# - job: 'Linux' -# pool: -# vmImage: 'ubuntu-16.04' -# timeoutInMinutes: 10 -# strategy: -# matrix: -# "Python 3.5": -# python.version: '3.5' -# "Python 3.6": -# python.version: '3.6' -# "Python 3.7": -# python.version: '3.7' -# -# steps: -# - task: UsePythonVersion@0 -# inputs: -# versionSpec: '$(python.version)' -# -# - bash: ci.sh -# displayName: "Run the actual tests" -# -# - task: PublishTestResults@2 -# inputs: -# testResultsFiles: 'test-results.xml' -# condition: succeededOrFailed() +- job: 'Linux' + pool: + vmImage: 'ubuntu-latest' + timeoutInMinutes: 10 + strategy: + matrix: + "Check docs": + python.version: '3.8' + CHECK_DOCS: 1 + "Formatting and linting": + python.version: '3.8' + CHECK_FORMATTING: 1 + "Python 3.5": + python.version: '3.5' + "Python 3.6": + python.version: '3.6' + "Python 3.7": + python.version: '3.7' + "Python 3.8": + python.version: '3.8' + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + + - bash: ./ci.sh + displayName: "Run the actual tests" + + - task: PublishTestResults@2 + inputs: + testResultsFiles: 'test-results.xml' + condition: succeededOrFailed() - job: 'macOS' pool: - vmImage: 'macOS-10.13' + vmImage: 'macOS-latest' timeoutInMinutes: 10 strategy: matrix: From d3bc00bc951d84ad623d3c2c267eeedd335bf62e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2019 07:43:38 +0000 Subject: [PATCH 024/157] Bump pyparsing from 2.4.4 to 2.4.5 Bumps [pyparsing](https://github.com/pyparsing/pyparsing) from 2.4.4 to 2.4.5. - [Release notes](https://github.com/pyparsing/pyparsing/releases) - [Changelog](https://github.com/pyparsing/pyparsing/blob/pyparsing_2.4.5/CHANGES) - [Commits](https://github.com/pyparsing/pyparsing/compare/pyparsing_2.4.4...pyparsing_2.4.5) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index d7f3bd6279..7341b2dee3 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -21,7 +21,7 @@ markupsafe==1.1.1 # via jinja2 outcome==1.0.1 packaging==19.2 # via sphinx pygments==2.4.2 # via sphinx -pyparsing==2.4.4 # via packaging +pyparsing==2.4.5 # via packaging pytz==2019.3 # via babel requests==2.22.0 # via sphinx six==1.12.0 # via packaging diff --git a/test-requirements.txt b/test-requirements.txt index 01d1c8c1d3..d21f5f5456 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -41,7 +41,7 @@ pyflakes==2.1.1 # via flake8 pygments==2.4.2 # via ipython pylint==2.4.2 pyopenssl==19.0.0 -pyparsing==2.4.4 # via packaging +pyparsing==2.4.5 # via packaging pytest-cov==2.8.1 pytest==5.2.2 six==1.12.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets From c521b4c15499979d4d8668bf9eb4841d65c280b6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2019 07:54:29 +0000 Subject: [PATCH 025/157] Bump six from 1.12.0 to 1.13.0 Bumps [six](https://github.com/benjaminp/six) from 1.12.0 to 1.13.0. - [Release notes](https://github.com/benjaminp/six/releases) - [Changelog](https://github.com/benjaminp/six/blob/master/CHANGES) - [Commits](https://github.com/benjaminp/six/compare/1.12.0...1.13.0) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 7341b2dee3..0c7d20bf3e 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -24,7 +24,7 @@ pygments==2.4.2 # via sphinx pyparsing==2.4.5 # via packaging pytz==2019.3 # via babel requests==2.22.0 # via sphinx -six==1.12.0 # via packaging +six==1.13.0 # via packaging sniffio==1.1.0 snowballstemmer==2.0.0 # via sphinx sortedcontainers==2.1.0 diff --git a/test-requirements.txt b/test-requirements.txt index d21f5f5456..9399145542 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -44,7 +44,7 @@ pyopenssl==19.0.0 pyparsing==2.4.5 # via packaging pytest-cov==2.8.1 pytest==5.2.2 -six==1.12.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets +six==1.13.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets sniffio==1.1.0 sortedcontainers==2.1.0 traitlets==4.3.3 # via ipython From 55de562b51eddd004c5bf4f86b37283a310f488c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2019 05:36:58 +0000 Subject: [PATCH 026/157] Bump urllib3 from 1.25.6 to 1.25.7 Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.25.6 to 1.25.7. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/master/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.25.6...1.25.7) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 0c7d20bf3e..0a9f5475a5 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -39,4 +39,4 @@ sphinxcontrib-serializinghtml==1.1.3 # via sphinx sphinxcontrib-trio==1.1.0 toml==0.10.0 # via towncrier towncrier==19.2.0 -urllib3==1.25.6 # via requests +urllib3==1.25.7 # via requests From a22214ed835605823a630bb28cb347a658cada20 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2019 05:40:53 +0000 Subject: [PATCH 027/157] Bump pytest from 5.2.2 to 5.2.3 Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.2.2 to 5.2.3. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/5.2.2...5.2.3) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 9399145542..4c94626f79 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -43,7 +43,7 @@ pylint==2.4.2 pyopenssl==19.0.0 pyparsing==2.4.5 # via packaging pytest-cov==2.8.1 -pytest==5.2.2 +pytest==5.2.3 six==1.13.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets sniffio==1.1.0 sortedcontainers==2.1.0 From c2145e53bf1bccfc98d52af8d1f7909ba67b92fe Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2019 05:54:56 +0000 Subject: [PATCH 028/157] Bump pytest from 5.2.3 to 5.2.4 Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.2.3 to 5.2.4. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/5.2.3...5.2.4) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 4c94626f79..44baac58b2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -43,7 +43,7 @@ pylint==2.4.2 pyopenssl==19.0.0 pyparsing==2.4.5 # via packaging pytest-cov==2.8.1 -pytest==5.2.3 +pytest==5.2.4 six==1.13.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets sniffio==1.1.0 sortedcontainers==2.1.0 From 86bcd9cb3a5ffe05b7230ff02b694052fd7c8fd0 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2019 06:08:49 +0000 Subject: [PATCH 029/157] Bump pyopenssl from 19.0.0 to 19.1.0 Bumps [pyopenssl](https://github.com/pyca/pyopenssl) from 19.0.0 to 19.1.0. - [Release notes](https://github.com/pyca/pyopenssl/releases) - [Changelog](https://github.com/pyca/pyopenssl/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pyca/pyopenssl/compare/19.0.0...19.1.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 44baac58b2..7a9c4df8eb 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -40,7 +40,7 @@ pycparser==2.19 # via cffi pyflakes==2.1.1 # via flake8 pygments==2.4.2 # via ipython pylint==2.4.2 -pyopenssl==19.0.0 +pyopenssl==19.1.0 pyparsing==2.4.5 # via packaging pytest-cov==2.8.1 pytest==5.2.4 From 54a95d709acb308cea7e38166f54343ad81772fa Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Sun, 17 Nov 2019 13:42:03 +0700 Subject: [PATCH 030/157] Attempt to clarify "same time" wording --- docs/source/tutorial.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index 5896933871..3b9255b236 100644 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -770,11 +770,12 @@ programming, and – to add insult to injury – `pretty poor scalability Python just aren't that appealing. Trio doesn't make your code run on multiple cores; in fact, as we saw -above, it's baked into Trio's design that you never have two tasks -running at the same time. We're not so much overcoming the GIL as -embracing it. But if you're willing to accept that, plus a bit of -extra work to put these new ``async`` and ``await`` keywords in the -right places, then in exchange you get: +above, it's baked into Trio's design that when it has multiple tasks, +they take turns, so at each moment only one of them is actively running. +We're not so much overcoming the GIL as embracing it. But if you're +willing to accept that, plus a bit of extra work to put these new +``async`` and ``await`` keywords in the right places, then in exchange +you get: * Excellent scalability: Trio can run 10,000+ tasks simultaneously without breaking a sweat, so long as their total CPU demands don't From 7b9038f6420fd36f73d3995ae1e31571133cbcc2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2019 05:46:16 +0000 Subject: [PATCH 031/157] Bump pytest from 5.2.4 to 5.3.0 Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.2.4 to 5.3.0. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/5.2.4...5.3.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 7a9c4df8eb..4704e2dd2a 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -7,7 +7,6 @@ astor==0.8.0 astroid==2.3.3 # via pylint async-generator==1.10 -atomicwrites==1.3.0 # via pytest attrs==19.3.0 backcall==0.1.0 # via ipython cffi==1.13.2 @@ -43,7 +42,7 @@ pylint==2.4.2 pyopenssl==19.1.0 pyparsing==2.4.5 # via packaging pytest-cov==2.8.1 -pytest==5.2.4 +pytest==5.3.0 six==1.13.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets sniffio==1.1.0 sortedcontainers==2.1.0 From 1a53de84990fa4300ea1b1c991669a7694152e0f Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Wed, 20 Nov 2019 20:18:08 -0800 Subject: [PATCH 032/157] Improve comment --- trio/_core/tests/test_io.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/trio/_core/tests/test_io.py b/trio/_core/tests/test_io.py index ba12b1a57d..3d78573c31 100644 --- a/trio/_core/tests/test_io.py +++ b/trio/_core/tests/test_io.py @@ -354,9 +354,12 @@ def check(*, expected_readers, expected_writers): async def test_can_survive_unnotified_close(): - # This should never happen -- users should call notify_closing when they - # close things. But, just in case they don't, we would still like to avoid - # exploding. Acceptable behaviors: + # An "unnotified" close is when the user closes an fd/socket/handle + # directly, without calling notify_closing first. This should never happen + # -- users should call notify_closing before closing things. But, just in + # case they don't, we would still like to avoid exploding. + # + # Acceptable behaviors: # - wait_* never return, but can be cancelled cleanly # - wait_* exit cleanly # - wait_* raise an OSError @@ -364,6 +367,9 @@ async def test_can_survive_unnotified_close(): # Not acceptable: # - getting stuck in an uncancellable state # - TrioInternalError blowing up the whole run + # + # This test exercises some tricky "unnotified close" scenarios, to make + # sure we get the "acceptable" behaviors. async def allow_OSError(async_func, *args): with suppress(OSError): From a629f22044cca7cfda878685590b22077d6fd12f Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Wed, 20 Nov 2019 20:18:38 -0800 Subject: [PATCH 033/157] Remove unnecesary allow_OSError that could have hidden a real error Thanks to oremanj for the catch. --- trio/_core/tests/test_io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trio/_core/tests/test_io.py b/trio/_core/tests/test_io.py index 3d78573c31..2adb3f9a65 100644 --- a/trio/_core/tests/test_io.py +++ b/trio/_core/tests/test_io.py @@ -438,7 +438,7 @@ async def wait_readable_a2_then_set(): async with trio.open_nursery() as nursery: nursery.start_soon(allow_OSError, trio.hazmat.wait_readable, a) nursery.start_soon(allow_OSError, trio.hazmat.wait_writable, a) - nursery.start_soon(allow_OSError, wait_readable_a2_then_set) + nursery.start_soon(wait_readable_a2_then_set) await wait_all_tasks_blocked() a.close() b.send(b"x") From 36164707402bc5db749e4648405b5b031b120ca9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2019 05:46:38 +0000 Subject: [PATCH 034/157] Bump pluggy from 0.13.0 to 0.13.1 Bumps [pluggy](https://github.com/pytest-dev/pluggy) from 0.13.0 to 0.13.1. - [Release notes](https://github.com/pytest-dev/pluggy/releases) - [Changelog](https://github.com/pytest-dev/pluggy/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pluggy/compare/0.13.0...0.13.1) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 4704e2dd2a..7db64f3c7e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -30,7 +30,7 @@ packaging==19.2 # via pytest parso==0.5.1 # via jedi pexpect==4.7.0 # via ipython pickleshare==0.7.5 # via ipython -pluggy==0.13.0 # via pytest +pluggy==0.13.1 # via pytest prompt-toolkit==2.0.10 # via ipython ptyprocess==0.6.0 # via pexpect py==1.8.0 # via pytest From 1fd703cc2190f74c167d1844cdee94a5de8b7bc0 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2019 05:50:00 +0000 Subject: [PATCH 035/157] Bump pytest from 5.3.0 to 5.3.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.3.0 to 5.3.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/5.3.0...5.3.1) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 7db64f3c7e..fdd560a0ce 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -42,7 +42,7 @@ pylint==2.4.2 pyopenssl==19.1.0 pyparsing==2.4.5 # via packaging pytest-cov==2.8.1 -pytest==5.3.0 +pytest==5.3.1 six==1.13.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets sniffio==1.1.0 sortedcontainers==2.1.0 From 7de01d0503d2ea48f54f351b091f6d1750fb59b9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2019 06:10:32 +0000 Subject: [PATCH 036/157] Bump pygments from 2.4.2 to 2.5.1 Bumps [pygments](https://github.com/pygments/pygments) from 2.4.2 to 2.5.1. - [Release notes](https://github.com/pygments/pygments/releases) - [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES) - [Commits](https://github.com/pygments/pygments/compare/2.4.2...2.5.1) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 0a9f5475a5..a1dd990ba8 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -20,7 +20,7 @@ jinja2==2.10.3 # via sphinx, towncrier markupsafe==1.1.1 # via jinja2 outcome==1.0.1 packaging==19.2 # via sphinx -pygments==2.4.2 # via sphinx +pygments==2.5.1 # via sphinx pyparsing==2.4.5 # via packaging pytz==2019.3 # via babel requests==2.22.0 # via sphinx diff --git a/test-requirements.txt b/test-requirements.txt index fdd560a0ce..b70a7f4dbb 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -37,7 +37,7 @@ py==1.8.0 # via pytest pycodestyle==2.5.0 # via flake8 pycparser==2.19 # via cffi pyflakes==2.1.1 # via flake8 -pygments==2.4.2 # via ipython +pygments==2.5.1 # via ipython pylint==2.4.2 pyopenssl==19.1.0 pyparsing==2.4.5 # via packaging From 0e68248327d5daa7fd97ee736d76e21b3ca970ea Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2019 05:48:13 +0000 Subject: [PATCH 037/157] Bump certifi from 2019.9.11 to 2019.11.28 Bumps [certifi](https://github.com/certifi/python-certifi) from 2019.9.11 to 2019.11.28. - [Release notes](https://github.com/certifi/python-certifi/releases) - [Commits](https://github.com/certifi/python-certifi/compare/2019.09.11...2019.11.28) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index a1dd990ba8..1119ff1710 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -8,7 +8,7 @@ alabaster==0.7.12 # via sphinx async-generator==1.10 attrs==19.3.0 babel==2.7.0 # via sphinx -certifi==2019.9.11 # via requests +certifi==2019.11.28 # via requests chardet==3.0.4 # via requests click==7.0 # via towncrier docutils==0.15.2 # via sphinx From 77b72266afceaeab67a8dc52490e96fcbeaa300f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2019 05:48:55 +0000 Subject: [PATCH 038/157] Bump pygments from 2.5.1 to 2.5.2 Bumps [pygments](https://github.com/pygments/pygments) from 2.5.1 to 2.5.2. - [Release notes](https://github.com/pygments/pygments/releases) - [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES) - [Commits](https://github.com/pygments/pygments/compare/2.5.1...2.5.2) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index a1dd990ba8..d05c09c81f 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -20,7 +20,7 @@ jinja2==2.10.3 # via sphinx, towncrier markupsafe==1.1.1 # via jinja2 outcome==1.0.1 packaging==19.2 # via sphinx -pygments==2.5.1 # via sphinx +pygments==2.5.2 # via sphinx pyparsing==2.4.5 # via packaging pytz==2019.3 # via babel requests==2.22.0 # via sphinx diff --git a/test-requirements.txt b/test-requirements.txt index b70a7f4dbb..701dac55df 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -17,14 +17,13 @@ entrypoints==0.3 # via flake8 flake8==3.7.9 idna==2.8 immutables==0.11 -importlib-metadata==0.23 # via pluggy, pytest ipython-genutils==0.2.0 # via traitlets ipython==7.9.0 isort==4.3.21 # via pylint jedi==0.15.1 lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint -more-itertools==7.2.0 # via pytest, zipp +more-itertools==7.2.0 # via pytest outcome==1.0.1 packaging==19.2 # via pytest parso==0.5.1 # via jedi @@ -37,7 +36,7 @@ py==1.8.0 # via pytest pycodestyle==2.5.0 # via flake8 pycparser==2.19 # via cffi pyflakes==2.1.1 # via flake8 -pygments==2.5.1 # via ipython +pygments==2.5.2 # via ipython pylint==2.4.2 pyopenssl==19.1.0 pyparsing==2.4.5 # via packaging @@ -48,8 +47,6 @@ sniffio==1.1.0 sortedcontainers==2.1.0 traitlets==4.3.3 # via ipython trustme==0.5.3 -typed-ast==1.4.0 ; python_version < "3.8" and implementation_name == "cpython" wcwidth==0.1.7 # via prompt-toolkit, pytest wrapt==1.11.2 # via astroid yapf==0.28.0 -zipp==0.6.0 # via importlib-metadata From a68ed76b5dc1ae249747bb11cbf8401a2b6a8dde Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2019 06:21:16 +0000 Subject: [PATCH 039/157] Bump yapf from 0.28.0 to 0.29.0 Bumps [yapf](https://github.com/google/yapf) from 0.28.0 to 0.29.0. - [Release notes](https://github.com/google/yapf/releases) - [Changelog](https://github.com/google/yapf/blob/master/CHANGELOG) - [Commits](https://github.com/google/yapf/compare/v0.28.0...v0.29.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.in | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test-requirements.in b/test-requirements.in index 5d1bda2aa3..077eb70dcf 100644 --- a/test-requirements.in +++ b/test-requirements.in @@ -8,7 +8,7 @@ pylint # for pylint finding all symbols tests jedi # for jedi code completion tests # Tools -yapf ==0.28.0 # formatting +yapf ==0.29.0 # formatting flake8 astor # code generation diff --git a/test-requirements.txt b/test-requirements.txt index 701dac55df..1d413ed27d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -49,4 +49,4 @@ traitlets==4.3.3 # via ipython trustme==0.5.3 wcwidth==0.1.7 # via prompt-toolkit, pytest wrapt==1.11.2 # via astroid -yapf==0.28.0 +yapf==0.29.0 From 591d3bb8e79a59ae3f10adc49ca7ff483420528a Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 29 Nov 2019 06:32:59 +0000 Subject: [PATCH 040/157] Run yapf 0.29.0 --- trio/_abc.py | 15 +++++++++++++++ trio/_sync.py | 2 ++ trio/_timeouts.py | 2 ++ trio/tests/test_deprecate.py | 6 ++++++ 4 files changed, 25 insertions(+) diff --git a/trio/_abc.py b/trio/_abc.py index 126a65711f..675eb5dd9e 100644 --- a/trio/_abc.py +++ b/trio/_abc.py @@ -19,6 +19,7 @@ def start_clock(self): Called at the beginning of the run. """ + @abstractmethod def current_time(self): """Return the current time, according to this clock. @@ -30,6 +31,7 @@ def current_time(self): float: The current time. """ + @abstractmethod def deadline_to_sleep_time(self, deadline): """Compute the real time until the given deadline. @@ -68,10 +70,12 @@ def before_run(self): """Called at the beginning of :func:`trio.run`. """ + def after_run(self): """Called just before :func:`trio.run` returns. """ + def task_spawned(self, task): """Called when the given task is created. @@ -79,6 +83,7 @@ def task_spawned(self, task): task (trio.hazmat.Task): The new task. """ + def task_scheduled(self, task): """Called when the given task becomes runnable. @@ -89,6 +94,7 @@ def task_scheduled(self, task): task (trio.hazmat.Task): The task that became runnable. """ + def before_task_step(self, task): """Called immediately before we resume running the given task. @@ -96,6 +102,7 @@ def before_task_step(self, task): task (trio.hazmat.Task): The task that is about to run. """ + def after_task_step(self, task): """Called when we return to the main run loop after a task has yielded. @@ -103,6 +110,7 @@ def after_task_step(self, task): task (trio.hazmat.Task): The task that just ran. """ + def task_exited(self, task): """Called when the given task exits. @@ -110,6 +118,7 @@ def task_exited(self, task): task (trio.hazmat.Task): The finished task. """ + def before_io_wait(self, timeout): """Called before blocking to wait for I/O readiness. @@ -117,6 +126,7 @@ def before_io_wait(self, timeout): timeout (float): The number of seconds we are willing to wait. """ + def after_io_wait(self, timeout): """Called after handling pending I/O. @@ -155,6 +165,7 @@ async def getaddrinfo( ``b"xn--caf-dma.com"``. """ + @abstractmethod async def getnameinfo(self, sockaddr, flags): """A custom implementation of :func:`~trio.socket.getnameinfo`. @@ -244,6 +255,7 @@ async def aclose(self): See also: :func:`trio.aclose_forcefully`. """ + async def __aenter__(self): return self @@ -293,6 +305,7 @@ async def send_all(self, data): or none of the requested data, and there is no way to know which. """ + @abstractmethod async def wait_send_all_might_not_block(self): """Block until it's possible that :meth:`send_all` might not block. @@ -400,6 +413,7 @@ async def receive_some(self, max_bytes=None): :meth:`receive_some` is running. """ + @aiter_compat def __aiter__(self): return self @@ -614,6 +628,7 @@ async def receive(self) -> ReceiveType: doesn't support it, then you can get `~trio.BusyResourceError`. """ + @aiter_compat def __aiter__(self): return self diff --git a/trio/_sync.py b/trio/_sync.py index 6574d8c3ae..58f01c1970 100644 --- a/trio/_sync.py +++ b/trio/_sync.py @@ -676,6 +676,8 @@ class StrictFIFOLock(Lock): on this property. """ + + @attr.s(frozen=True) class _ConditionStatistics: tasks_waiting = attr.ib() diff --git a/trio/_timeouts.py b/trio/_timeouts.py index ccdf075946..25cef08d0d 100644 --- a/trio/_timeouts.py +++ b/trio/_timeouts.py @@ -93,6 +93,8 @@ class TooSlowError(Exception): expires. """ + + @contextmanager def fail_at(deadline): """Creates a cancel scope with the given deadline, and raises an error if it diff --git a/trio/tests/test_deprecate.py b/trio/tests/test_deprecate.py index 98e57ec706..6ecd00003e 100644 --- a/trio/tests/test_deprecate.py +++ b/trio/tests/test_deprecate.py @@ -157,16 +157,22 @@ def docstring_test1(): # pragma: no cover """Hello! """ + + @deprecated("2.1", issue=None, instead="hi") def docstring_test2(): # pragma: no cover """Hello! """ + + @deprecated("2.1", issue=1, instead=None) def docstring_test3(): # pragma: no cover """Hello! """ + + @deprecated("2.1", issue=None, instead=None) def docstring_test4(): # pragma: no cover """Hello! From a7c7778c8feddf86194f256868322a8b6457e75a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2019 05:57:28 +0000 Subject: [PATCH 041/157] Bump more-itertools from 7.2.0 to 8.0.0 Bumps [more-itertools](https://github.com/erikrose/more-itertools) from 7.2.0 to 8.0.0. - [Release notes](https://github.com/erikrose/more-itertools/releases) - [Commits](https://github.com/erikrose/more-itertools/compare/v7.2.0...v8.0.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 1d413ed27d..558adcb323 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -23,7 +23,7 @@ isort==4.3.21 # via pylint jedi==0.15.1 lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint -more-itertools==7.2.0 # via pytest +more-itertools==8.0.0 # via pytest outcome==1.0.1 packaging==19.2 # via pytest parso==0.5.1 # via jedi From 693a146fc2f444fdb74556cf4547e00d871b111d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2019 05:51:26 +0000 Subject: [PATCH 042/157] Bump sphinx from 2.2.1 to 2.2.2 Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 2.2.1 to 2.2.2. - [Release notes](https://github.com/sphinx-doc/sphinx/releases) - [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinx/compare/v2.2.1...v2.2.2) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 20dec75c22..56f7d7e619 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -29,7 +29,7 @@ sniffio==1.1.0 snowballstemmer==2.0.0 # via sphinx sortedcontainers==2.1.0 sphinx-rtd-theme==0.4.3 -sphinx==2.2.1 +sphinx==2.2.2 sphinxcontrib-applehelp==1.0.1 # via sphinx sphinxcontrib-devhelp==1.0.1 # via sphinx sphinxcontrib-htmlhelp==1.0.2 # via sphinx From c567a0001f341fbc5b0c23d6c976dddff69a3e81 Mon Sep 17 00:00:00 2001 From: David Hirschfeld Date: Tue, 3 Dec 2019 20:56:35 +1000 Subject: [PATCH 043/157] Update gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 555e03c6e8..a50c10b8a3 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ __pycache__/ .installed.cfg *.egg /.pybuild +pip-wheel-metadata/ # Installer logs pip-log.txt @@ -64,3 +65,6 @@ coverage.xml # Sphinx documentation doc/_build/ + +# PyCharm +.idea/ From 38b216d71812381d731def898187fca4c78a2b61 Mon Sep 17 00:00:00 2001 From: David Hirschfeld Date: Wed, 4 Dec 2019 21:10:38 +1000 Subject: [PATCH 044/157] Improve module AttributeError message --- trio/_deprecate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trio/_deprecate.py b/trio/_deprecate.py index 8f7fc56118..b1362cbc38 100644 --- a/trio/_deprecate.py +++ b/trio/_deprecate.py @@ -122,7 +122,8 @@ def __getattr__(self, name): ) return info.value - raise AttributeError(name) + msg = "module '{}' has no attribute '{}'" + raise AttributeError(msg.format(self.__name__, name)) def enable_attribute_deprecations(module_name): From 6eb2ec518f5d5c661cc01364e495293d6fa3ec8c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2019 05:34:26 +0000 Subject: [PATCH 045/157] Bump more-itertools from 8.0.0 to 8.0.1 Bumps [more-itertools](https://github.com/erikrose/more-itertools) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/erikrose/more-itertools/releases) - [Commits](https://github.com/erikrose/more-itertools/compare/v8.0.0...v8.0.1) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 558adcb323..bab429a230 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -23,7 +23,7 @@ isort==4.3.21 # via pylint jedi==0.15.1 lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint -more-itertools==8.0.0 # via pytest +more-itertools==8.0.1 # via pytest outcome==1.0.1 packaging==19.2 # via pytest parso==0.5.1 # via jedi From e2308d8d3caf9a6d584e2b1519f5dfc8dcbfc3a5 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2019 05:53:12 +0000 Subject: [PATCH 046/157] Bump more-itertools from 8.0.1 to 8.0.2 Bumps [more-itertools](https://github.com/erikrose/more-itertools) from 8.0.1 to 8.0.2. - [Release notes](https://github.com/erikrose/more-itertools/releases) - [Commits](https://github.com/erikrose/more-itertools/compare/v8.0.1...v8.0.2) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index bab429a230..678cd83b6b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -23,7 +23,7 @@ isort==4.3.21 # via pylint jedi==0.15.1 lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint -more-itertools==8.0.1 # via pytest +more-itertools==8.0.2 # via pytest outcome==1.0.1 packaging==19.2 # via pytest parso==0.5.1 # via jedi From 6b57dbf9365625a45ad3267c69f02ab86c242502 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2019 05:38:28 +0000 Subject: [PATCH 047/157] Bump astor from 0.8.0 to 0.8.1 Bumps [astor](https://github.com/berkerpeksag/astor) from 0.8.0 to 0.8.1. - [Release notes](https://github.com/berkerpeksag/astor/releases) - [Changelog](https://github.com/berkerpeksag/astor/blob/master/docs/changelog.rst) - [Commits](https://github.com/berkerpeksag/astor/compare/0.8...0.8.1) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 678cd83b6b..7b083566de 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,7 @@ # # pip-compile --output-file test-requirements.txt test-requirements.in # -astor==0.8.0 +astor==0.8.1 astroid==2.3.3 # via pylint async-generator==1.10 attrs==19.3.0 From 0d548568c9eb757f3aa86302ce7e19e3f7567ae6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2019 06:12:37 +0000 Subject: [PATCH 048/157] Bump sphinx from 2.2.2 to 2.3.0 Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 2.2.2 to 2.3.0. - [Release notes](https://github.com/sphinx-doc/sphinx/releases) - [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinx/compare/v2.2.2...v2.3.0) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 56f7d7e619..f5dd5d7ac5 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -29,7 +29,7 @@ sniffio==1.1.0 snowballstemmer==2.0.0 # via sphinx sortedcontainers==2.1.0 sphinx-rtd-theme==0.4.3 -sphinx==2.2.2 +sphinx==2.3.0 sphinxcontrib-applehelp==1.0.1 # via sphinx sphinxcontrib-devhelp==1.0.1 # via sphinx sphinxcontrib-htmlhelp==1.0.2 # via sphinx From b8d1862689b4f3f4f8400bd1845edbeb83cdadb2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2019 06:13:39 +0000 Subject: [PATCH 049/157] Bump parso from 0.5.1 to 0.5.2 Bumps [parso](https://github.com/davidhalter/parso) from 0.5.1 to 0.5.2. - [Release notes](https://github.com/davidhalter/parso/releases) - [Changelog](https://github.com/davidhalter/parso/blob/master/CHANGELOG.rst) - [Commits](https://github.com/davidhalter/parso/compare/v0.5.1...v0.5.2) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 7b083566de..664bc24c33 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -26,7 +26,7 @@ mccabe==0.6.1 # via flake8, pylint more-itertools==8.0.2 # via pytest outcome==1.0.1 packaging==19.2 # via pytest -parso==0.5.1 # via jedi +parso==0.5.2 # via jedi pexpect==4.7.0 # via ipython pickleshare==0.7.5 # via ipython pluggy==0.13.1 # via pytest From e987402da412eb89e062b620bf2dc3a9c9149da9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2019 06:34:44 +0000 Subject: [PATCH 050/157] Bump pytest from 5.3.1 to 5.3.2 Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.3.1 to 5.3.2. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/5.3.1...5.3.2) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 664bc24c33..3013d76790 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -41,7 +41,7 @@ pylint==2.4.2 pyopenssl==19.1.0 pyparsing==2.4.5 # via packaging pytest-cov==2.8.1 -pytest==5.3.1 +pytest==5.3.2 six==1.13.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets sniffio==1.1.0 sortedcontainers==2.1.0 From 98a1ca347761edc6f8fdee5960ed10efde9b52c6 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 26 Nov 2018 09:04:14 +0400 Subject: [PATCH 051/157] ci: re-enable 3.8-dev coverage reports --- ci.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ci.sh b/ci.sh index a0fc87387b..21dc467ca8 100755 --- a/ci.sh +++ b/ci.sh @@ -267,14 +267,10 @@ else netsh winsock reset fi - # Disable coverage on 3.8 until we run 3.8 on Windows CI too - # https://github.com/python-trio/trio/pull/784#issuecomment-446438407 - if [[ "$(python -V)" = Python\ 3.8* ]]; then - true; # coverage is broken in pypy3 7.1.1, but is fixed in nightly and should be # fixed in the next release after 7.1.1. # See: https://bitbucket.org/pypy/pypy/issues/2943/ - elif [[ "$TRAVIS_PYTHON_VERSION" = "pypy3" ]]; then + if [[ "$TRAVIS_PYTHON_VERSION" = "pypy3" ]]; then true; else # Flag pypy and cpython coverage differently, until it settles down... From 40df149a75c1045e3829af73c8150b542e8f3ea3 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 16 Dec 2019 16:47:08 +0400 Subject: [PATCH 052/157] De-sugar aiter_compat to fix Python 3.8 coverage Python 3.8 considers the `async def __aiter(*args, **kwargs)` line as a line to be covered, but as this code is not run under Python 3.8, it's not considered covered. Using the explicit decorator syntax fixes the issue. --- trio/_util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/trio/_util.py b/trio/_util.py index bfef624dab..9204b83349 100644 --- a/trio/_util.py +++ b/trio/_util.py @@ -72,10 +72,13 @@ def signal_raise(signum): if sys.version_info < (3, 5, 2): def aiter_compat(aiter_impl): - @wraps(aiter_impl) + # de-sugar decorator to fix Python 3.8 coverage issue + # https://github.com/python-trio/trio/pull/784#issuecomment-446438407 async def __aiter__(*args, **kwargs): return aiter_impl(*args, **kwargs) + __aiter__ = wraps(aiter_impl)(__aiter__) + return __aiter__ else: From 9095a7ddc906b87cac42237c6a832f8d7efbde28 Mon Sep 17 00:00:00 2001 From: Vincent Michel Date: Thu, 19 Dec 2019 17:45:07 +0100 Subject: [PATCH 053/157] Run the iteration for glob, rgblob and iterdir in a thread --- trio/_path.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trio/_path.py b/trio/_path.py index 89fa93a586..bbadf9d874 100644 --- a/trio/_path.py +++ b/trio/_path.py @@ -58,7 +58,9 @@ def iter_wrapper_factory(cls, meth_name): async def wrapper(self, *args, **kwargs): meth = getattr(self._wrapped, meth_name) func = partial(meth, *args, **kwargs) - items = await trio.to_thread.run_sync(func) + # Make sure that the full iteration is performed in the thread + # by converting the generator produced by pathlib into a list + items = await trio.to_thread.run_sync(lambda: list(func())) return (rewrap_path(item) for item in items) return wrapper From be930bca93f88752cb4f61e6e9e8e9fc0182c769 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2019 05:46:34 +0000 Subject: [PATCH 054/157] Bump trustme from 0.5.3 to 0.6.0 Bumps [trustme](https://github.com/python-trio/trustme) from 0.5.3 to 0.6.0. - [Release notes](https://github.com/python-trio/trustme/releases) - [Commits](https://github.com/python-trio/trustme/compare/v0.5.3...v0.6.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 3013d76790..8fba224d64 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -46,7 +46,7 @@ six==1.13.0 # via astroid, cryptography, packaging, prompt-toolkit sniffio==1.1.0 sortedcontainers==2.1.0 traitlets==4.3.3 # via ipython -trustme==0.5.3 +trustme==0.6.0 wcwidth==0.1.7 # via prompt-toolkit, pytest wrapt==1.11.2 # via astroid yapf==0.29.0 From e128f84ac7e5f9d8569e6fa52a365f3a12934874 Mon Sep 17 00:00:00 2001 From: Vincent Michel Date: Fri, 20 Dec 2019 11:21:59 +0100 Subject: [PATCH 055/157] Add missing newfragment for issue #1308 --- newsfragments/1308.bugfix.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 newsfragments/1308.bugfix.rst diff --git a/newsfragments/1308.bugfix.rst b/newsfragments/1308.bugfix.rst new file mode 100644 index 0000000000..db435e46c1 --- /dev/null +++ b/newsfragments/1308.bugfix.rst @@ -0,0 +1,9 @@ +A bug related to the following methods has been introduced in version 0.12.0: + +- `trio.Path.iterdir` +- `trio.Path.glob` +- `trio.Path.rglob` + +The iteration of the blocking generators produced by pathlib was performed in +the trio thread. With this fix, the previous behavior is restored: the blocking +generators are converted into lists in a thread dedicated to blocking IO calls. From 4b98bf4394e49eee0c6a6204adda3d16d9ea4b28 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2019 06:11:36 +0000 Subject: [PATCH 056/157] Bump sphinx from 2.3.0 to 2.3.1 Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 2.3.0 to 2.3.1. - [Release notes](https://github.com/sphinx-doc/sphinx/releases) - [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinx/compare/v2.3.0...v2.3.1) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index f5dd5d7ac5..2b60ed4072 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -29,7 +29,7 @@ sniffio==1.1.0 snowballstemmer==2.0.0 # via sphinx sortedcontainers==2.1.0 sphinx-rtd-theme==0.4.3 -sphinx==2.3.0 +sphinx==2.3.1 sphinxcontrib-applehelp==1.0.1 # via sphinx sphinxcontrib-devhelp==1.0.1 # via sphinx sphinxcontrib-htmlhelp==1.0.2 # via sphinx From e85519fceb80820215ff0115457ff5ca70f57dd1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2019 06:12:05 +0000 Subject: [PATCH 057/157] Bump jedi from 0.15.1 to 0.15.2 Bumps [jedi](https://github.com/davidhalter/jedi) from 0.15.1 to 0.15.2. - [Release notes](https://github.com/davidhalter/jedi/releases) - [Changelog](https://github.com/davidhalter/jedi/blob/master/CHANGELOG.rst) - [Commits](https://github.com/davidhalter/jedi/compare/v0.15.1...v0.15.2) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 8fba224d64..62f834b2e0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -20,7 +20,7 @@ immutables==0.11 ipython-genutils==0.2.0 # via traitlets ipython==7.9.0 isort==4.3.21 # via pylint -jedi==0.15.1 +jedi==0.15.2 lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint more-itertools==8.0.2 # via pytest From ffe417eb0f9e54bb3796ca90c1c3cea53be328ef Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 26 Dec 2019 05:46:16 +0000 Subject: [PATCH 058/157] Bump pyparsing from 2.4.5 to 2.4.6 Bumps [pyparsing](https://github.com/pyparsing/pyparsing) from 2.4.5 to 2.4.6. - [Release notes](https://github.com/pyparsing/pyparsing/releases) - [Changelog](https://github.com/pyparsing/pyparsing/blob/pyparsing_2.4.6/CHANGES) - [Commits](https://github.com/pyparsing/pyparsing/compare/pyparsing_2.4.5...pyparsing_2.4.6) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 2b60ed4072..e7a31e2feb 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -21,7 +21,7 @@ markupsafe==1.1.1 # via jinja2 outcome==1.0.1 packaging==19.2 # via sphinx pygments==2.5.2 # via sphinx -pyparsing==2.4.5 # via packaging +pyparsing==2.4.6 # via packaging pytz==2019.3 # via babel requests==2.22.0 # via sphinx six==1.13.0 # via packaging diff --git a/test-requirements.txt b/test-requirements.txt index 62f834b2e0..4b6192da3a 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -39,7 +39,7 @@ pyflakes==2.1.1 # via flake8 pygments==2.5.2 # via ipython pylint==2.4.2 pyopenssl==19.1.0 -pyparsing==2.4.5 # via packaging +pyparsing==2.4.6 # via packaging pytest-cov==2.8.1 pytest==5.3.2 six==1.13.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets From fafd1517e5b9bcec19ff2ea31e84b6a276dba4c3 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 27 Dec 2019 05:43:11 +0000 Subject: [PATCH 059/157] Bump imagesize from 1.1.0 to 1.2.0 Bumps [imagesize](https://github.com/shibukawa/imagesize_py) from 1.1.0 to 1.2.0. - [Release notes](https://github.com/shibukawa/imagesize_py/releases) - [Commits](https://github.com/shibukawa/imagesize_py/commits) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index e7a31e2feb..2774570876 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -13,7 +13,7 @@ chardet==3.0.4 # via requests click==7.0 # via towncrier docutils==0.15.2 # via sphinx idna==2.8 -imagesize==1.1.0 # via sphinx +imagesize==1.2.0 # via sphinx immutables==0.11 incremental==17.5.0 # via towncrier jinja2==2.10.3 # via sphinx, towncrier From 66eeccfd7bd2631e876a49d914431525f1c49a68 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2019 05:59:38 +0000 Subject: [PATCH 060/157] Bump py from 1.8.0 to 1.8.1 Bumps [py](https://github.com/pytest-dev/py) from 1.8.0 to 1.8.1. - [Release notes](https://github.com/pytest-dev/py/releases) - [Changelog](https://github.com/pytest-dev/py/blob/master/CHANGELOG) - [Commits](https://github.com/pytest-dev/py/compare/1.8.0...1.8.1) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 4b6192da3a..0b26bb1b64 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -32,7 +32,7 @@ pickleshare==0.7.5 # via ipython pluggy==0.13.1 # via pytest prompt-toolkit==2.0.10 # via ipython ptyprocess==0.6.0 # via pexpect -py==1.8.0 # via pytest +py==1.8.1 # via pytest pycodestyle==2.5.0 # via flake8 pycparser==2.19 # via cffi pyflakes==2.1.1 # via flake8 From fc5e6e11e2300514d3c1b8a7d03df359eb87342f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2020 06:02:26 +0000 Subject: [PATCH 061/157] Bump babel from 2.7.0 to 2.8.0 Bumps [babel](https://github.com/python-babel/babel) from 2.7.0 to 2.8.0. - [Release notes](https://github.com/python-babel/babel/releases) - [Changelog](https://github.com/python-babel/babel/blob/master/CHANGES) - [Commits](https://github.com/python-babel/babel/compare/v2.7.0...v2.8.0) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 2774570876..151a166815 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -7,7 +7,7 @@ alabaster==0.7.12 # via sphinx async-generator==1.10 attrs==19.3.0 -babel==2.7.0 # via sphinx +babel==2.8.0 # via sphinx certifi==2019.11.28 # via requests chardet==3.0.4 # via requests click==7.0 # via towncrier From cc520c05ae86c58e6f0c95daa559d759ea8855cb Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2020 05:38:20 +0000 Subject: [PATCH 062/157] Bump wcwidth from 0.1.7 to 0.1.8 Bumps [wcwidth](https://github.com/jquast/wcwidth) from 0.1.7 to 0.1.8. - [Release notes](https://github.com/jquast/wcwidth/releases) - [Commits](https://github.com/jquast/wcwidth/compare/0.1.7...0.1.8) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 0b26bb1b64..9b63fc8e39 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -47,6 +47,6 @@ sniffio==1.1.0 sortedcontainers==2.1.0 traitlets==4.3.3 # via ipython trustme==0.6.0 -wcwidth==0.1.7 # via prompt-toolkit, pytest +wcwidth==0.1.8 # via prompt-toolkit, pytest wrapt==1.11.2 # via astroid yapf==0.29.0 From 5beb047bf880302e863451b6ece3e8ce92237b81 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2020 05:44:36 +0000 Subject: [PATCH 063/157] Bump packaging from 19.2 to 20.0 Bumps [packaging](https://github.com/pypa/packaging) from 19.2 to 20.0. - [Release notes](https://github.com/pypa/packaging/releases) - [Changelog](https://github.com/pypa/packaging/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pypa/packaging/compare/19.2...20.0) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 151a166815..d42dc23a88 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -19,7 +19,7 @@ incremental==17.5.0 # via towncrier jinja2==2.10.3 # via sphinx, towncrier markupsafe==1.1.1 # via jinja2 outcome==1.0.1 -packaging==19.2 # via sphinx +packaging==20.0 # via sphinx pygments==2.5.2 # via sphinx pyparsing==2.4.6 # via packaging pytz==2019.3 # via babel diff --git a/test-requirements.txt b/test-requirements.txt index 9b63fc8e39..81180c20c7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -25,7 +25,7 @@ lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint more-itertools==8.0.2 # via pytest outcome==1.0.1 -packaging==19.2 # via pytest +packaging==20.0 # via pytest parso==0.5.2 # via jedi pexpect==4.7.0 # via ipython pickleshare==0.7.5 # via ipython From 6d41f45778254ff86a5727010ac26ed1ce4c4941 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Mon, 13 Jan 2020 09:46:24 +0100 Subject: [PATCH 064/157] Add note about cancellation and memory channels --- trio/_channel.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/trio/_channel.py b/trio/_channel.py index 58802b585f..c902c485fa 100644 --- a/trio/_channel.py +++ b/trio/_channel.py @@ -27,6 +27,11 @@ def open_memory_channel(max_buffer_size): on a channel when there's no-one on the other side. See :ref:`channel-shutdown` for details. + Memory channel operations are all atomic with respect to + cancellation, either `~trio.abc.ReceiveChannel.receive` will + successfully return an object, or it will raise :exc:`Cancelled` + while leaving the channel unchanged. + Args: max_buffer_size (int or math.inf): The maximum number of items that can be buffered in the channel before :meth:`~trio.abc.SendChannel.send` From d2eaaf3ea08757e04fd4c7c796d81ba39541ac31 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Mon, 13 Jan 2020 23:00:06 -0500 Subject: [PATCH 065/157] Remove extraneous 'to' in async file I/O explanation --- docs/source/reference-io.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/reference-io.rst b/docs/source/reference-io.rst index 48f19074ae..b726e3fa72 100644 --- a/docs/source/reference-io.rst +++ b/docs/source/reference-io.rst @@ -479,7 +479,7 @@ you can `jump down to the API overview Background: Why is async file I/O useful? The answer may surprise you ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Many people expect that switching to from synchronous file I/O to +Many people expect that switching from synchronous file I/O to async file I/O will always make their program faster. This is not true! If we just look at total throughput, then async file I/O might be faster, slower, or about the same, and it depends in a complicated From 9c75468a746833eef5a153f286f4989a39441e7e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2020 05:52:07 +0000 Subject: [PATCH 066/157] Bump six from 1.13.0 to 1.14.0 Bumps [six](https://github.com/benjaminp/six) from 1.13.0 to 1.14.0. - [Release notes](https://github.com/benjaminp/six/releases) - [Changelog](https://github.com/benjaminp/six/blob/master/CHANGES) - [Commits](https://github.com/benjaminp/six/compare/1.13.0...1.14.0) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index d42dc23a88..840a5d8baa 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -24,7 +24,7 @@ pygments==2.5.2 # via sphinx pyparsing==2.4.6 # via packaging pytz==2019.3 # via babel requests==2.22.0 # via sphinx -six==1.13.0 # via packaging +six==1.14.0 # via packaging sniffio==1.1.0 snowballstemmer==2.0.0 # via sphinx sortedcontainers==2.1.0 diff --git a/test-requirements.txt b/test-requirements.txt index 81180c20c7..7ab6821b0c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -42,7 +42,7 @@ pyopenssl==19.1.0 pyparsing==2.4.6 # via packaging pytest-cov==2.8.1 pytest==5.3.2 -six==1.13.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets +six==1.14.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets sniffio==1.1.0 sortedcontainers==2.1.0 traitlets==4.3.3 # via ipython From c8a41275672660d3d8d4215f21eabf8c1a947391 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2020 06:19:36 +0000 Subject: [PATCH 067/157] Bump pytest from 5.3.2 to 5.3.3 Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.3.2 to 5.3.3. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/5.3.2...5.3.3) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 7ab6821b0c..c91ae62789 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -41,7 +41,7 @@ pylint==2.4.2 pyopenssl==19.1.0 pyparsing==2.4.6 # via packaging pytest-cov==2.8.1 -pytest==5.3.2 +pytest==5.3.3 six==1.14.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets sniffio==1.1.0 sortedcontainers==2.1.0 From 6654523c1e1b75c948d2c974fe73decc49414771 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2020 06:05:39 +0000 Subject: [PATCH 068/157] Bump packaging from 20.0 to 20.1 Bumps [packaging](https://github.com/pypa/packaging) from 20.0 to 20.1. - [Release notes](https://github.com/pypa/packaging/releases) - [Changelog](https://github.com/pypa/packaging/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pypa/packaging/compare/20.0...20.1) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 840a5d8baa..0528f0d0f0 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -19,7 +19,7 @@ incremental==17.5.0 # via towncrier jinja2==2.10.3 # via sphinx, towncrier markupsafe==1.1.1 # via jinja2 outcome==1.0.1 -packaging==20.0 # via sphinx +packaging==20.1 # via sphinx pygments==2.5.2 # via sphinx pyparsing==2.4.6 # via packaging pytz==2019.3 # via babel diff --git a/test-requirements.txt b/test-requirements.txt index c91ae62789..628440707a 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -25,7 +25,7 @@ lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint more-itertools==8.0.2 # via pytest outcome==1.0.1 -packaging==20.0 # via pytest +packaging==20.1 # via pytest parso==0.5.2 # via jedi pexpect==4.7.0 # via ipython pickleshare==0.7.5 # via ipython From e62e8cf2e5e171ac9646ca4cd4f0f890771cd802 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2020 06:13:16 +0000 Subject: [PATCH 069/157] Bump pexpect from 4.7.0 to 4.8.0 Bumps [pexpect](https://github.com/pexpect/pexpect) from 4.7.0 to 4.8.0. - [Release notes](https://github.com/pexpect/pexpect/releases) - [Commits](https://github.com/pexpect/pexpect/compare/4.7.0...4.8.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 628440707a..272b2e8760 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -27,7 +27,7 @@ more-itertools==8.0.2 # via pytest outcome==1.0.1 packaging==20.1 # via pytest parso==0.5.2 # via jedi -pexpect==4.7.0 # via ipython +pexpect==4.8.0 # via ipython pickleshare==0.7.5 # via ipython pluggy==0.13.1 # via pytest prompt-toolkit==2.0.10 # via ipython From 9d2aad636eadece4cb440f39b9199842d570a0db Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2020 06:28:45 +0000 Subject: [PATCH 070/157] Bump pytest from 5.3.3 to 5.3.4 Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.3.3 to 5.3.4. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/5.3.3...5.3.4) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 272b2e8760..e146c7b510 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -41,7 +41,7 @@ pylint==2.4.2 pyopenssl==19.1.0 pyparsing==2.4.6 # via packaging pytest-cov==2.8.1 -pytest==5.3.3 +pytest==5.3.4 six==1.14.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets sniffio==1.1.0 sortedcontainers==2.1.0 From 23594765e9a04835d40021ff97429fb876072445 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2020 06:28:52 +0000 Subject: [PATCH 071/157] Bump more-itertools from 8.0.2 to 8.1.0 Bumps [more-itertools](https://github.com/erikrose/more-itertools) from 8.0.2 to 8.1.0. - [Release notes](https://github.com/erikrose/more-itertools/releases) - [Commits](https://github.com/erikrose/more-itertools/compare/v8.0.2...v8.1.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 272b2e8760..093a12e849 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -23,7 +23,7 @@ isort==4.3.21 # via pylint jedi==0.15.2 lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint -more-itertools==8.0.2 # via pytest +more-itertools==8.1.0 # via pytest outcome==1.0.1 packaging==20.1 # via pytest parso==0.5.2 # via jedi From a2f33e96bd60e7946a1f56bee59b41c46401e324 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2020 07:00:16 +0000 Subject: [PATCH 072/157] Bump jedi from 0.15.2 to 0.16.0 Bumps [jedi](https://github.com/davidhalter/jedi) from 0.15.2 to 0.16.0. - [Release notes](https://github.com/davidhalter/jedi/releases) - [Changelog](https://github.com/davidhalter/jedi/blob/master/CHANGELOG.rst) - [Commits](https://github.com/davidhalter/jedi/compare/v0.15.2...v0.16.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 72262e33f6..2f7a3fd5f1 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -20,7 +20,7 @@ immutables==0.11 ipython-genutils==0.2.0 # via traitlets ipython==7.9.0 isort==4.3.21 # via pylint -jedi==0.15.2 +jedi==0.16.0 lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint more-itertools==8.1.0 # via pytest From c0ec7670219cac014e85db09ed9428736fb72e10 Mon Sep 17 00:00:00 2001 From: Jay Tuckey Date: Mon, 27 Jan 2020 20:48:49 +0930 Subject: [PATCH 073/157] Starting an awesome-trio list (#1262) Co-authored-by: Nathaniel J. Smith --- docs/source/awesome-trio-libraries.rst | 80 ++++++++++++++++++++++++++ docs/source/index.rst | 1 + 2 files changed, 81 insertions(+) create mode 100644 docs/source/awesome-trio-libraries.rst diff --git a/docs/source/awesome-trio-libraries.rst b/docs/source/awesome-trio-libraries.rst new file mode 100644 index 0000000000..03b5a901a3 --- /dev/null +++ b/docs/source/awesome-trio-libraries.rst @@ -0,0 +1,80 @@ +Awesome Trio Libraries +====================== + +.. List of Trio Libraries + + A list of libraries that support Trio, similar to the awesome-python + list here: https://github.com/vinta/awesome-python/ + + +.. currentmodule:: trio + +You have completed the tutorial, and are enthusiastic about building +great new applications and libraries with async functionality. +However, to get much useful work done you will want to use some of +the great libraries that support Trio-flavoured concurrency. This list +is not complete, but gives a starting point. Another great way to find +Trio-compatible libraries is to search on PyPI for the ``Framework :: Trio`` +tag -> `PyPI Search `__ + + +Getting Started +--------------- +* `cookiecutter-trio `__ - This is a cookiecutter template for Python projects that use Trio. It makes it easy to start a new project, by providing a bunch of preconfigured boilerplate. +* `pytest-trio `__ - Pytest plugin to test async-enabled Trio functions. +* `sphinxcontrib-trio `__ - Make Sphinx better at documenting Python functions and methods. In particular, it makes it easy to document async functions. + + +Web and HTML +------------ +* `asks `__ - asks is an async requests-like http library. +* `trio-websocket `__ - This library implements the WebSocket protocol, striving for safety, correctness, and ergonomics. +* `quart-trio `__ - Like Flask, but for Trio. A simple and powerful framework for building async web applications and REST APIs. Tip: this is an ASGI-based framework, so you'll also need an HTTP server with ASGI support. +* `hypercorn `__ - An HTTP server for hosting your ASGI apps. Supports HTTP/1.1, HTTP/2, HTTP/3, and Websockets. Can be run as a standalone server, or embedded in a larger Trio app. Use it with ``quart-trio``, or any other Trio-compatible ASGI framework. + + +Database +-------- + +* `triopg `__ - PostgreSQL client for Trio based on asyncpg. +* `trio-mysql `__ - Pure Python MySQL Client. +* `sqlalchemy_aio `__ - Add asyncio and Trio support to SQLAlchemy core, derived from alchimia. + + +IOT +--- +* `DistMQTT `__ - DistMQTT is an open source MQTT client and broker implementation. It is a fork of hbmqtt with support for anyio and DistKV. + + +Building Command Line Apps +-------------------------- +* `trio-click `__ - Python composable command line utility, trio-compatible version. +* `urwid `__ - Urwid is a console user interface library for Python. + + +Multi-Core/Multiprocessing +-------------------------- +* `tractor `__ - tractor is an attempt to bring trionic structured concurrency to distributed multi-core Python. +* `Trio run_in_process `__ - Trio based API for running code in a separate process. + + +Testing +------- +* `pytest-trio `__ - Pytest plugin for trio. +* `hypothesis-trio `__ - Hypothesis plugin for trio. +* `trustme `__ - #1 quality TLS certs while you wait, for the discerning tester. + + +Tools and Utilities +------------------- +* `trio-typing `__ - Type hints for Trio and related projects. +* `trio-util `__ - An assortment of utilities for the Trio async/await framework. +* `tricycle `__ - This is a library of interesting-but-maybe-not-yet-fully-proven extensions to Trio. + + +Trio/Asyncio Interoperability +----------------------------- +* `anyio `__ - AnyIO is a asynchronous compatibility API that allows applications and libraries written against it to run unmodified on asyncio, curio and trio. +* `sniffio `__ - This is a tiny package whose only purpose is to let you detect which async library your code is running under. +* `trio-asyncio `__ - Trio-Asyncio lets you use many asyncio libraries from your Trio app. + diff --git a/docs/source/index.rst b/docs/source/index.rst index a1395e3980..4f20067785 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -73,6 +73,7 @@ Vital statistics: :caption: Trio's friendly, yet comprehensive, manual: tutorial.rst + awesome-trio-libraries.rst reference-core.rst reference-io.rst reference-testing.rst From ddc7b5a3edfb34e141623e5a5b3c4fa3c4f83782 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2020 06:04:35 +0000 Subject: [PATCH 074/157] Bump jinja2 from 2.10.3 to 2.11.0 Bumps [jinja2](https://github.com/pallets/jinja) from 2.10.3 to 2.11.0. - [Release notes](https://github.com/pallets/jinja/releases) - [Changelog](https://github.com/pallets/jinja/blob/master/CHANGES.rst) - [Commits](https://github.com/pallets/jinja/compare/2.10.3...2.11.0) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 0528f0d0f0..b2097c2b0b 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -16,7 +16,7 @@ idna==2.8 imagesize==1.2.0 # via sphinx immutables==0.11 incremental==17.5.0 # via towncrier -jinja2==2.10.3 # via sphinx, towncrier +jinja2==2.11.0 # via sphinx, towncrier markupsafe==1.1.1 # via jinja2 outcome==1.0.1 packaging==20.1 # via sphinx From e1583e3e7481828f8f3dc15caded33a143904134 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2020 06:05:10 +0000 Subject: [PATCH 075/157] Bump parso from 0.5.2 to 0.6.0 Bumps [parso](https://github.com/davidhalter/parso) from 0.5.2 to 0.6.0. - [Release notes](https://github.com/davidhalter/parso/releases) - [Changelog](https://github.com/davidhalter/parso/blob/master/CHANGELOG.rst) - [Commits](https://github.com/davidhalter/parso/compare/v0.5.2...v0.6.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 2f7a3fd5f1..2ad7a46358 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -26,7 +26,7 @@ mccabe==0.6.1 # via flake8, pylint more-itertools==8.1.0 # via pytest outcome==1.0.1 packaging==20.1 # via pytest -parso==0.5.2 # via jedi +parso==0.6.0 # via jedi pexpect==4.8.0 # via ipython pickleshare==0.7.5 # via ipython pluggy==0.13.1 # via pytest From 87bf8534e036ed96cf4c1e489872f5e53cf40001 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 06:05:47 +0000 Subject: [PATCH 076/157] Bump urllib3 from 1.25.7 to 1.25.8 Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.25.7 to 1.25.8. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/master/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.25.7...1.25.8) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index b2097c2b0b..c7252f8a38 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -39,4 +39,4 @@ sphinxcontrib-serializinghtml==1.1.3 # via sphinx sphinxcontrib-trio==1.1.0 toml==0.10.0 # via towncrier towncrier==19.2.0 -urllib3==1.25.7 # via requests +urllib3==1.25.8 # via requests From 03c9872dffc102ab6f784d72b5662e7632ce24d7 Mon Sep 17 00:00:00 2001 From: jtrakk <43392409+jtrakk@users.noreply.github.com> Date: Wed, 29 Jan 2020 20:41:57 -0800 Subject: [PATCH 077/157] Add httpx --- docs/source/awesome-trio-libraries.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/awesome-trio-libraries.rst b/docs/source/awesome-trio-libraries.rst index 03b5a901a3..6824df0331 100644 --- a/docs/source/awesome-trio-libraries.rst +++ b/docs/source/awesome-trio-libraries.rst @@ -31,6 +31,7 @@ Web and HTML * `trio-websocket `__ - This library implements the WebSocket protocol, striving for safety, correctness, and ergonomics. * `quart-trio `__ - Like Flask, but for Trio. A simple and powerful framework for building async web applications and REST APIs. Tip: this is an ASGI-based framework, so you'll also need an HTTP server with ASGI support. * `hypercorn `__ - An HTTP server for hosting your ASGI apps. Supports HTTP/1.1, HTTP/2, HTTP/3, and Websockets. Can be run as a standalone server, or embedded in a larger Trio app. Use it with ``quart-trio``, or any other Trio-compatible ASGI framework. +* `httpx `__ - HTTPX is a fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2. Database From 0b84cd22ec4a514f6b998503df672f24d58eb406 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2020 05:58:30 +0000 Subject: [PATCH 078/157] Bump more-itertools from 8.1.0 to 8.2.0 Bumps [more-itertools](https://github.com/erikrose/more-itertools) from 8.1.0 to 8.2.0. - [Release notes](https://github.com/erikrose/more-itertools/releases) - [Commits](https://github.com/erikrose/more-itertools/compare/v8.1.0...v8.2.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 2ad7a46358..f1e66dc708 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -23,7 +23,7 @@ isort==4.3.21 # via pylint jedi==0.16.0 lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint -more-itertools==8.1.0 # via pytest +more-itertools==8.2.0 # via pytest outcome==1.0.1 packaging==20.1 # via pytest parso==0.6.0 # via jedi From 40216d231028d04eb167246773f507ec621eaebc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2020 06:06:09 +0000 Subject: [PATCH 079/157] Bump pytest from 5.3.4 to 5.3.5 Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.3.4 to 5.3.5. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/5.3.4...5.3.5) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index f1e66dc708..d4ca0457b6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -41,7 +41,7 @@ pylint==2.4.2 pyopenssl==19.1.0 pyparsing==2.4.6 # via packaging pytest-cov==2.8.1 -pytest==5.3.4 +pytest==5.3.5 six==1.14.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets sniffio==1.1.0 sortedcontainers==2.1.0 From e3a297b84b21c428de5307f4858441d9979afd7c Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 31 Jan 2020 10:47:13 +0400 Subject: [PATCH 080/157] Add new Python 3.8 socket constants --- trio/socket.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trio/socket.py b/trio/socket.py index bd6758af17..266fc0dbda 100644 --- a/trio/socket.py +++ b/trio/socket.py @@ -105,7 +105,8 @@ CAN_BCM_RX_RTR_FRAME, CAN_BCM_SETTIMER, CAN_BCM_STARTTIMER, CAN_BCM_TX_ANNOUNCE, CAN_BCM_TX_COUNTEVT, CAN_BCM_TX_CP_CAN_ID, CAN_BCM_TX_RESET_MULTI_IDX, IPPROTO_CBT, IPPROTO_ICLFXBM, IPPROTO_IGP, - IPPROTO_L2TP, IPPROTO_PGM, IPPROTO_RDP, IPPROTO_ST + IPPROTO_L2TP, IPPROTO_PGM, IPPROTO_RDP, IPPROTO_ST, AF_QIPCRTR, + CAN_BCM_CAN_FD_FRAME ) except ImportError: pass From d125b6e2c5489b3dd838370a094673635d294601 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2020 08:36:03 +0000 Subject: [PATCH 081/157] Bump jinja2 from 2.11.0 to 2.11.1 Bumps [jinja2](https://github.com/pallets/jinja) from 2.11.0 to 2.11.1. - [Release notes](https://github.com/pallets/jinja/releases) - [Changelog](https://github.com/pallets/jinja/blob/master/CHANGES.rst) - [Commits](https://github.com/pallets/jinja/compare/2.11.0...2.11.1) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index c7252f8a38..0d4282bd72 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -16,7 +16,7 @@ idna==2.8 imagesize==1.2.0 # via sphinx immutables==0.11 incremental==17.5.0 # via towncrier -jinja2==2.11.0 # via sphinx, towncrier +jinja2==2.11.1 # via sphinx, towncrier markupsafe==1.1.1 # via jinja2 outcome==1.0.1 packaging==20.1 # via sphinx From fdb85dff56ed3bfe5bf47b9462e9f987f632b24d Mon Sep 17 00:00:00 2001 From: jtrakk <43392409+jtrakk@users.noreply.github.com> Date: Sat, 1 Feb 2020 00:52:56 -0800 Subject: [PATCH 082/157] Add asyncgpio (trio-gpio) --- docs/source/awesome-trio-libraries.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/source/awesome-trio-libraries.rst b/docs/source/awesome-trio-libraries.rst index 6824df0331..4ef79edf3d 100644 --- a/docs/source/awesome-trio-libraries.rst +++ b/docs/source/awesome-trio-libraries.rst @@ -45,6 +45,9 @@ Database IOT --- * `DistMQTT `__ - DistMQTT is an open source MQTT client and broker implementation. It is a fork of hbmqtt with support for anyio and DistKV. +* `asyncgpio `__ - Allows easy access to the GPIO pins on your Raspberry Pi or similar embedded computer. + + Building Command Line Apps From aec32bbd7ceb823e043ff53eb6c24455b3d3e85d Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 4 Feb 2020 09:50:35 +0400 Subject: [PATCH 083/157] Fix travis config warnings --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8ae5d0445f..fb53c4fbbb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ +os: linux language: python dist: xenial -matrix: +jobs: include: # The pypy tests are slow, so we list them first - python: pypy3 From 884f7231ee0224ce64412ddc96bf07bf0369bed6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2020 05:59:00 +0000 Subject: [PATCH 084/157] Bump parso from 0.6.0 to 0.6.1 Bumps [parso](https://github.com/davidhalter/parso) from 0.6.0 to 0.6.1. - [Release notes](https://github.com/davidhalter/parso/releases) - [Changelog](https://github.com/davidhalter/parso/blob/master/CHANGELOG.rst) - [Commits](https://github.com/davidhalter/parso/compare/v0.6.0...v0.6.1) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index d4ca0457b6..4ead6b54e5 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -26,7 +26,7 @@ mccabe==0.6.1 # via flake8, pylint more-itertools==8.2.0 # via pytest outcome==1.0.1 packaging==20.1 # via pytest -parso==0.6.0 # via jedi +parso==0.6.1 # via jedi pexpect==4.8.0 # via ipython pickleshare==0.7.5 # via ipython pluggy==0.13.1 # via pytest From 159679ce918659206ef70edbe383de7d4cef14db Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 4 Feb 2020 09:57:47 +0400 Subject: [PATCH 085/157] Use PyPy 7.2 --- .travis.yml | 4 ++-- ci.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index fb53c4fbbb..685b4a8e93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ os: linux language: python -dist: xenial +dist: bionic jobs: include: # The pypy tests are slow, so we list them first - - python: pypy3 + - python: pypy3.6-7.2.0 - language: generic env: PYPY_NIGHTLY_BRANCH=py3.6 # Qemu tests are also slow diff --git a/ci.sh b/ci.sh index 21dc467ca8..9bfdc56bb7 100755 --- a/ci.sh +++ b/ci.sh @@ -275,7 +275,7 @@ else else # Flag pypy and cpython coverage differently, until it settles down... FLAG="cpython" - if [[ "$PYPY_NIGHTLY_BRANCH" == "py3.6" ]]; then + if [[ "$PYPY_NIGHTLY_BRANCH" == "py3.8" ]]; then FLAG="pypy36nightly" elif [[ "$(python -V)" == *PyPy* ]]; then FLAG="pypy36release" From fb2cd8d45c389a5a368af73f10922b5b025ed09a Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 4 Feb 2020 10:11:21 +0400 Subject: [PATCH 086/157] Remove PyPy coverage workaround The bug is now fixed. --- ci.sh | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/ci.sh b/ci.sh index 9bfdc56bb7..6a202cb3be 100755 --- a/ci.sh +++ b/ci.sh @@ -267,26 +267,12 @@ else netsh winsock reset fi - # coverage is broken in pypy3 7.1.1, but is fixed in nightly and should be - # fixed in the next release after 7.1.1. - # See: https://bitbucket.org/pypy/pypy/issues/2943/ - if [[ "$TRAVIS_PYTHON_VERSION" = "pypy3" ]]; then - true; - else - # Flag pypy and cpython coverage differently, until it settles down... - FLAG="cpython" - if [[ "$PYPY_NIGHTLY_BRANCH" == "py3.8" ]]; then - FLAG="pypy36nightly" - elif [[ "$(python -V)" == *PyPy* ]]; then - FLAG="pypy36release" - fi - # It's more common to do - # bash <(curl ...) - # but azure is broken: - # https://developercommunity.visualstudio.com/content/problem/743824/bash-task-on-windows-suddenly-fails-with-bash-devf.html - curl-harder -o codecov.sh https://codecov.io/bash - bash codecov.sh -n "${JOB_NAME}" -F "$FLAG" - fi + # It's more common to do + # bash <(curl ...) + # but azure is broken: + # https://developercommunity.visualstudio.com/content/problem/743824/bash-task-on-windows-suddenly-fails-with-bash-devf.html + curl-harder -o codecov.sh https://codecov.io/bash + bash codecov.sh -n "${JOB_NAME}" $PASSED fi From 46b4510f5b9eec41be8f4da36a1e602804d9c877 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 5 Feb 2020 15:55:15 +0400 Subject: [PATCH 087/157] Add back cffi on install_requires The wheel bug was fixed in 2017 by setuptools. --- setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 45964b34b2..ff8fdfd7d1 100644 --- a/setup.py +++ b/setup.py @@ -85,9 +85,7 @@ "idna", "outcome", "sniffio", - # PEP 508 style, but: - # https://bitbucket.org/pypa/wheel/issues/181/bdist_wheel-silently-discards-pep-508 - #"cffi; os_name == 'nt'", # "cffi is required on windows" + "cffi; os_name == 'nt'", # "cffi is required on windows" ], # This means, just install *everything* you see under trio/, even if it # doesn't look like a source file, so long as it appears in MANIFEST.in: From 42edaa34da43693395e28817a4e8f432d02a36c3 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 5 Feb 2020 16:53:43 +0400 Subject: [PATCH 088/157] Only use install_requires to specify deps --- setup.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index ff8fdfd7d1..f0da74c434 100644 --- a/setup.py +++ b/setup.py @@ -85,20 +85,13 @@ "idna", "outcome", "sniffio", - "cffi; os_name == 'nt'", # "cffi is required on windows" + # cffi 1.12 adds from_buffer(require_writable=True) and ffi.release() + "cffi>=1.12; os_name == 'nt'", # "cffi is required on windows" + "contextvars>=2.1; python_version < '3.7'" ], # This means, just install *everything* you see under trio/, even if it # doesn't look like a source file, so long as it appears in MANIFEST.in: include_package_data=True, - # Quirky bdist_wheel-specific way: - # https://wheel.readthedocs.io/en/latest/#defining-conditional-dependencies - # also supported by pip and setuptools, as long as they're vaguely - # recent - extras_require={ - # cffi 1.12 adds from_buffer(require_writable=True) and ffi.release() - ":os_name == 'nt'": ["cffi >= 1.12"], # "cffi is required on windows", - ":python_version < '3.7'": ["contextvars>=2.1"] - }, python_requires=">=3.5", keywords=["async", "io", "networking", "trio"], classifiers=[ From ae82c94ca86d1f7678e9020dbeeadb89f9612a53 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Thu, 6 Feb 2020 13:33:08 +0400 Subject: [PATCH 089/157] Run Azure CI on branches too It's useful to test branches in forks before submitting a pull request. It also mirrors the Travis configuration. --- azure-pipelines.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a6c84408c1..dabc5cb2d2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,8 +1,7 @@ -# Will want to adjust this if we ever start having non-master branches -# in the main repo: -# https://docs.microsoft.com/en-us/azure/devops/pipelines/build/triggers trigger: - - master + branches: + exclude: + - 'dependabot/*' jobs: From 1cc529096607c948d9872f8da8f5c082d6642a62 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 7 Feb 2020 02:04:40 +0400 Subject: [PATCH 090/157] ci: use bash <(curl ...) again (#1393) The Azure Pipelines bug is now fixed. --- ci.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ci.sh b/ci.sh index 6a202cb3be..63f1355b3e 100755 --- a/ci.sh +++ b/ci.sh @@ -267,12 +267,7 @@ else netsh winsock reset fi - # It's more common to do - # bash <(curl ...) - # but azure is broken: - # https://developercommunity.visualstudio.com/content/problem/743824/bash-task-on-windows-suddenly-fails-with-bash-devf.html - curl-harder -o codecov.sh https://codecov.io/bash - bash codecov.sh -n "${JOB_NAME}" + bash <(curl-harder -o codecov.sh https://codecov.io/bash) -n "${JOB_NAME}" $PASSED fi From 388c792d11bc75ddb6067075dddf221760862cd0 Mon Sep 17 00:00:00 2001 From: lewoudar Date: Sun, 9 Feb 2020 19:28:19 +0100 Subject: [PATCH 091/157] Update various errors/typos in rst documentation and docstrings --- docs/source/reference-core.rst | 2 +- docs/source/reference-testing.rst | 2 +- trio/_abc.py | 2 +- trio/_core/_generated_run.py | 8 ++++---- trio/_highlevel_open_tcp_stream.py | 2 +- trio/_highlevel_ssl_helpers.py | 2 +- trio/_sync.py | 2 +- trio/testing/_memory_streams.py | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/source/reference-core.rst b/docs/source/reference-core.rst index 09266a9986..f13d3440cb 100644 --- a/docs/source/reference-core.rst +++ b/docs/source/reference-core.rst @@ -1351,7 +1351,7 @@ after an hour, that grows to ~32,400. Eventually, the program will run out of memory. And well before we run out of memory, our latency on handling individual messages will become abysmal. For example, at the one minute mark, the producer is sending message ~600, but the -producer is still processing message ~60. Message 600 will have to sit +consumer is still processing message ~60. Message 600 will have to sit in the channel for ~9 minutes before the consumer catches up and processes it. diff --git a/docs/source/reference-testing.rst b/docs/source/reference-testing.rst index e6ddde2156..40a275bbeb 100644 --- a/docs/source/reference-testing.rst +++ b/docs/source/reference-testing.rst @@ -118,7 +118,7 @@ some interesting hooks you can set, that let you customize the behavior of their methods. This is where you can insert the evil, if you want it. :func:`memory_stream_one_way_pair` takes advantage of these hooks in a relatively boring way: it just sets it up so that -when you call ``sendall``, or when you close the send stream, then it +when you call ``send_all``, or when you close the send stream, then it automatically triggers a call to :func:`memory_stream_pump`, which is a convenience function that takes data out of a :class:`MemorySendStream`\´s buffer and puts it into a diff --git a/trio/_abc.py b/trio/_abc.py index 675eb5dd9e..88c2ff1f70 100644 --- a/trio/_abc.py +++ b/trio/_abc.py @@ -559,7 +559,7 @@ class SendChannel(AsyncResource, Generic[SendType]): with`` block. If you want to send raw bytes rather than Python objects, see - `ReceiveStream`. + `SendStream`. """ __slots__ = () diff --git a/trio/_core/_generated_run.py b/trio/_core/_generated_run.py index 9d9439ec76..834346c0bf 100644 --- a/trio/_core/_generated_run.py +++ b/trio/_core/_generated_run.py @@ -193,21 +193,21 @@ async def test_lock_fairness(): lock = trio.Lock() await lock.acquire() async with trio.open_nursery() as nursery: - child = nursery.start_soon(lock_taker, lock) + nursery.start_soon(lock_taker, lock) # child hasn't run yet, we have the lock assert lock.locked() - assert lock._owner is trio.current_task() + assert lock._owner is trio.hazmat.current_task() await trio.testing.wait_all_tasks_blocked() # now the child has run and is blocked on lock.acquire(), we # still have the lock assert lock.locked() - assert lock._owner is trio.current_task() + assert lock._owner is trio.hazmat.current_task() lock.release() try: # The child has a prior claim, so we can't have it lock.acquire_nowait() except trio.WouldBlock: - assert lock._owner is child + assert lock._owner is not trio.hazmat.current_task() print("PASS") else: print("FAIL") diff --git a/trio/_highlevel_open_tcp_stream.py b/trio/_highlevel_open_tcp_stream.py index 81c191e15c..71418b12d3 100644 --- a/trio/_highlevel_open_tcp_stream.py +++ b/trio/_highlevel_open_tcp_stream.py @@ -212,7 +212,7 @@ async def open_tcp_stream( connection attempt to succeed or fail before getting impatient and starting another one in parallel. Set to `math.inf` if you want to limit to only one connection attempt at a time (like - :func:`socket.create_connection`). Default: 0.3 (300 ms). + :func:`socket.create_connection`). Default: 0.25 (250 ms). Returns: SocketStream: a :class:`~trio.abc.Stream` connected to the given server. diff --git a/trio/_highlevel_ssl_helpers.py b/trio/_highlevel_ssl_helpers.py index ce78832087..9b68e942f4 100644 --- a/trio/_highlevel_ssl_helpers.py +++ b/trio/_highlevel_ssl_helpers.py @@ -84,7 +84,7 @@ async def open_ssl_over_tcp_listeners( host (str, bytes, or None): The address to bind to; use ``None`` to bind to the wildcard address. See :func:`open_tcp_listeners`. https_compatible (bool): See :class:`~trio.SSLStream` for details. - backlog (int or None): See :class:`~trio.SSLStream` for details. + backlog (int or None): See :func:`open_tcp_listeners` for details. """ tcp_listeners = await trio.open_tcp_listeners( diff --git a/trio/_sync.py b/trio/_sync.py index 58f01c1970..f34acd0858 100644 --- a/trio/_sync.py +++ b/trio/_sync.py @@ -739,7 +739,7 @@ def release(self): @enable_ki_protection async def wait(self): - """Wait for another thread to call :meth:`notify` or + """Wait for another task to call :meth:`notify` or :meth:`notify_all`. When calling this method, you must hold the lock. It releases the lock diff --git a/trio/testing/_memory_streams.py b/trio/testing/_memory_streams.py index ac70d561e9..d86e301888 100644 --- a/trio/testing/_memory_streams.py +++ b/trio/testing/_memory_streams.py @@ -393,7 +393,7 @@ def memory_stream_pair(): async def trickle(): # left is a StapledStream, and left.send_stream is a MemorySendStream # right is a StapledStream, and right.recv_stream is a MemoryReceiveStream - while memory_stream_pump(left.send_stream, right.recv_stream, max_byes=1): + while memory_stream_pump(left.send_stream, right.recv_stream, max_bytes=1): # Pause between each byte await trio.sleep(1) # Normally this send_all_hook calls memory_stream_pump directly without From b4572ceaca05b202d26f9bcc1ee3b858db93e4e7 Mon Sep 17 00:00:00 2001 From: lewoudar Date: Sun, 9 Feb 2020 19:38:56 +0100 Subject: [PATCH 092/157] Update error message in IO function open_tcp_listeners --- trio/_highlevel_open_tcp_listeners.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trio/_highlevel_open_tcp_listeners.py b/trio/_highlevel_open_tcp_listeners.py index 9120a45d18..2625238803 100644 --- a/trio/_highlevel_open_tcp_listeners.py +++ b/trio/_highlevel_open_tcp_listeners.py @@ -89,7 +89,7 @@ async def open_tcp_listeners(port, *, host=None, backlog=None): # doesn't: # http://klickverbot.at/blog/2012/01/getaddrinfo-edge-case-behavior-on-windows-linux-and-osx/ if not isinstance(port, int): - raise TypeError("port must be an int or str, not {!r}".format(port)) + raise TypeError("port must be an int not {!r}".format(port)) backlog = _compute_backlog(backlog) From ffc7a350f714073c5a12804aca6f75f3a54d5ed5 Mon Sep 17 00:00:00 2001 From: lewoudar Date: Sun, 9 Feb 2020 22:22:57 +0100 Subject: [PATCH 093/157] Update function open_unix_socket to check the type of filename argument Update related test file and docstring --- trio/_highlevel_open_unix_stream.py | 5 +++-- trio/tests/test_highlevel_open_unix_stream.py | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/trio/_highlevel_open_unix_stream.py b/trio/_highlevel_open_unix_stream.py index 5992c4f73e..456ae351c1 100644 --- a/trio/_highlevel_open_unix_stream.py +++ b/trio/_highlevel_open_unix_stream.py @@ -36,12 +36,13 @@ async def open_unix_socket(filename,): Raises: OSError: If the socket file could not be connected to. RuntimeError: If AF_UNIX sockets are not supported. + TypeError: if filename is not str or bytes. """ if not has_unix: raise RuntimeError("Unix sockets are not supported on this platform") - if filename is None: - raise ValueError("Filename cannot be None") + if not isinstance(filename, (str, bytes)): + raise TypeError("Filename must be str or bytes") # much more simplified logic vs tcp sockets - one socket type and only one # possible location to connect to diff --git a/trio/tests/test_highlevel_open_unix_stream.py b/trio/tests/test_highlevel_open_unix_stream.py index c66028b14f..872a43dd6d 100644 --- a/trio/tests/test_highlevel_open_unix_stream.py +++ b/trio/tests/test_highlevel_open_unix_stream.py @@ -30,6 +30,12 @@ def close(self): assert c.closed +@pytest.mark.parametrize('filename', [4, 4.5]) +async def test_open_with_bad_filename_type(filename): + with pytest.raises(TypeError): + await open_unix_socket(filename) + + async def test_open_bad_socket(): # mktemp is marked as insecure, but that's okay, we don't want the file to # exist From 4f048867814863a002f1ae3ce527f43f99ee20cb Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2020 06:16:58 +0000 Subject: [PATCH 094/157] Bump sphinx from 2.3.1 to 2.4.0 Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 2.3.1 to 2.4.0. - [Release notes](https://github.com/sphinx-doc/sphinx/releases) - [Changelog](https://github.com/sphinx-doc/sphinx/blob/2.0/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinx/compare/v2.3.1...v2.4.0) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 0d4282bd72..14ece8233c 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -29,7 +29,7 @@ sniffio==1.1.0 snowballstemmer==2.0.0 # via sphinx sortedcontainers==2.1.0 sphinx-rtd-theme==0.4.3 -sphinx==2.3.1 +sphinx==2.4.0 sphinxcontrib-applehelp==1.0.1 # via sphinx sphinxcontrib-devhelp==1.0.1 # via sphinx sphinxcontrib-htmlhelp==1.0.2 # via sphinx From df685721b782100641e6f31bf4ab0f2db3fe6828 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2020 06:17:42 +0000 Subject: [PATCH 095/157] Bump cffi from 1.13.2 to 1.14.0 Bumps [cffi](https://bitbucket.org/cffi/release-doc) from 1.13.2 to 1.14.0. - [Commits](https://bitbucket.org/cffi/release-doc/commits) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 4ead6b54e5..6638588778 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -9,7 +9,7 @@ astroid==2.3.3 # via pylint async-generator==1.10 attrs==19.3.0 backcall==0.1.0 # via ipython -cffi==1.13.2 +cffi==1.14.0 coverage==4.5.4 # via pytest-cov cryptography==2.8 # via pyopenssl, trustme decorator==4.4.1 # via ipython, traitlets From 75cd12a6c7b37ec118428426f24db4c78dbbef36 Mon Sep 17 00:00:00 2001 From: lewoudar Date: Tue, 11 Feb 2020 04:26:39 +0100 Subject: [PATCH 096/157] Add trio.Path to possible filename types --- trio/_highlevel_open_unix_stream.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trio/_highlevel_open_unix_stream.py b/trio/_highlevel_open_unix_stream.py index 456ae351c1..7a424729d0 100644 --- a/trio/_highlevel_open_unix_stream.py +++ b/trio/_highlevel_open_unix_stream.py @@ -41,8 +41,8 @@ async def open_unix_socket(filename,): if not has_unix: raise RuntimeError("Unix sockets are not supported on this platform") - if not isinstance(filename, (str, bytes)): - raise TypeError("Filename must be str or bytes") + if not isinstance(filename, (str, trio.Path, bytes)): + raise TypeError("Filename must be str, trio.Path or bytes") # much more simplified logic vs tcp sockets - one socket type and only one # possible location to connect to From d829456e66c948f35fa9f7b34eccffc97bce71e7 Mon Sep 17 00:00:00 2001 From: Davide Rizzo Date: Tue, 11 Feb 2020 13:54:36 +0100 Subject: [PATCH 097/157] fix docstring typo in to_thread_run_sync --- trio/_threads.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trio/_threads.py b/trio/_threads.py index 52c19ac486..e5ffb74b7c 100644 --- a/trio/_threads.py +++ b/trio/_threads.py @@ -210,7 +210,7 @@ async def to_thread_run_sync(sync_fn, *args, cancellable=False, limiter=None): background** – we just abandon it to do whatever it's going to do, and silently discard any return value or errors that it raises. Only use this if you know that the operation is safe and side-effect free. (For - example: :func:`trio.socket.getaddrinfo` is uses a thread with + example: :func:`trio.socket.getaddrinfo` uses a thread with ``cancellable=True``, because it doesn't really affect anything if a stray hostname lookup keeps running in the background.) From e8659acad6251b6a79e5db1fb5194796948fcb15 Mon Sep 17 00:00:00 2001 From: lewoudar Date: Tue, 11 Feb 2020 21:25:34 +0100 Subject: [PATCH 098/157] Change implementation to check filename type Remove TypeError in docstring --- trio/_highlevel_open_unix_stream.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/trio/_highlevel_open_unix_stream.py b/trio/_highlevel_open_unix_stream.py index 7a424729d0..59141ebc38 100644 --- a/trio/_highlevel_open_unix_stream.py +++ b/trio/_highlevel_open_unix_stream.py @@ -36,18 +36,14 @@ async def open_unix_socket(filename,): Raises: OSError: If the socket file could not be connected to. RuntimeError: If AF_UNIX sockets are not supported. - TypeError: if filename is not str or bytes. """ if not has_unix: raise RuntimeError("Unix sockets are not supported on this platform") - if not isinstance(filename, (str, trio.Path, bytes)): - raise TypeError("Filename must be str, trio.Path or bytes") - # much more simplified logic vs tcp sockets - one socket type and only one # possible location to connect to sock = socket(AF_UNIX, SOCK_STREAM) with close_on_error(sock): - await sock.connect(filename) + await sock.connect(trio._util.fspath(filename)) return trio.SocketStream(sock) From d642eb0fc9d9ed5e18a8415b6ff22ecb68aa6cf3 Mon Sep 17 00:00:00 2001 From: lewoudar Date: Tue, 11 Feb 2020 22:05:54 +0100 Subject: [PATCH 099/157] Update docstring of method Runner.wait_all_tasks_blocked update reference-io.rst documentation to set an alias for subprocess at the beginning of the file --- docs/source/reference-io.rst | 2 +- trio/_core/_run.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/source/reference-io.rst b/docs/source/reference-io.rst index b726e3fa72..7c700b1328 100644 --- a/docs/source/reference-io.rst +++ b/docs/source/reference-io.rst @@ -24,7 +24,7 @@ create complex transport configurations. Here's some examples: speak SSL over the network is to wrap an :class:`~trio.SSLStream` around a :class:`~trio.SocketStream`. -* If you spawn a :ref:`subprocess`, you can get a +* If you spawn a :ref:`subprocess `, you can get a :class:`~trio.abc.SendStream` that lets you write to its stdin, and a :class:`~trio.abc.ReceiveStream` that lets you read from its stdout. If for some reason you wanted to speak SSL to a subprocess, diff --git a/trio/_core/_run.py b/trio/_core/_run.py index faf4c1371b..9bb115dadc 100644 --- a/trio/_core/_run.py +++ b/trio/_core/_run.py @@ -1581,21 +1581,21 @@ async def test_lock_fairness(): lock = trio.Lock() await lock.acquire() async with trio.open_nursery() as nursery: - child = nursery.start_soon(lock_taker, lock) + nursery.start_soon(lock_taker, lock) # child hasn't run yet, we have the lock assert lock.locked() - assert lock._owner is trio.current_task() + assert lock._owner is trio.hazmat.current_task() await trio.testing.wait_all_tasks_blocked() # now the child has run and is blocked on lock.acquire(), we # still have the lock assert lock.locked() - assert lock._owner is trio.current_task() + assert lock._owner is trio.hazmat.current_task() lock.release() try: # The child has a prior claim, so we can't have it lock.acquire_nowait() except trio.WouldBlock: - assert lock._owner is child + assert lock._owner is not trio.hazmat.current_task() print("PASS") else: print("FAIL") From 327d6f4d772fdcc8b281a2da96a94cefdb9f70a0 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 12 Feb 2020 10:10:48 +0400 Subject: [PATCH 100/157] Allow dev builds to fail Until [0] is fully resolved. [0]: https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180 --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 685b4a8e93..d739635ff2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,12 @@ jobs: - python: 3.7-dev - python: 3.8-dev - python: nightly + allow_failures: + - python: 3.5-dev + - python: 3.6-dev + - python: 3.7-dev + - python: 3.8-dev + - python: nightly script: - ./ci.sh From c9bed40ff4d0c4ed858445666205f6a254ba9a6a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 12 Feb 2020 08:44:54 +0000 Subject: [PATCH 101/157] Bump sphinx from 2.4.0 to 2.4.1 Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 2.4.0 to 2.4.1. - [Release notes](https://github.com/sphinx-doc/sphinx/releases) - [Changelog](https://github.com/sphinx-doc/sphinx/blob/2.0/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinx/compare/v2.4.0...v2.4.1) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 14ece8233c..982d42bd74 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -29,7 +29,7 @@ sniffio==1.1.0 snowballstemmer==2.0.0 # via sphinx sortedcontainers==2.1.0 sphinx-rtd-theme==0.4.3 -sphinx==2.4.0 +sphinx==2.4.1 sphinxcontrib-applehelp==1.0.1 # via sphinx sphinxcontrib-devhelp==1.0.1 # via sphinx sphinxcontrib-htmlhelp==1.0.2 # via sphinx From 9f3581f27525c2d33b1ea95bc7722969d2148e39 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 12 Feb 2020 08:59:34 +0000 Subject: [PATCH 102/157] Bump docutils from 0.15.2 to 0.16 Bumps [docutils](http://docutils.sourceforge.net/) from 0.15.2 to 0.16. Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 982d42bd74..da58f29424 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -11,7 +11,7 @@ babel==2.8.0 # via sphinx certifi==2019.11.28 # via requests chardet==3.0.4 # via requests click==7.0 # via towncrier -docutils==0.15.2 # via sphinx +docutils==0.16 # via sphinx idna==2.8 imagesize==1.2.0 # via sphinx immutables==0.11 From a2dee48ac45ee05b608a78b55b7915fda7bb30a2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2020 09:14:39 +0000 Subject: [PATCH 103/157] Bump coverage from 4.5.4 to 5.0.3 Bumps [coverage](https://github.com/nedbat/coveragepy) from 4.5.4 to 5.0.3. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/coverage-4.5.4...coverage-5.0.3) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 6638588778..de5b20b3a5 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -10,7 +10,7 @@ async-generator==1.10 attrs==19.3.0 backcall==0.1.0 # via ipython cffi==1.14.0 -coverage==4.5.4 # via pytest-cov +coverage==5.0.3 # via pytest-cov cryptography==2.8 # via pyopenssl, trustme decorator==4.4.1 # via ipython, traitlets entrypoints==0.3 # via flake8 From 7c00db7889e373646288f8d5c9c9b6e584d33220 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 7 Feb 2020 13:20:11 +0400 Subject: [PATCH 104/157] Stop closing stdin in tests When FdStream(0) becomes unreachable, _FdHolder is garbage-collected and its __del__ is called, which closes the file descriptor. For some reason, with the combination of pytest-cov, coverage 5 with SQLite and macOS 10.14 on Azure Pipelines, the pytest process gets killed if we call os.close(0), which fails the CI. So let's avoid doing that. :) --- trio/tests/test_unix_pipes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trio/tests/test_unix_pipes.py b/trio/tests/test_unix_pipes.py index 46f28d5471..1157d78b5d 100644 --- a/trio/tests/test_unix_pipes.py +++ b/trio/tests/test_unix_pipes.py @@ -98,8 +98,9 @@ async def test_pipe_errors(): with pytest.raises(TypeError): FdStream(None) + r, _ = os.pipe() with pytest.raises(ValueError): - await FdStream(0).receive_some(0) + await FdStream(r).receive_some(0) async def test_del(): From 173fa89f0556ddb2118cc5f5beb259256325f9e3 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 7 Feb 2020 16:02:16 +0400 Subject: [PATCH 105/157] Stop leaking an fd in test_pipe_errors For some reason, using TemporaryFile as a context-manager did not work, but the returned file has a __del__ method so this should avoid the leak. --- trio/tests/test_unix_pipes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trio/tests/test_unix_pipes.py b/trio/tests/test_unix_pipes.py index 1157d78b5d..ea32f65e85 100644 --- a/trio/tests/test_unix_pipes.py +++ b/trio/tests/test_unix_pipes.py @@ -1,6 +1,7 @@ import errno import select import os +import tempfile import pytest @@ -98,9 +99,9 @@ async def test_pipe_errors(): with pytest.raises(TypeError): FdStream(None) - r, _ = os.pipe() + fp = tempfile.TemporaryFile() with pytest.raises(ValueError): - await FdStream(r).receive_some(0) + await FdStream(fp.fileno()).receive_some(0) async def test_del(): From 3cd848dad3a5bdb07c98b9bc925463d3bc5519a4 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Thu, 13 Feb 2020 09:33:20 +0400 Subject: [PATCH 106/157] Revert "Allow dev builds to fail" This reverts commit 327d6f4d772fdcc8b281a2da96a94cefdb9f70a0. --- .travis.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index d739635ff2..685b4a8e93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,12 +32,6 @@ jobs: - python: 3.7-dev - python: 3.8-dev - python: nightly - allow_failures: - - python: 3.5-dev - - python: 3.6-dev - - python: 3.7-dev - - python: 3.8-dev - - python: nightly script: - ./ci.sh From 1ef6c2415754ed5ba03c042f7c6cf00e2090c184 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 17 Feb 2020 10:39:56 +0400 Subject: [PATCH 107/157] Stop closing the same fd twice This could cause us to close an unrelated fd. --- trio/tests/test_unix_pipes.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/trio/tests/test_unix_pipes.py b/trio/tests/test_unix_pipes.py index ea32f65e85..9349139e23 100644 --- a/trio/tests/test_unix_pipes.py +++ b/trio/tests/test_unix_pipes.py @@ -99,9 +99,11 @@ async def test_pipe_errors(): with pytest.raises(TypeError): FdStream(None) - fp = tempfile.TemporaryFile() - with pytest.raises(ValueError): - await FdStream(fp.fileno()).receive_some(0) + r, w = os.pipe() + os.close(w) + async with FdStream(r) as s: + with pytest.raises(ValueError): + await s.receive_some(0) async def test_del(): From 09cd53f20a303eb318db0e591ab7a2aba57e6526 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2020 05:52:39 +0000 Subject: [PATCH 108/157] Bump sphinx from 2.4.1 to 2.4.2 Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 2.4.1 to 2.4.2. - [Release notes](https://github.com/sphinx-doc/sphinx/releases) - [Changelog](https://github.com/sphinx-doc/sphinx/blob/3.x/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinx/compare/v2.4.1...v2.4.2) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index da58f29424..90a98b678b 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -29,7 +29,7 @@ sniffio==1.1.0 snowballstemmer==2.0.0 # via sphinx sortedcontainers==2.1.0 sphinx-rtd-theme==0.4.3 -sphinx==2.4.1 +sphinx==2.4.2 sphinxcontrib-applehelp==1.0.1 # via sphinx sphinxcontrib-devhelp==1.0.1 # via sphinx sphinxcontrib-htmlhelp==1.0.2 # via sphinx From 0b8148adcb1b05fed88c159155a5b0170cf2efa6 Mon Sep 17 00:00:00 2001 From: Kyle Lawlor Date: Sat, 15 Feb 2020 18:37:09 -0500 Subject: [PATCH 109/157] add a deprecation warning for python3.5 --- trio/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/trio/__init__.py b/trio/__init__.py index 6e9035d8fd..019323f53c 100644 --- a/trio/__init__.py +++ b/trio/__init__.py @@ -64,7 +64,7 @@ open_ssl_over_tcp_stream, open_ssl_over_tcp_listeners, serve_ssl_over_tcp ) -from ._deprecate import TrioDeprecationWarning +from ._deprecate import TrioDeprecationWarning, warn_deprecated # Submodules imported by default from . import hazmat @@ -170,3 +170,8 @@ __name__ + ".subprocess", _deprecated_subprocess_reexports.__dict__ ) del fixup_module_metadata + +import sys +if sys.version_info < (3, 6): + _deprecate.warn_deprecated("Support for Python 3.5", "0.14", issue=75, instead="Python 3.6+") +del sys From 4e1e3aecb5bcb829a391086b6993565dffbf83c3 Mon Sep 17 00:00:00 2001 From: Kyle Lawlor Date: Wed, 19 Feb 2020 11:08:43 -0500 Subject: [PATCH 110/157] remove an unneeded import statement --- trio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trio/__init__.py b/trio/__init__.py index 019323f53c..0c2ff96a44 100644 --- a/trio/__init__.py +++ b/trio/__init__.py @@ -64,7 +64,7 @@ open_ssl_over_tcp_stream, open_ssl_over_tcp_listeners, serve_ssl_over_tcp ) -from ._deprecate import TrioDeprecationWarning, warn_deprecated +from ._deprecate import TrioDeprecationWarning # Submodules imported by default from . import hazmat From 07488c2dfe3810c29cc47d6c1bd6406818dcb46d Mon Sep 17 00:00:00 2001 From: Kyle Lawlor Date: Wed, 19 Feb 2020 11:33:48 -0500 Subject: [PATCH 111/157] apply yapf formatting --- trio/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trio/__init__.py b/trio/__init__.py index 0c2ff96a44..d517bc7f18 100644 --- a/trio/__init__.py +++ b/trio/__init__.py @@ -173,5 +173,7 @@ import sys if sys.version_info < (3, 6): - _deprecate.warn_deprecated("Support for Python 3.5", "0.14", issue=75, instead="Python 3.6+") + _deprecate.warn_deprecated( + "Support for Python 3.5", "0.14", issue=75, instead="Python 3.6+" + ) del sys From 320803b600e9ced53e21a976d572824e995cc550 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 20 Feb 2020 05:54:53 +0000 Subject: [PATCH 112/157] Bump requests from 2.22.0 to 2.23.0 Bumps [requests](https://github.com/psf/requests) from 2.22.0 to 2.23.0. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.22.0...v2.23.0) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 90a98b678b..dbfc4f77b6 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -23,7 +23,7 @@ packaging==20.1 # via sphinx pygments==2.5.2 # via sphinx pyparsing==2.4.6 # via packaging pytz==2019.3 # via babel -requests==2.22.0 # via sphinx +requests==2.23.0 # via sphinx six==1.14.0 # via packaging sniffio==1.1.0 snowballstemmer==2.0.0 # via sphinx From 98d298cd50aa7828a27d6b29f0c745e674639426 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 21 Feb 2020 05:59:55 +0000 Subject: [PATCH 113/157] Bump idna from 2.8 to 2.9 Bumps [idna](https://github.com/kjd/idna) from 2.8 to 2.9. - [Release notes](https://github.com/kjd/idna/releases) - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst) - [Commits](https://github.com/kjd/idna/compare/v2.8...v2.9) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index dbfc4f77b6..302a7bf079 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -12,7 +12,7 @@ certifi==2019.11.28 # via requests chardet==3.0.4 # via requests click==7.0 # via towncrier docutils==0.16 # via sphinx -idna==2.8 +idna==2.9 imagesize==1.2.0 # via sphinx immutables==0.11 incremental==17.5.0 # via towncrier diff --git a/test-requirements.txt b/test-requirements.txt index de5b20b3a5..1e6bf104fe 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -15,7 +15,7 @@ cryptography==2.8 # via pyopenssl, trustme decorator==4.4.1 # via ipython, traitlets entrypoints==0.3 # via flake8 flake8==3.7.9 -idna==2.8 +idna==2.9 immutables==0.11 ipython-genutils==0.2.0 # via traitlets ipython==7.9.0 From 467d73332098e209fe04f0058ada19c755066a30 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2020 06:13:29 +0000 Subject: [PATCH 114/157] Bump sphinx from 2.4.2 to 2.4.3 Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 2.4.2 to 2.4.3. - [Release notes](https://github.com/sphinx-doc/sphinx/releases) - [Changelog](https://github.com/sphinx-doc/sphinx/blob/3.x/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinx/compare/v2.4.2...v2.4.3) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 302a7bf079..5ab43b7b7d 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -29,7 +29,7 @@ sniffio==1.1.0 snowballstemmer==2.0.0 # via sphinx sortedcontainers==2.1.0 sphinx-rtd-theme==0.4.3 -sphinx==2.4.2 +sphinx==2.4.3 sphinxcontrib-applehelp==1.0.1 # via sphinx sphinxcontrib-devhelp==1.0.1 # via sphinx sphinxcontrib-htmlhelp==1.0.2 # via sphinx From bed065fb63016590bc1152080c351ac552e46b8e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2020 06:22:26 +0000 Subject: [PATCH 115/157] Bump sphinxcontrib-htmlhelp from 1.0.2 to 1.0.3 Bumps [sphinxcontrib-htmlhelp](http://sphinx-doc.org/) from 1.0.2 to 1.0.3. Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 5ab43b7b7d..1b0e3cef6e 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -32,7 +32,7 @@ sphinx-rtd-theme==0.4.3 sphinx==2.4.3 sphinxcontrib-applehelp==1.0.1 # via sphinx sphinxcontrib-devhelp==1.0.1 # via sphinx -sphinxcontrib-htmlhelp==1.0.2 # via sphinx +sphinxcontrib-htmlhelp==1.0.3 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-qthelp==1.0.2 # via sphinx sphinxcontrib-serializinghtml==1.1.3 # via sphinx From 589befcf53644c783c68922a08f23b17a9c5c02e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Ellensh=C3=B8j=20Andersen?= Date: Wed, 26 Feb 2020 23:13:15 +0100 Subject: [PATCH 116/157] Added tenacity --- docs/source/awesome-trio-libraries.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/awesome-trio-libraries.rst b/docs/source/awesome-trio-libraries.rst index 4ef79edf3d..7fb3530f30 100644 --- a/docs/source/awesome-trio-libraries.rst +++ b/docs/source/awesome-trio-libraries.rst @@ -74,6 +74,7 @@ Tools and Utilities * `trio-typing `__ - Type hints for Trio and related projects. * `trio-util `__ - An assortment of utilities for the Trio async/await framework. * `tricycle `__ - This is a library of interesting-but-maybe-not-yet-fully-proven extensions to Trio. +* `tenacity `__ - Retrying library for Python with async/await support. Trio/Asyncio Interoperability From 7e8eba0b2e3c05aa30653551498d281e244d4b03 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 06:23:31 +0000 Subject: [PATCH 117/157] Bump decorator from 4.4.1 to 4.4.2 Bumps [decorator](https://github.com/micheles/decorator) from 4.4.1 to 4.4.2. - [Release notes](https://github.com/micheles/decorator/releases) - [Changelog](https://github.com/micheles/decorator/blob/master/CHANGES.md) - [Commits](https://github.com/micheles/decorator/commits) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 1e6bf104fe..6ecb5a66ed 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,27 +4,27 @@ # # pip-compile --output-file test-requirements.txt test-requirements.in # -astor==0.8.1 +astor==0.8.1 # via -r test-requirements.in (line 13) astroid==2.3.3 # via pylint -async-generator==1.10 -attrs==19.3.0 +async-generator==1.10 # via -r test-requirements.in (line 23) +attrs==19.3.0 # via -r test-requirements.in (line 21), outcome, pytest backcall==0.1.0 # via ipython -cffi==1.14.0 +cffi==1.14.0 # via cryptography coverage==5.0.3 # via pytest-cov cryptography==2.8 # via pyopenssl, trustme -decorator==4.4.1 # via ipython, traitlets +decorator==4.4.2 # via ipython, traitlets entrypoints==0.3 # via flake8 -flake8==3.7.9 -idna==2.9 -immutables==0.11 +flake8==3.7.9 # via -r test-requirements.in (line 12) +idna==2.9 # via -r test-requirements.in (line 24), trustme +immutables==0.11 # via -r test-requirements.in (line 31) ipython-genutils==0.2.0 # via traitlets -ipython==7.9.0 +ipython==7.9.0 # via -r test-requirements.in (line 4) isort==4.3.21 # via pylint -jedi==0.16.0 +jedi==0.16.0 # via -r test-requirements.in (line 8), ipython lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint more-itertools==8.2.0 # via pytest -outcome==1.0.1 +outcome==1.0.1 # via -r test-requirements.in (line 25) packaging==20.1 # via pytest parso==0.6.1 # via jedi pexpect==4.8.0 # via ipython @@ -37,16 +37,16 @@ pycodestyle==2.5.0 # via flake8 pycparser==2.19 # via cffi pyflakes==2.1.1 # via flake8 pygments==2.5.2 # via ipython -pylint==2.4.2 -pyopenssl==19.1.0 +pylint==2.4.2 # via -r test-requirements.in (line 7) +pyopenssl==19.1.0 # via -r test-requirements.in (line 5) pyparsing==2.4.6 # via packaging -pytest-cov==2.8.1 -pytest==5.3.5 +pytest-cov==2.8.1 # via -r test-requirements.in (line 3) +pytest==5.3.5 # via -r test-requirements.in (line 2), pytest-cov six==1.14.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets -sniffio==1.1.0 -sortedcontainers==2.1.0 +sniffio==1.1.0 # via -r test-requirements.in (line 26) +sortedcontainers==2.1.0 # via -r test-requirements.in (line 22) traitlets==4.3.3 # via ipython -trustme==0.6.0 +trustme==0.6.0 # via -r test-requirements.in (line 6) wcwidth==0.1.8 # via prompt-toolkit, pytest wrapt==1.11.2 # via astroid -yapf==0.29.0 +yapf==0.29.0 # via -r test-requirements.in (line 11) From e412f2d6d61f6c7e2357886fcd0b9e266475e317 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 06:24:08 +0000 Subject: [PATCH 118/157] Bump sphinxcontrib-qthelp from 1.0.2 to 1.0.3 Bumps [sphinxcontrib-qthelp](http://sphinx-doc.org/) from 1.0.2 to 1.0.3. Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 1b0e3cef6e..0134247ede 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -5,38 +5,38 @@ # pip-compile --output-file docs-requirements.txt docs-requirements.in # alabaster==0.7.12 # via sphinx -async-generator==1.10 -attrs==19.3.0 +async-generator==1.10 # via -r docs-requirements.in (line 12) +attrs==19.3.0 # via -r docs-requirements.in (line 10), outcome babel==2.8.0 # via sphinx certifi==2019.11.28 # via requests chardet==3.0.4 # via requests click==7.0 # via towncrier docutils==0.16 # via sphinx -idna==2.9 +idna==2.9 # via -r docs-requirements.in (line 13), requests imagesize==1.2.0 # via sphinx -immutables==0.11 +immutables==0.11 # via -r docs-requirements.in (line 18) incremental==17.5.0 # via towncrier jinja2==2.11.1 # via sphinx, towncrier markupsafe==1.1.1 # via jinja2 -outcome==1.0.1 +outcome==1.0.1 # via -r docs-requirements.in (line 14) packaging==20.1 # via sphinx pygments==2.5.2 # via sphinx pyparsing==2.4.6 # via packaging pytz==2019.3 # via babel requests==2.23.0 # via sphinx six==1.14.0 # via packaging -sniffio==1.1.0 +sniffio==1.1.0 # via -r docs-requirements.in (line 15) snowballstemmer==2.0.0 # via sphinx -sortedcontainers==2.1.0 -sphinx-rtd-theme==0.4.3 -sphinx==2.4.3 +sortedcontainers==2.1.0 # via -r docs-requirements.in (line 11) +sphinx-rtd-theme==0.4.3 # via -r docs-requirements.in (line 3) +sphinx==2.4.3 # via -r docs-requirements.in (line 2), sphinx-rtd-theme, sphinxcontrib-trio sphinxcontrib-applehelp==1.0.1 # via sphinx sphinxcontrib-devhelp==1.0.1 # via sphinx sphinxcontrib-htmlhelp==1.0.3 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx -sphinxcontrib-qthelp==1.0.2 # via sphinx +sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.3 # via sphinx -sphinxcontrib-trio==1.1.0 +sphinxcontrib-trio==1.1.0 # via -r docs-requirements.in (line 4) toml==0.10.0 # via towncrier -towncrier==19.2.0 +towncrier==19.2.0 # via -r docs-requirements.in (line 5) urllib3==1.25.8 # via requests From d244009659a7a1518c7c166087ff2f536bf3c950 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 06:50:16 +0000 Subject: [PATCH 119/157] Bump sphinxcontrib-applehelp from 1.0.1 to 1.0.2 Bumps [sphinxcontrib-applehelp](http://sphinx-doc.org/) from 1.0.1 to 1.0.2. Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 0134247ede..ca9937afe2 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -30,7 +30,7 @@ snowballstemmer==2.0.0 # via sphinx sortedcontainers==2.1.0 # via -r docs-requirements.in (line 11) sphinx-rtd-theme==0.4.3 # via -r docs-requirements.in (line 3) sphinx==2.4.3 # via -r docs-requirements.in (line 2), sphinx-rtd-theme, sphinxcontrib-trio -sphinxcontrib-applehelp==1.0.1 # via sphinx +sphinxcontrib-applehelp==1.0.2 # via sphinx sphinxcontrib-devhelp==1.0.1 # via sphinx sphinxcontrib-htmlhelp==1.0.3 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx From 968b39b67179c2180cc3231c974525096c913a0b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 06:50:23 +0000 Subject: [PATCH 120/157] Bump sphinxcontrib-serializinghtml from 1.1.3 to 1.1.4 Bumps [sphinxcontrib-serializinghtml](http://sphinx-doc.org/) from 1.1.3 to 1.1.4. Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 0134247ede..4fbceee7e3 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -35,7 +35,7 @@ sphinxcontrib-devhelp==1.0.1 # via sphinx sphinxcontrib-htmlhelp==1.0.3 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-qthelp==1.0.3 # via sphinx -sphinxcontrib-serializinghtml==1.1.3 # via sphinx +sphinxcontrib-serializinghtml==1.1.4 # via sphinx sphinxcontrib-trio==1.1.0 # via -r docs-requirements.in (line 4) toml==0.10.0 # via towncrier towncrier==19.2.0 # via -r docs-requirements.in (line 5) From 0191fd47e7bcefb91b52496ad714500eb1651843 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 07:39:56 +0000 Subject: [PATCH 121/157] Bump sphinxcontrib-devhelp from 1.0.1 to 1.0.2 Bumps [sphinxcontrib-devhelp](http://sphinx-doc.org/) from 1.0.1 to 1.0.2. Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 8f6e09177a..29b64af59e 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -31,7 +31,7 @@ sortedcontainers==2.1.0 # via -r docs-requirements.in (line 11) sphinx-rtd-theme==0.4.3 # via -r docs-requirements.in (line 3) sphinx==2.4.3 # via -r docs-requirements.in (line 2), sphinx-rtd-theme, sphinxcontrib-trio sphinxcontrib-applehelp==1.0.2 # via sphinx -sphinxcontrib-devhelp==1.0.1 # via sphinx +sphinxcontrib-devhelp==1.0.2 # via sphinx sphinxcontrib-htmlhelp==1.0.3 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-qthelp==1.0.3 # via sphinx From dfff98d601e17b48ea7692da8de73a481646cde8 Mon Sep 17 00:00:00 2001 From: gesslerpd Date: Mon, 2 Mar 2020 17:52:07 -0600 Subject: [PATCH 122/157] fix cffi dep --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f0da74c434..9ef41cb3e0 100644 --- a/setup.py +++ b/setup.py @@ -86,7 +86,8 @@ "outcome", "sniffio", # cffi 1.12 adds from_buffer(require_writable=True) and ffi.release() - "cffi>=1.12; os_name == 'nt'", # "cffi is required on windows" + # cffi 1.14 fixes memory leak inside ffi.getwinerror() + "cffi>=1.14; os_name == 'nt'", # "cffi is required on windows" "contextvars>=2.1; python_version < '3.7'" ], # This means, just install *everything* you see under trio/, even if it From 57df36486a574b6b2b0a24df48aef0004afa13ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=2E=20K=C3=A4rkk=C3=A4inen?= Date: Tue, 3 Mar 2020 17:48:10 +0200 Subject: [PATCH 123/157] Add redio to awesome-trio-libraries. --- docs/source/awesome-trio-libraries.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/awesome-trio-libraries.rst b/docs/source/awesome-trio-libraries.rst index 4ef79edf3d..6ec5ad4ffb 100644 --- a/docs/source/awesome-trio-libraries.rst +++ b/docs/source/awesome-trio-libraries.rst @@ -20,7 +20,7 @@ tag -> `PyPI Search `__ Getting Started --------------- -* `cookiecutter-trio `__ - This is a cookiecutter template for Python projects that use Trio. It makes it easy to start a new project, by providing a bunch of preconfigured boilerplate. +* `cookiecutter-trio `__ - This is a cookiecutter template for Python projects that use Trio. It makes it easy to start a new project, by providing a bunch of preconfigured boilerplate. * `pytest-trio `__ - Pytest plugin to test async-enabled Trio functions. * `sphinxcontrib-trio `__ - Make Sphinx better at documenting Python functions and methods. In particular, it makes it easy to document async functions. @@ -40,6 +40,7 @@ Database * `triopg `__ - PostgreSQL client for Trio based on asyncpg. * `trio-mysql `__ - Pure Python MySQL Client. * `sqlalchemy_aio `__ - Add asyncio and Trio support to SQLAlchemy core, derived from alchimia. +* `redio `__ - Redis client, pure Python and Trio. IOT @@ -81,4 +82,3 @@ Trio/Asyncio Interoperability * `anyio `__ - AnyIO is a asynchronous compatibility API that allows applications and libraries written against it to run unmodified on asyncio, curio and trio. * `sniffio `__ - This is a tiny package whose only purpose is to let you detect which async library your code is running under. * `trio-asyncio `__ - Trio-Asyncio lets you use many asyncio libraries from your Trio app. - From cf8ce11b882fb4418654d4f487c99d4929b53924 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 5 Mar 2020 06:03:53 +0000 Subject: [PATCH 124/157] Bump pycparser from 2.19 to 2.20 Bumps [pycparser](https://github.com/eliben/pycparser) from 2.19 to 2.20. - [Release notes](https://github.com/eliben/pycparser/releases) - [Changelog](https://github.com/eliben/pycparser/blob/master/CHANGES) - [Commits](https://github.com/eliben/pycparser/compare/release_v2.19...release_v2.20) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 6ecb5a66ed..01572e611d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,27 +4,27 @@ # # pip-compile --output-file test-requirements.txt test-requirements.in # -astor==0.8.1 # via -r test-requirements.in (line 13) +astor==0.8.1 # via -r test-requirements.in astroid==2.3.3 # via pylint -async-generator==1.10 # via -r test-requirements.in (line 23) -attrs==19.3.0 # via -r test-requirements.in (line 21), outcome, pytest +async-generator==1.10 # via -r test-requirements.in +attrs==19.3.0 # via -r test-requirements.in, outcome, pytest backcall==0.1.0 # via ipython cffi==1.14.0 # via cryptography coverage==5.0.3 # via pytest-cov cryptography==2.8 # via pyopenssl, trustme decorator==4.4.2 # via ipython, traitlets entrypoints==0.3 # via flake8 -flake8==3.7.9 # via -r test-requirements.in (line 12) -idna==2.9 # via -r test-requirements.in (line 24), trustme -immutables==0.11 # via -r test-requirements.in (line 31) +flake8==3.7.9 # via -r test-requirements.in +idna==2.9 # via -r test-requirements.in, trustme +immutables==0.11 # via -r test-requirements.in ipython-genutils==0.2.0 # via traitlets -ipython==7.9.0 # via -r test-requirements.in (line 4) +ipython==7.9.0 # via -r test-requirements.in isort==4.3.21 # via pylint -jedi==0.16.0 # via -r test-requirements.in (line 8), ipython +jedi==0.16.0 # via -r test-requirements.in, ipython lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint more-itertools==8.2.0 # via pytest -outcome==1.0.1 # via -r test-requirements.in (line 25) +outcome==1.0.1 # via -r test-requirements.in packaging==20.1 # via pytest parso==0.6.1 # via jedi pexpect==4.8.0 # via ipython @@ -34,19 +34,19 @@ prompt-toolkit==2.0.10 # via ipython ptyprocess==0.6.0 # via pexpect py==1.8.1 # via pytest pycodestyle==2.5.0 # via flake8 -pycparser==2.19 # via cffi +pycparser==2.20 # via cffi pyflakes==2.1.1 # via flake8 pygments==2.5.2 # via ipython -pylint==2.4.2 # via -r test-requirements.in (line 7) -pyopenssl==19.1.0 # via -r test-requirements.in (line 5) +pylint==2.4.2 # via -r test-requirements.in +pyopenssl==19.1.0 # via -r test-requirements.in pyparsing==2.4.6 # via packaging -pytest-cov==2.8.1 # via -r test-requirements.in (line 3) -pytest==5.3.5 # via -r test-requirements.in (line 2), pytest-cov +pytest-cov==2.8.1 # via -r test-requirements.in +pytest==5.3.5 # via -r test-requirements.in, pytest-cov six==1.14.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets -sniffio==1.1.0 # via -r test-requirements.in (line 26) -sortedcontainers==2.1.0 # via -r test-requirements.in (line 22) +sniffio==1.1.0 # via -r test-requirements.in +sortedcontainers==2.1.0 # via -r test-requirements.in traitlets==4.3.3 # via ipython -trustme==0.6.0 # via -r test-requirements.in (line 6) +trustme==0.6.0 # via -r test-requirements.in wcwidth==0.1.8 # via prompt-toolkit, pytest wrapt==1.11.2 # via astroid -yapf==0.29.0 # via -r test-requirements.in (line 11) +yapf==0.29.0 # via -r test-requirements.in From 72ad4107d5ef641f04b15edb565c6416c7bffd5d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 5 Mar 2020 06:13:56 +0000 Subject: [PATCH 125/157] Bump parso from 0.6.1 to 0.6.2 Bumps [parso](https://github.com/davidhalter/parso) from 0.6.1 to 0.6.2. - [Release notes](https://github.com/davidhalter/parso/releases) - [Changelog](https://github.com/davidhalter/parso/blob/v0.6.2/CHANGELOG.rst) - [Commits](https://github.com/davidhalter/parso/compare/v0.6.1...v0.6.2) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 01572e611d..10c67fb084 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -26,7 +26,7 @@ mccabe==0.6.1 # via flake8, pylint more-itertools==8.2.0 # via pytest outcome==1.0.1 # via -r test-requirements.in packaging==20.1 # via pytest -parso==0.6.1 # via jedi +parso==0.6.2 # via jedi pexpect==4.8.0 # via ipython pickleshare==0.7.5 # via ipython pluggy==0.13.1 # via pytest From 063985b9456d272f6382469acb081ef09bc26fa6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2020 06:09:30 +0000 Subject: [PATCH 126/157] Bump packaging from 20.1 to 20.3 Bumps [packaging](https://github.com/pypa/packaging) from 20.1 to 20.3. - [Release notes](https://github.com/pypa/packaging/releases) - [Changelog](https://github.com/pypa/packaging/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pypa/packaging/compare/20.1...20.3) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 24 ++++++++++++------------ test-requirements.txt | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 29b64af59e..0fe71eee50 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -5,38 +5,38 @@ # pip-compile --output-file docs-requirements.txt docs-requirements.in # alabaster==0.7.12 # via sphinx -async-generator==1.10 # via -r docs-requirements.in (line 12) -attrs==19.3.0 # via -r docs-requirements.in (line 10), outcome +async-generator==1.10 # via -r docs-requirements.in +attrs==19.3.0 # via -r docs-requirements.in, outcome babel==2.8.0 # via sphinx certifi==2019.11.28 # via requests chardet==3.0.4 # via requests click==7.0 # via towncrier docutils==0.16 # via sphinx -idna==2.9 # via -r docs-requirements.in (line 13), requests +idna==2.9 # via -r docs-requirements.in, requests imagesize==1.2.0 # via sphinx -immutables==0.11 # via -r docs-requirements.in (line 18) +immutables==0.11 # via -r docs-requirements.in incremental==17.5.0 # via towncrier jinja2==2.11.1 # via sphinx, towncrier markupsafe==1.1.1 # via jinja2 -outcome==1.0.1 # via -r docs-requirements.in (line 14) -packaging==20.1 # via sphinx +outcome==1.0.1 # via -r docs-requirements.in +packaging==20.3 # via sphinx pygments==2.5.2 # via sphinx pyparsing==2.4.6 # via packaging pytz==2019.3 # via babel requests==2.23.0 # via sphinx six==1.14.0 # via packaging -sniffio==1.1.0 # via -r docs-requirements.in (line 15) +sniffio==1.1.0 # via -r docs-requirements.in snowballstemmer==2.0.0 # via sphinx -sortedcontainers==2.1.0 # via -r docs-requirements.in (line 11) -sphinx-rtd-theme==0.4.3 # via -r docs-requirements.in (line 3) -sphinx==2.4.3 # via -r docs-requirements.in (line 2), sphinx-rtd-theme, sphinxcontrib-trio +sortedcontainers==2.1.0 # via -r docs-requirements.in +sphinx-rtd-theme==0.4.3 # via -r docs-requirements.in +sphinx==2.4.3 # via -r docs-requirements.in, sphinx-rtd-theme, sphinxcontrib-trio sphinxcontrib-applehelp==1.0.2 # via sphinx sphinxcontrib-devhelp==1.0.2 # via sphinx sphinxcontrib-htmlhelp==1.0.3 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.4 # via sphinx -sphinxcontrib-trio==1.1.0 # via -r docs-requirements.in (line 4) +sphinxcontrib-trio==1.1.0 # via -r docs-requirements.in toml==0.10.0 # via towncrier -towncrier==19.2.0 # via -r docs-requirements.in (line 5) +towncrier==19.2.0 # via -r docs-requirements.in urllib3==1.25.8 # via requests diff --git a/test-requirements.txt b/test-requirements.txt index 10c67fb084..63641cfff7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -25,7 +25,7 @@ lazy-object-proxy==1.4.3 # via astroid mccabe==0.6.1 # via flake8, pylint more-itertools==8.2.0 # via pytest outcome==1.0.1 # via -r test-requirements.in -packaging==20.1 # via pytest +packaging==20.3 # via pytest parso==0.6.2 # via jedi pexpect==4.8.0 # via ipython pickleshare==0.7.5 # via ipython From 48dc3789e722cd7801a631471a6733b2f683c0ea Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2020 06:18:42 +0000 Subject: [PATCH 127/157] Bump sphinx from 2.4.3 to 2.4.4 Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 2.4.3 to 2.4.4. - [Release notes](https://github.com/sphinx-doc/sphinx/releases) - [Changelog](https://github.com/sphinx-doc/sphinx/blob/3.x/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinx/compare/v2.4.3...v2.4.4) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 0fe71eee50..a782f13a2d 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -29,7 +29,7 @@ sniffio==1.1.0 # via -r docs-requirements.in snowballstemmer==2.0.0 # via sphinx sortedcontainers==2.1.0 # via -r docs-requirements.in sphinx-rtd-theme==0.4.3 # via -r docs-requirements.in -sphinx==2.4.3 # via -r docs-requirements.in, sphinx-rtd-theme, sphinxcontrib-trio +sphinx==2.4.4 # via -r docs-requirements.in, sphinx-rtd-theme, sphinxcontrib-trio sphinxcontrib-applehelp==1.0.2 # via sphinx sphinxcontrib-devhelp==1.0.2 # via sphinx sphinxcontrib-htmlhelp==1.0.3 # via sphinx From b7c4d3c0ee5e3680c1a1d74d20e40e4546d11842 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2020 06:23:00 +0000 Subject: [PATCH 128/157] Bump pygments from 2.5.2 to 2.6.1 Bumps [pygments](https://github.com/pygments/pygments) from 2.5.2 to 2.6.1. - [Release notes](https://github.com/pygments/pygments/releases) - [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES) - [Commits](https://github.com/pygments/pygments/compare/2.5.2...2.6.1) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index a782f13a2d..d3a58e70f0 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -20,7 +20,7 @@ jinja2==2.11.1 # via sphinx, towncrier markupsafe==1.1.1 # via jinja2 outcome==1.0.1 # via -r docs-requirements.in packaging==20.3 # via sphinx -pygments==2.5.2 # via sphinx +pygments==2.6.1 # via sphinx pyparsing==2.4.6 # via packaging pytz==2019.3 # via babel requests==2.23.0 # via sphinx diff --git a/test-requirements.txt b/test-requirements.txt index 63641cfff7..f83f84ea1e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -36,7 +36,7 @@ py==1.8.1 # via pytest pycodestyle==2.5.0 # via flake8 pycparser==2.20 # via cffi pyflakes==2.1.1 # via flake8 -pygments==2.5.2 # via ipython +pygments==2.6.1 # via ipython pylint==2.4.2 # via -r test-requirements.in pyopenssl==19.1.0 # via -r test-requirements.in pyparsing==2.4.6 # via packaging From 28af4b133c88e3524097200f18270c67db5dd91c Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 8 Mar 2020 23:48:59 -0700 Subject: [PATCH 129/157] Fix flaky 'test_signals' in test_subprocess.py Fixes gh-1170 --- trio/tests/test_subprocess.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/trio/tests/test_subprocess.py b/trio/tests/test_subprocess.py index fe55b85aba..7fe64564c7 100644 --- a/trio/tests/test_subprocess.py +++ b/trio/tests/test_subprocess.py @@ -14,9 +14,9 @@ posix = os.name == "posix" if posix: - from signal import SIGKILL, SIGTERM, SIGINT + from signal import SIGKILL, SIGTERM, SIGUSR1 else: - SIGKILL, SIGTERM, SIGINT = None, None, None + SIGKILL, SIGTERM, SIGUSR1 = None, None, None # Since Windows has very few command-line utilities generally available, @@ -362,8 +362,15 @@ async def test_one_signal(send_it, signum): await test_one_signal(Process.kill, SIGKILL) await test_one_signal(Process.terminate, SIGTERM) + # Test that we can send arbitrary signals. + # + # We used to use SIGINT here, but it turns out that the Python interpreter + # has race conditions that can cause it to explode in weird ways if it + # tries to handle SIGINT during startup. SIGUSR1's default disposition is + # to terminate the target process, and Python doesn't try to do anything + # clever to handle it. if posix: - await test_one_signal(lambda proc: proc.send_signal(SIGINT), SIGINT) + await test_one_signal(lambda proc: proc.send_signal(SIGUSR1), SIGUSR1) @pytest.mark.skipif(not posix, reason="POSIX specific") From 8af36acbd2238299e62795198488b682a8099853 Mon Sep 17 00:00:00 2001 From: Robie Basak Date: Sat, 7 Mar 2020 19:11:26 +0000 Subject: [PATCH 130/157] Mark upstream-only test It doesn't make sense for downstream redistributors to run this test, since they might be using a newer version of Python with additional symbols which won't be reflected in trio.socket, and this shouldn't cause downstream test runs to start failing. --- setup.cfg | 2 ++ trio/tests/test_exports.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/setup.cfg b/setup.cfg index 0e814ba376..e6579a4f07 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,5 @@ [tool:pytest] xfail_strict = true faulthandler_timeout=60 +markers = + redistributors_should_skip: tests that should be skipped by downstream redistributors diff --git a/trio/tests/test_exports.py b/trio/tests/test_exports.py index a9b7179f5f..abc6f07963 100644 --- a/trio/tests/test_exports.py +++ b/trio/tests/test_exports.py @@ -49,6 +49,11 @@ def public_namespaces(module): NAMESPACES = list(public_namespaces(trio)) +# It doesn't make sense for downstream redistributors to run this test, since +# they might be using a newer version of Python with additional symbols which +# won't be reflected in trio.socket, and this shouldn't cause downstream test +# runs to start failing. +@pytest.mark.redistributors_should_skip # pylint/jedi often have trouble with alpha releases, where Python's internals # are in flux, grammar may not have settled down, etc. @pytest.mark.skipif( From c4fa40e9028fcbb2c128b078645b3a23ed797362 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2020 06:08:35 +0000 Subject: [PATCH 131/157] Bump click from 7.0 to 7.1.1 Bumps [click](https://github.com/pallets/click) from 7.0 to 7.1.1. - [Release notes](https://github.com/pallets/click/releases) - [Changelog](https://github.com/pallets/click/blob/master/CHANGES.rst) - [Commits](https://github.com/pallets/click/compare/7.0...7.1.1) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index d3a58e70f0..7e162227ea 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -10,7 +10,7 @@ attrs==19.3.0 # via -r docs-requirements.in, outcome babel==2.8.0 # via sphinx certifi==2019.11.28 # via requests chardet==3.0.4 # via requests -click==7.0 # via towncrier +click==7.1.1 # via towncrier docutils==0.16 # via sphinx idna==2.9 # via -r docs-requirements.in, requests imagesize==1.2.0 # via sphinx From 5acf2a3de73ff3bc23494ff7cbb6b58385a585d5 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 13 Mar 2020 05:52:51 +0000 Subject: [PATCH 132/157] Bump pytest from 5.3.5 to 5.4.0 Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.3.5 to 5.4.0. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/5.3.5...5.4.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index f83f84ea1e..38d37bd487 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -41,7 +41,7 @@ pylint==2.4.2 # via -r test-requirements.in pyopenssl==19.1.0 # via -r test-requirements.in pyparsing==2.4.6 # via packaging pytest-cov==2.8.1 # via -r test-requirements.in -pytest==5.3.5 # via -r test-requirements.in, pytest-cov +pytest==5.4.0 # via -r test-requirements.in, pytest-cov six==1.14.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets sniffio==1.1.0 # via -r test-requirements.in sortedcontainers==2.1.0 # via -r test-requirements.in From 58bfacc327a0428514046078d351ab4b18117902 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2020 06:13:33 +0000 Subject: [PATCH 133/157] Bump pytest from 5.4.0 to 5.4.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.4.0 to 5.4.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/5.4.0...5.4.1) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 38d37bd487..b4245236be 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -41,7 +41,7 @@ pylint==2.4.2 # via -r test-requirements.in pyopenssl==19.1.0 # via -r test-requirements.in pyparsing==2.4.6 # via packaging pytest-cov==2.8.1 # via -r test-requirements.in -pytest==5.4.0 # via -r test-requirements.in, pytest-cov +pytest==5.4.1 # via -r test-requirements.in, pytest-cov six==1.14.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets sniffio==1.1.0 # via -r test-requirements.in sortedcontainers==2.1.0 # via -r test-requirements.in From d362eabdb9fb302036a45116069a61cef400ef84 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2020 05:57:35 +0000 Subject: [PATCH 134/157] Bump coverage from 5.0.3 to 5.0.4 Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.0.3 to 5.0.4. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/coverage-5.0.3...coverage-5.0.4) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index b4245236be..0191ea0f5f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -10,7 +10,7 @@ async-generator==1.10 # via -r test-requirements.in attrs==19.3.0 # via -r test-requirements.in, outcome, pytest backcall==0.1.0 # via ipython cffi==1.14.0 # via cryptography -coverage==5.0.3 # via pytest-cov +coverage==5.0.4 # via pytest-cov cryptography==2.8 # via pyopenssl, trustme decorator==4.4.2 # via ipython, traitlets entrypoints==0.3 # via flake8 From fc48165bca4e8319058644c5be2a9a41c7fa2b8b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2020 06:29:59 +0000 Subject: [PATCH 135/157] Bump wcwidth from 0.1.8 to 0.1.9 Bumps [wcwidth](https://github.com/jquast/wcwidth) from 0.1.8 to 0.1.9. - [Release notes](https://github.com/jquast/wcwidth/releases) - [Commits](https://github.com/jquast/wcwidth/compare/0.1.8...0.1.9) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 0191ea0f5f..3b716f646e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -47,6 +47,6 @@ sniffio==1.1.0 # via -r test-requirements.in sortedcontainers==2.1.0 # via -r test-requirements.in traitlets==4.3.3 # via ipython trustme==0.6.0 # via -r test-requirements.in -wcwidth==0.1.8 # via prompt-toolkit, pytest +wcwidth==0.1.9 # via prompt-toolkit, pytest wrapt==1.11.2 # via astroid yapf==0.29.0 # via -r test-requirements.in From ed868c1c4da0755e4aff1fb29cba573f1e72ce09 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2020 06:14:03 +0000 Subject: [PATCH 136/157] Bump sphinxcontrib-trio from 1.1.0 to 1.1.1 Bumps [sphinxcontrib-trio](https://github.com/python-trio/sphinxcontrib-trio) from 1.1.0 to 1.1.1. - [Release notes](https://github.com/python-trio/sphinxcontrib-trio/releases) - [Commits](https://github.com/python-trio/sphinxcontrib-trio/compare/v1.1.0...v1.1.1) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 7e162227ea..4639b1f4d0 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -36,7 +36,7 @@ sphinxcontrib-htmlhelp==1.0.3 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.4 # via sphinx -sphinxcontrib-trio==1.1.0 # via -r docs-requirements.in +sphinxcontrib-trio==1.1.1 # via -r docs-requirements.in toml==0.10.0 # via towncrier towncrier==19.2.0 # via -r docs-requirements.in urllib3==1.25.8 # via requests From 14c66fecd7ac3a8458bc32ffe733eadfac0f3eb5 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Sun, 29 Mar 2020 19:38:44 -0700 Subject: [PATCH 137/157] Turn codecov back on Apparently this got accidentally disabled as part of a cleanup a while ago. (The problem is that the bash <(...) syntax assumes that curl is printing the file to stdout, but we're actually redirecting to a temporary file in order to handle retries.) --- ci.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ci.sh b/ci.sh index 63f1355b3e..70f85ce1aa 100755 --- a/ci.sh +++ b/ci.sh @@ -267,7 +267,13 @@ else netsh winsock reset fi - bash <(curl-harder -o codecov.sh https://codecov.io/bash) -n "${JOB_NAME}" + # The codecov docs recommend something like 'bash <(curl ...)' to pipe the + # script directly into bash as its being downloaded. But, the codecov + # server is flaky, so we instead save to a temp file with retries, and + # wait until we've successfully fetched the whole script before trying to + # run it. + curl-harder -o codecov.sh https://codecov.io/bash + bash codecov.sh -n "${JOB_NAME}" $PASSED fi From 3c90e2d3e0f5baf38fe74ebc54ed0f609d55f96b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 3 Apr 2020 06:13:10 +0000 Subject: [PATCH 138/157] Bump cryptography from 2.8 to 2.9 Bumps [cryptography](https://github.com/pyca/cryptography) from 2.8 to 2.9. - [Release notes](https://github.com/pyca/cryptography/releases) - [Changelog](https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/2.8...2.9) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 3b716f646e..29c51c099b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,7 +11,7 @@ attrs==19.3.0 # via -r test-requirements.in, outcome, pytest backcall==0.1.0 # via ipython cffi==1.14.0 # via cryptography coverage==5.0.4 # via pytest-cov -cryptography==2.8 # via pyopenssl, trustme +cryptography==2.9 # via pyopenssl, trustme decorator==4.4.2 # via ipython, traitlets entrypoints==0.3 # via flake8 flake8==3.7.9 # via -r test-requirements.in From 2a2252345162dd9bd0141df34334dd586f1f7b0e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2020 06:24:43 +0000 Subject: [PATCH 139/157] Bump pyparsing from 2.4.6 to 2.4.7 Bumps [pyparsing](https://github.com/pyparsing/pyparsing) from 2.4.6 to 2.4.7. - [Release notes](https://github.com/pyparsing/pyparsing/releases) - [Changelog](https://github.com/pyparsing/pyparsing/blob/master/CHANGES) - [Commits](https://github.com/pyparsing/pyparsing/compare/pyparsing_2.4.6...pyparsing_2.4.7) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 4639b1f4d0..2a653c8fac 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -21,7 +21,7 @@ markupsafe==1.1.1 # via jinja2 outcome==1.0.1 # via -r docs-requirements.in packaging==20.3 # via sphinx pygments==2.6.1 # via sphinx -pyparsing==2.4.6 # via packaging +pyparsing==2.4.7 # via packaging pytz==2019.3 # via babel requests==2.23.0 # via sphinx six==1.14.0 # via packaging diff --git a/test-requirements.txt b/test-requirements.txt index 29c51c099b..6a672cb1c7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -39,7 +39,7 @@ pyflakes==2.1.1 # via flake8 pygments==2.6.1 # via ipython pylint==2.4.2 # via -r test-requirements.in pyopenssl==19.1.0 # via -r test-requirements.in -pyparsing==2.4.6 # via packaging +pyparsing==2.4.7 # via packaging pytest-cov==2.8.1 # via -r test-requirements.in pytest==5.4.1 # via -r test-requirements.in, pytest-cov six==1.14.0 # via astroid, cryptography, packaging, prompt-toolkit, pyopenssl, traitlets From 51184abe5017498aef7b2466e2c79b3327f936fa Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2020 06:25:18 +0000 Subject: [PATCH 140/157] Bump certifi from 2019.11.28 to 2020.4.5.1 Bumps [certifi](https://github.com/certifi/python-certifi) from 2019.11.28 to 2020.4.5.1. - [Release notes](https://github.com/certifi/python-certifi/releases) - [Commits](https://github.com/certifi/python-certifi/commits) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 4639b1f4d0..e0523dbe76 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -8,7 +8,7 @@ alabaster==0.7.12 # via sphinx async-generator==1.10 # via -r docs-requirements.in attrs==19.3.0 # via -r docs-requirements.in, outcome babel==2.8.0 # via sphinx -certifi==2019.11.28 # via requests +certifi==2020.4.5.1 # via requests chardet==3.0.4 # via requests click==7.1.1 # via towncrier docutils==0.16 # via sphinx From 45930f9d4c01ac785adef2613d3407e401ffcb50 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Tue, 7 Apr 2020 09:33:04 +0800 Subject: [PATCH 141/157] [Fix][Docs] use trio.sleep instead of sleep --- docs/source/reference-core.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/reference-core.rst b/docs/source/reference-core.rst index f13d3440cb..d4bdd74edd 100644 --- a/docs/source/reference-core.rst +++ b/docs/source/reference-core.rst @@ -355,7 +355,7 @@ Here's an example:: print("starting...") with trio.move_on_after(5): with trio.move_on_after(10): - await sleep(20) + await trio.sleep(20) print("sleep finished without error") print("move_on_after(10) finished without error") print("move_on_after(5) finished without error") @@ -382,7 +382,7 @@ object representing this cancel scope, which we can use to check whether this scope caught a :exc:`Cancelled` exception:: with trio.move_on_after(5) as cancel_scope: - await sleep(10) + await trio.sleep(10) print(cancel_scope.cancelled_caught) # prints "True" The ``cancel_scope`` object also allows you to check or adjust this From 8a1bb7bd8b3f8c735014d605e2067f0629a50638 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2020 06:11:31 +0000 Subject: [PATCH 142/157] Bump coverage from 5.0.4 to 5.1 Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.0.4 to 5.1. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/coverage-5.0.4...coverage-5.1) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 6a672cb1c7..f33605c581 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -10,7 +10,7 @@ async-generator==1.10 # via -r test-requirements.in attrs==19.3.0 # via -r test-requirements.in, outcome, pytest backcall==0.1.0 # via ipython cffi==1.14.0 # via cryptography -coverage==5.0.4 # via pytest-cov +coverage==5.1 # via pytest-cov cryptography==2.9 # via pyopenssl, trustme decorator==4.4.2 # via ipython, traitlets entrypoints==0.3 # via flake8 From 11101999a2ed8686d33d84a1a49727d179f551e1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 14 Apr 2020 06:05:27 +0000 Subject: [PATCH 143/157] Bump parso from 0.6.2 to 0.7.0 Bumps [parso](https://github.com/davidhalter/parso) from 0.6.2 to 0.7.0. - [Release notes](https://github.com/davidhalter/parso/releases) - [Changelog](https://github.com/davidhalter/parso/blob/master/CHANGELOG.rst) - [Commits](https://github.com/davidhalter/parso/compare/v0.6.2...v0.7.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index f33605c581..7feee3242f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -26,7 +26,7 @@ mccabe==0.6.1 # via flake8, pylint more-itertools==8.2.0 # via pytest outcome==1.0.1 # via -r test-requirements.in packaging==20.3 # via pytest -parso==0.6.2 # via jedi +parso==0.7.0 # via jedi pexpect==4.8.0 # via ipython pickleshare==0.7.5 # via ipython pluggy==0.13.1 # via pytest From de20c1f2f0fa391c3386073e3a04aaa41f0d0c2a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 14 Apr 2020 06:06:09 +0000 Subject: [PATCH 144/157] Bump jinja2 from 2.11.1 to 2.11.2 Bumps [jinja2](https://github.com/pallets/jinja) from 2.11.1 to 2.11.2. - [Release notes](https://github.com/pallets/jinja/releases) - [Changelog](https://github.com/pallets/jinja/blob/master/CHANGES.rst) - [Commits](https://github.com/pallets/jinja/compare/2.11.1...2.11.2) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 88b13dfe99..cf1109830c 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -16,7 +16,7 @@ idna==2.9 # via -r docs-requirements.in, requests imagesize==1.2.0 # via sphinx immutables==0.11 # via -r docs-requirements.in incremental==17.5.0 # via towncrier -jinja2==2.11.1 # via sphinx, towncrier +jinja2==2.11.2 # via sphinx, towncrier markupsafe==1.1.1 # via jinja2 outcome==1.0.1 # via -r docs-requirements.in packaging==20.3 # via sphinx From db699f367fc6c38754fcb4862126ffdc27c23e2a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2020 06:02:56 +0000 Subject: [PATCH 145/157] Bump urllib3 from 1.25.8 to 1.25.9 Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.25.8 to 1.25.9. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/master/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.25.8...1.25.9) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index cf1109830c..58865b63c4 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -39,4 +39,4 @@ sphinxcontrib-serializinghtml==1.1.4 # via sphinx sphinxcontrib-trio==1.1.1 # via -r docs-requirements.in toml==0.10.0 # via towncrier towncrier==19.2.0 # via -r docs-requirements.in -urllib3==1.25.8 # via requests +urllib3==1.25.9 # via requests From 9614714c612bd76c9a684da80f74467b1449e50f Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Sun, 19 Apr 2020 21:50:57 +0400 Subject: [PATCH 146/157] Remove deprecated open_cancel_scope --- trio/__init__.py | 5 ++--- trio/_core/__init__.py | 12 ++++++------ trio/_core/_run.py | 6 ------ trio/_core/tests/test_run.py | 7 ------- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/trio/__init__.py b/trio/__init__.py index d517bc7f18..679c8509be 100644 --- a/trio/__init__.py +++ b/trio/__init__.py @@ -18,9 +18,8 @@ from ._core import ( TrioInternalError, RunFinishedError, WouldBlock, Cancelled, BusyResourceError, ClosedResourceError, MultiError, run, open_nursery, - CancelScope, open_cancel_scope, current_effective_deadline, - TASK_STATUS_IGNORED, current_time, BrokenResourceError, EndOfChannel, - Nursery + CancelScope, current_effective_deadline, TASK_STATUS_IGNORED, current_time, + BrokenResourceError, EndOfChannel, Nursery ) from ._timeouts import ( diff --git a/trio/_core/__init__.py b/trio/_core/__init__.py index fda027e193..cb3d5d714f 100644 --- a/trio/_core/__init__.py +++ b/trio/_core/__init__.py @@ -17,12 +17,12 @@ # Imports that always exist from ._run import ( - Task, CancelScope, run, open_nursery, open_cancel_scope, checkpoint, - current_task, current_effective_deadline, checkpoint_if_cancelled, - TASK_STATUS_IGNORED, current_statistics, current_trio_token, reschedule, - remove_instrument, add_instrument, current_clock, current_root_task, - spawn_system_task, current_time, wait_all_tasks_blocked, wait_readable, - wait_writable, notify_closing, Nursery + Task, CancelScope, run, open_nursery, checkpoint, current_task, + current_effective_deadline, checkpoint_if_cancelled, TASK_STATUS_IGNORED, + current_statistics, current_trio_token, reschedule, remove_instrument, + add_instrument, current_clock, current_root_task, spawn_system_task, + current_time, wait_all_tasks_blocked, wait_readable, wait_writable, + notify_closing, Nursery ) # Has to come after _run to resolve a circular import diff --git a/trio/_core/_run.py b/trio/_core/_run.py index 9bb115dadc..3ddfa5d524 100644 --- a/trio/_core/_run.py +++ b/trio/_core/_run.py @@ -619,12 +619,6 @@ def cancel_called(self): return self._cancel_called -@deprecated("0.11.0", issue=607, instead="trio.CancelScope") -def open_cancel_scope(*, deadline=inf, shield=False): - """Returns a context manager which creates a new cancellation scope.""" - return CancelScope(deadline=deadline, shield=shield) - - ################################################################ # Nursery and friends ################################################################ diff --git a/trio/_core/tests/test_run.py b/trio/_core/tests/test_run.py index fc03197133..3593793fe1 100644 --- a/trio/_core/tests/test_run.py +++ b/trio/_core/tests/test_run.py @@ -805,13 +805,6 @@ async def test_basic_timeout(mock_clock): await _core.checkpoint() -@pytest.mark.filterwarnings( - "ignore:.*trio.open_cancel_scope:trio.TrioDeprecationWarning" -) -async def test_cancel_scope_deprecated(recwarn): - assert isinstance(_core.open_cancel_scope(), _core.CancelScope) - - async def test_cancel_scope_nesting(): # Nested scopes: if two triggering at once, the outer one wins with _core.CancelScope() as scope1: From 0c3745d8bd17bce8488b7bd39418592b6e09f270 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Sun, 19 Apr 2020 22:00:34 +0400 Subject: [PATCH 147/157] Add newsfragment --- newsfragments/1458.removal.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/1458.removal.rst diff --git a/newsfragments/1458.removal.rst b/newsfragments/1458.removal.rst new file mode 100644 index 0000000000..087a38c6d6 --- /dev/null +++ b/newsfragments/1458.removal.rst @@ -0,0 +1 @@ +Remove ``trio.open_cancel_scope`` which was deprecated in 0.11.0. From 34dc44d0424385c41c81d0fc27559d02012871b3 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 22 Apr 2020 06:24:11 +0000 Subject: [PATCH 148/157] Bump cryptography from 2.9 to 2.9.1 Bumps [cryptography](https://github.com/pyca/cryptography) from 2.9 to 2.9.1. - [Release notes](https://github.com/pyca/cryptography/releases) - [Changelog](https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/2.9...2.9.1) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 7feee3242f..a660ad4d82 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,7 +11,7 @@ attrs==19.3.0 # via -r test-requirements.in, outcome, pytest backcall==0.1.0 # via ipython cffi==1.14.0 # via cryptography coverage==5.1 # via pytest-cov -cryptography==2.9 # via pyopenssl, trustme +cryptography==2.9.1 # via pyopenssl, trustme decorator==4.4.2 # via ipython, traitlets entrypoints==0.3 # via flake8 flake8==3.7.9 # via -r test-requirements.in From 53510e3bba259e4164c181546086831a7c809670 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 23 Apr 2020 06:07:34 +0000 Subject: [PATCH 149/157] Bump immutables from 0.11 to 0.12 Bumps [immutables](https://github.com/MagicStack/immutables) from 0.11 to 0.12. - [Release notes](https://github.com/MagicStack/immutables/releases) - [Commits](https://github.com/MagicStack/immutables/compare/v0.11...v0.12) Signed-off-by: dependabot-preview[bot] --- docs-requirements.txt | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 58865b63c4..f6b3a6359e 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -14,7 +14,7 @@ click==7.1.1 # via towncrier docutils==0.16 # via sphinx idna==2.9 # via -r docs-requirements.in, requests imagesize==1.2.0 # via sphinx -immutables==0.11 # via -r docs-requirements.in +immutables==0.12 # via -r docs-requirements.in incremental==17.5.0 # via towncrier jinja2==2.11.2 # via sphinx, towncrier markupsafe==1.1.1 # via jinja2 diff --git a/test-requirements.txt b/test-requirements.txt index a660ad4d82..cec9927d2d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -16,7 +16,7 @@ decorator==4.4.2 # via ipython, traitlets entrypoints==0.3 # via flake8 flake8==3.7.9 # via -r test-requirements.in idna==2.9 # via -r test-requirements.in, trustme -immutables==0.11 # via -r test-requirements.in +immutables==0.12 # via -r test-requirements.in ipython-genutils==0.2.0 # via traitlets ipython==7.9.0 # via -r test-requirements.in isort==4.3.21 # via pylint From 0ee1bf475a5fc50b178556ae5e01e207df12375d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 23 Apr 2020 06:08:19 +0000 Subject: [PATCH 150/157] Bump cryptography from 2.9.1 to 2.9.2 Bumps [cryptography](https://github.com/pyca/cryptography) from 2.9.1 to 2.9.2. - [Release notes](https://github.com/pyca/cryptography/releases) - [Changelog](https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/2.9.1...2.9.2) Signed-off-by: dependabot-preview[bot] --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index a660ad4d82..d6cc0204be 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,7 +11,7 @@ attrs==19.3.0 # via -r test-requirements.in, outcome, pytest backcall==0.1.0 # via ipython cffi==1.14.0 # via cryptography coverage==5.1 # via pytest-cov -cryptography==2.9.1 # via pyopenssl, trustme +cryptography==2.9.2 # via pyopenssl, trustme decorator==4.4.2 # via ipython, traitlets entrypoints==0.3 # via flake8 flake8==3.7.9 # via -r test-requirements.in From bc9a11609dc9a2da58487eddcd2235091140d55a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 24 Apr 2020 06:17:55 +0000 Subject: [PATCH 151/157] Bump yapf from 0.29.0 to 0.30.0 Bumps [yapf](https://github.com/google/yapf) from 0.29.0 to 0.30.0. - [Release notes](https://github.com/google/yapf/releases) - [Changelog](https://github.com/google/yapf/blob/master/CHANGELOG) - [Commits](https://github.com/google/yapf/compare/v0.29.0...v0.30.0) Signed-off-by: dependabot-preview[bot] --- test-requirements.in | 2 +- test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test-requirements.in b/test-requirements.in index 077eb70dcf..f03409d484 100644 --- a/test-requirements.in +++ b/test-requirements.in @@ -8,7 +8,7 @@ pylint # for pylint finding all symbols tests jedi # for jedi code completion tests # Tools -yapf ==0.29.0 # formatting +yapf ==0.30.0 # formatting flake8 astor # code generation diff --git a/test-requirements.txt b/test-requirements.txt index cc66fb37bf..e23ce7acd0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -49,4 +49,4 @@ traitlets==4.3.3 # via ipython trustme==0.6.0 # via -r test-requirements.in wcwidth==0.1.9 # via prompt-toolkit, pytest wrapt==1.11.2 # via astroid -yapf==0.29.0 # via -r test-requirements.in +yapf==0.30.0 # via -r test-requirements.in From 09ce2d77a58c7178900b900bbca5193c0f5d4637 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 24 Apr 2020 16:54:51 +0400 Subject: [PATCH 152/157] Run yapf 0.30.0 --- trio/tests/test_ssl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trio/tests/test_ssl.py b/trio/tests/test_ssl.py index 0ac217bb4c..16b323e98b 100644 --- a/trio/tests/test_ssl.py +++ b/trio/tests/test_ssl.py @@ -1255,8 +1255,8 @@ async def test_getpeercert(client_ctx): assert server.getpeercert() is None print(client.getpeercert()) assert ( - ("DNS", - "trio-test-1.example.org") in client.getpeercert()["subjectAltName"] + ("DNS", "trio-test-1.example.org") + in client.getpeercert()["subjectAltName"] ) From 7a82b562a4604de673abbcd4f1e4252d090d0cae Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Mon, 27 Apr 2020 02:04:30 -0700 Subject: [PATCH 153/157] Port azure pipelines configuration to github actions --- .github/workflows/ci.yml | 90 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..93750278b0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +name: CI + +on: [pull_request, push] + +jobs: + Windows: + name: 'Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})' + timeout-minutes: 20 + runs-on: 'windows-latest' + strategy: + matrix: + python: ['3.5', '3.6', '3.7', '3.8'] + arch: ['x86', 'x64'] + lsp: [''] + extra_name: [''] + include: + - python: '3.8' + arch: 'x64' + lsp: 'http://www.proxifier.com/download/ProxifierSetup.exe' + extra_name: ', with IFS LSP' + - python: '3.8' + arch: 'x64' + lsp: 'http://download.pctools.com/mirror/updates/9.0.0.2308-SDavfree-lite_en.exe' + extra_name: ', with non-IFS LSP' + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup python + uses: actions/setup-python@v1 + with: + python-version: '${{ matrix.python }}' + architecture: '${{ matrix.arch }}' + - name: Run tests + run: ./ci.sh + shell: bash + env: + LSP: '${{ matrix.lsp }}' + # Should match 'name:' up above + JOB_NAME: 'Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})' + + Linux: + name: 'Linux (${{ matrix.python }}${{ matrix.extra_name }})' + timeout-minutes: 10 + runs-on: 'ubuntu-latest' + strategy: + matrix: + python: ['3.5', '3.6', '3.7', '3.8'] + check_docs: ['0'] + check_formatting: ['0'] + extra_name: [''] + include: + - python: '3.8' + check_docs: '1' + extra_name: ', check docs' + - python: '3.8' + check_formatting: '1' + extra_name: ', check formatting' + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup python + uses: actions/setup-python@v1 + with: + python-version: '${{ matrix.python }}' + - name: Run tests + run: ./ci.sh + env: + CHECK_DOCS: '${{ matrix.check_docs }}' + CHECK_FORMATTING: '${{ matrix.check_formatting }}' + # Should match 'name:' up above + JOB_NAME: 'Linux (${{ matrix.python }}${{ matrix.extra_name }})' + + macOS: + name: 'macOS (${{ matrix.python }})' + timeout-minutes: 10 + runs-on: 'macos-latest' + strategy: + matrix: + python: ['3.5', '3.6', '3.7', '3.8'] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup python + uses: actions/setup-python@v1 + with: + python-version: '${{ matrix.python }}' + - name: Run tests + run: ./ci.sh + env: + JOB_NAME: 'macOS (${{ matrix.python }})' From a1774369d13f305cf89804c9d8d78f95d6900cbe Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Mon, 27 Apr 2020 04:21:25 -0700 Subject: [PATCH 154/157] only run on pull requests --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93750278b0..0aac4c009f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI -on: [pull_request, push] +on: [pull_request] jobs: Windows: From 947e88dc274c0e9fe0ff3fe2d6ccf688bfb9e1b2 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Mon, 27 Apr 2020 04:34:12 -0700 Subject: [PATCH 155/157] tiny comment cleanup --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0aac4c009f..132fdff097 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,4 +87,5 @@ jobs: - name: Run tests run: ./ci.sh env: + # Should match 'name:' up above JOB_NAME: 'macOS (${{ matrix.python }})' From 8b3c3adcf4d0ac9e15bc4d5f27dc03672746a370 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Mon, 27 Apr 2020 04:35:06 -0700 Subject: [PATCH 156/157] Remove unused yapf import Needed in particular because it just started triggering a deprecation warning on python nightly. --- trio/_tools/gen_exports.py | 1 - 1 file changed, 1 deletion(-) diff --git a/trio/_tools/gen_exports.py b/trio/_tools/gen_exports.py index cc0738177a..1340d049a2 100755 --- a/trio/_tools/gen_exports.py +++ b/trio/_tools/gen_exports.py @@ -10,7 +10,6 @@ import os from pathlib import Path import sys -import yapf.yapflib.yapf_api as formatter from textwrap import indent From 7fa11bdbcfee1c65d0bff590337ed4355ebbe44b Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 27 Apr 2020 10:37:49 +0400 Subject: [PATCH 157/157] Release 0.14.0 --- docs/source/history.rst | 45 ++++++++++++++++++++++++++++++++++ newsfragments/1272.feature.rst | 16 ------------ newsfragments/1308.bugfix.rst | 9 ------- newsfragments/1458.removal.rst | 1 - trio/_version.py | 2 +- 5 files changed, 46 insertions(+), 27 deletions(-) delete mode 100644 newsfragments/1272.feature.rst delete mode 100644 newsfragments/1308.bugfix.rst delete mode 100644 newsfragments/1458.removal.rst diff --git a/docs/source/history.rst b/docs/source/history.rst index ed6cb2a7b7..65bb5dd54c 100644 --- a/docs/source/history.rst +++ b/docs/source/history.rst @@ -5,6 +5,51 @@ Release history .. towncrier release notes start +Trio 0.14.0 (2020-04-27) +------------------------ + +Features +~~~~~~~~ + +- If you're using Trio's low-level interfaces like + `trio.hazmat.wait_readable` or similar, and then you close a socket or + file descriptor, you're supposed to call `trio.hazmat.notify_closing` + first so Trio can clean up properly. But what if you forget? In the + past, Trio would tend to either deadlock or explode spectacularly. + Now, it's much more robust to this situation, and should generally + survive. (But note that "survive" is not the same as "give you the + results you were expecting", so you should still call + `~trio.hazmat.notify_closing` when appropriate. This is about harm + reduction and making it easier to debug this kind of mistake, not + something you should rely on.) + + If you're using higher-level interfaces outside of the `trio.hazmat` + module, then you don't need to worry about any of this; those + intefaces already take care of calling `~trio.hazmat.notify_closing` + for you. (`#1272 `__) + + +Bugfixes +~~~~~~~~ + +- A bug related to the following methods has been introduced in version 0.12.0: + + - `trio.Path.iterdir` + - `trio.Path.glob` + - `trio.Path.rglob` + + The iteration of the blocking generators produced by pathlib was performed in + the trio thread. With this fix, the previous behavior is restored: the blocking + generators are converted into lists in a thread dedicated to blocking IO calls. (`#1308 `__) + + +Deprecations and Removals +~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Deprecate Python 3.5 (`#1408 `__) +- Remove ``trio.open_cancel_scope`` which was deprecated in 0.11.0. (`#1458 `__) + + Trio 0.13.0 (2019-11-02) ------------------------ diff --git a/newsfragments/1272.feature.rst b/newsfragments/1272.feature.rst deleted file mode 100644 index 3f540b93e5..0000000000 --- a/newsfragments/1272.feature.rst +++ /dev/null @@ -1,16 +0,0 @@ -If you're using Trio's low-level interfaces like -`trio.hazmat.wait_readable` or similar, and then you close a socket or -file descriptor, you're supposed to call `trio.hazmat.notify_closing` -first so Trio can clean up properly. But what if you forget? In the -past, Trio would tend to either deadlock or explode spectacularly. -Now, it's much more robust to this situation, and should generally -survive. (But note that "survive" is not the same as "give you the -results you were expecting", so you should still call -`~trio.hazmat.notify_closing` when appropriate. This is about harm -reduction and making it easier to debug this kind of mistake, not -something you should rely on.) - -If you're using higher-level interfaces outside of the `trio.hazmat` -module, then you don't need to worry about any of this; those -intefaces already take care of calling `~trio.hazmat.notify_closing` -for you. diff --git a/newsfragments/1308.bugfix.rst b/newsfragments/1308.bugfix.rst deleted file mode 100644 index db435e46c1..0000000000 --- a/newsfragments/1308.bugfix.rst +++ /dev/null @@ -1,9 +0,0 @@ -A bug related to the following methods has been introduced in version 0.12.0: - -- `trio.Path.iterdir` -- `trio.Path.glob` -- `trio.Path.rglob` - -The iteration of the blocking generators produced by pathlib was performed in -the trio thread. With this fix, the previous behavior is restored: the blocking -generators are converted into lists in a thread dedicated to blocking IO calls. diff --git a/newsfragments/1458.removal.rst b/newsfragments/1458.removal.rst deleted file mode 100644 index 087a38c6d6..0000000000 --- a/newsfragments/1458.removal.rst +++ /dev/null @@ -1 +0,0 @@ -Remove ``trio.open_cancel_scope`` which was deprecated in 0.11.0. diff --git a/trio/_version.py b/trio/_version.py index 56ce2746f8..0705c99035 100644 --- a/trio/_version.py +++ b/trio/_version.py @@ -1,3 +1,3 @@ # This file is imported from __init__.py and exec'd from setup.py -__version__ = "0.13.0+dev" +__version__ = "0.14.0"