Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.6.0 #601

Closed
wants to merge 63 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
8b7fae6
Merge pull request #564 from smurfix/release
pquentin Jul 20, 2018
e41f548
bump to 0.5.0+dev
smurfix Jul 20, 2018
0fc8182
Merge pull request #565 from smurfix/post_release
pquentin Jul 20, 2018
892af43
Give more details when the init task crashes
njsmith Jul 28, 2018
8bb8d00
Add python 3.7 to the appveyor test matrix
njsmith Jul 28, 2018
45b4e58
Merge pull request #571 from njsmith/appveyor-3.7
Fuyukai Jul 28, 2018
bda2cbd
Add support for sniffio
njsmith Jul 28, 2018
211f6c1
Add newsfragment
njsmith Jul 28, 2018
b72d525
issue 247, any cancelation inside the socket will leave it closed
Jul 28, 2018
4923c80
remove extra lines, switch sleep for _checkpoint
monobot Jul 28, 2018
bc320b9
include newsfragment
monobot Jul 28, 2018
51880dc
remove 2 lines yapf doesnt like
monobot Jul 28, 2018
ce84a68
funny yapf
monobot Jul 28, 2018
fd0d877
Merge pull request #574 from monobot/issue247
sorcio Jul 28, 2018
a10cc94
implement cancelable WaitForSingleObject for Windows
almarklein Jul 29, 2018
93313f6
using same yapf version as trio instead of latest
almarklein Jul 29, 2018
4e13a75
Fix CapacityLimiter memory leak.
Fuyukai Jul 29, 2018
6607389
Add newsfragment and change test a bit
Fuyukai Jul 29, 2018
c6a35cd
implement WaitForSingleObject using a thread
almarklein Jul 29, 2018
a990531
complete SSLListener doc
WindSoilder Jul 29, 2018
e4351ee
Period at end of sentence.
njsmith Jul 29, 2018
cef5002
Enable MacOS testing on Travis, disable 3.6 testing on Jenkins
njsmith Jul 30, 2018
eb10617
Merge pull request #583 from njsmith/use-travis-for-macos
oremanj Jul 30, 2018
76fba4b
Tweak phrasing in newsfragment
njsmith Jul 30, 2018
25dac11
empty commit to force jenkins rebuild
njsmith Jul 30, 2018
8a8c092
Merge pull request #581 from WindSoilder/master
njsmith Jul 30, 2018
558e1c0
Merge pull request #576 from Fuyukai/issue-548
njsmith Jul 30, 2018
b3813f6
Switch back to Jenkins for MacOS builds
njsmith Jul 30, 2018
6398e7a
Merge pull request #585 from njsmith/reenable-jenkins
pquentin Jul 30, 2018
b047a45
replace loop wih info timeout in WaitForMultipleObjects_sync
almarklein Jul 30, 2018
58352ad
factor WaitForSingleObject into own file
almarklein Jul 30, 2018
f124302
fix and refactor tests into fast and slow
almarklein Jul 30, 2018
1c0cbec
unnest a stub class
almarklein Jul 30, 2018
6e01271
Remove workaround for now-fixed 'immutables' bug
njsmith Jul 30, 2018
4ea0a0a
Skip a test on systems with buggy AI_V4MAPPED handling
njsmith Jul 31, 2018
245f161
Use ABCs instead of inspect to detect generators/coroutines
njsmith Jul 16, 2018
b27a1f1
Merge pull request #588 from njsmith/remove-immutables-workaround
sorcio Jul 31, 2018
200f819
Merge pull request #570 from njsmith/better-error-on-init-crash
sorcio Jul 31, 2018
c747dd3
Merge pull request #560 from njsmith/support-cython
sorcio Jul 31, 2018
dd4343d
Only alias '<broadcast>' on IPv4
sorcio Jul 31, 2018
e3970cb
Don't check <broadcast> resolution on V6ONLY socket
njsmith Aug 1, 2018
3a942b6
Merge pull request #572 from njsmith/support-sniffio
pquentin Aug 1, 2018
7e72d42
enhancements and tweaks to WaitForSingleObject
almarklein Aug 1, 2018
2e14510
Merge pull request #589 from njsmith/workaround-580
sorcio Aug 1, 2018
c750f38
made WaitForSingleObject tests more trioish
almarklein Aug 2, 2018
bd44469
Try testing PyPy's 3.6 branch too
njsmith Aug 2, 2018
eeafa1e
Merge pull request #590 from njsmith/pypy-3.6-branch
pquentin Aug 2, 2018
5795d18
exposing/documenting WaitForSingleObject
almarklein Aug 3, 2018
197d61d
comment flaky test
almarklein Aug 3, 2018
c77e24c
added simple module docstring
almarklein Aug 5, 2018
502f964
WaitForSingleObject polishing
almarklein Aug 6, 2018
1135421
Don't mention cffi-specific internals in public docs
njsmith Aug 6, 2018
3c7bb5a
Fix function signature in docs
njsmith Aug 6, 2018
4726776
Fix spelling mistake in the tutorial docs
mikeengland Aug 6, 2018
359b1e3
Merge pull request #593 from mikeengland/master
Fuyukai Aug 6, 2018
cdf114f
Merge pull request #575 from almarklein/WaitForSingleObject
njsmith Aug 7, 2018
d44daca
fix variable names in docstring example for serve_tcp
shuckc Aug 13, 2018
cf6616c
Merge pull request #597 from shuckc/master
pquentin Aug 13, 2018
1c4b63f
Fix crash when used with Raven.
miracle2k Jun 29, 2018
c6309c1
Merge pull request #599 from miracle2k/raven-fix
njsmith Aug 13, 2018
662f71f
copied Wiki page on releasing Trio to doc
smurfix Jul 29, 2018
eaa4827
Merge remote-tracking branch 'trio/master' into up
smurfix Aug 13, 2018
fa219b7
Release prep
smurfix Aug 13, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ matrix:
# The pypy tests are slow, so we list them first
- python: pypy3.5
- language: generic
env: USE_PYPY_NIGHTLY=1
env: PYPY_NIGHTLY_BRANCH=py3.5
- language: generic
env: PYPY_NIGHTLY_BRANCH=py3.6
- python: 3.5.0
- python: 3.5.2
- python: 3.6
Expand All @@ -26,6 +28,15 @@ matrix:
- python: 3.8-dev
dist: xenial
sudo: required
# - os: osx
# language: generic
# env: MACPYTHON=3.5.4
# - os: osx
# language: generic
# env: MACPYTHON=3.6.6
# - os: osx
# language: generic
# env: MACPYTHON=3.7.0

script:
- ci/travis.sh
3 changes: 2 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def configs = [
[
label: 'sierra',
pyversions: ['python3.5', 'python3.6'],
pyversions: ['python3.5', 'python3.6', 'python3.7'],
],
]

Expand Down Expand Up @@ -52,6 +52,7 @@ def build(pyversion, label) {
export PATH="/usr/local/bin:\${PATH}"
export PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:\${PATH}"
export PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:\${PATH}"
export PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:\${PATH}"

# Workaround for https://github.com/pypa/pip/issues/5345
# See also:
Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ environment:
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python37"
- PYTHON: "C:\\Python37-x64"

build_script:
- "git --no-pager log -n2"
Expand Down
16 changes: 14 additions & 2 deletions ci/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,20 @@ YAPF_VERSION=0.20.1

git rev-parse HEAD

if [ "$USE_PYPY_NIGHTLY" = "1" ]; then
curl -fLo pypy.tar.bz2 http://buildbot.pypy.org/nightly/py3.5/pypy-c-jit-latest-linux64.tar.bz2
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
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/
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
sudo $PYTHON_EXE -m pip install virtualenv
$PYTHON_EXE -m virtualenv testenv
source testenv/bin/activate
fi

if [ "$PYPY_NIGHTLY_BRANCH" != "" ]; then
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:
# - curl succeeded (200 response code; -f means "exit with error if
Expand Down
28 changes: 28 additions & 0 deletions docs/source/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,34 @@ Release history

.. towncrier release notes start

Trio 0.6.0 (2018-08-13)
-----------------------

Features
~~~~~~~~

- Add :func:`trio.hazmat.WaitForSingleObject` async function to await Windows
handles. (`#233 <https://github.com/python-trio/trio/issues/233>`__)
- The `sniffio <https://github.com/python-trio/sniffio>`__ library can now
detect when Trio is running. (`#572
<https://github.com/python-trio/trio/issues/572>`__)


Bugfixes
~~~~~~~~

- Make trio.socket._SocketType.connect *always* close the socket on
cancellation (`#247 <https://github.com/python-trio/trio/issues/247>`__)
- Fix a memory leak in :class:`trio.CapacityLimiter`, that could occurr when
``acquire`` or ``acquire_on_behalf_of`` was cancelled. (`#548
<https://github.com/python-trio/trio/issues/548>`__)
- Some version of MacOS have a buggy ``getaddrinfo`` that was causing spurious
test failures; we now detect those systems and skip the relevant test when
found. (`#580 <https://github.com/python-trio/trio/issues/580>`__)
- Prevent crashes when used with Sentry (raven-python). (`#599
<https://github.com/python-trio/trio/issues/599>`__)


Trio 0.5.0 (2018-07-20)
-----------------------

Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Vital statistics:
design.rst
history.rst
contributing.rst
releasing.rst
code-of-conduct.rst

====================
Expand Down
13 changes: 13 additions & 0 deletions docs/source/reference-hazmat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,19 @@ anything real. See `#26
Windows-specific API
--------------------

.. function:: WaitForSingleObject(handle)
:async:

Async and cancellable variant of `WaitForSingleObject
<https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx>`__.
Windows only.

:arg handle:
A Win32 object handle, as a Python integer.
:raises OSError:
If the handle is invalid, e.g. when it is already closed.


TODO: these are implemented, but are currently more of a sketch than
anything real. See `#26
<https://github.com/python-trio/trio/issues/26>`__ and `#52
Expand Down
67 changes: 67 additions & 0 deletions docs/source/releasing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.. _releasing:

Preparing a release
-------------------

Things to do for releasing:

* announce intent to release on gitter

* check for open issues / pull requests that really should be in the release

+ come back when these are done

+ … or ignore them and do another release next week

* check for deprecations "long enough ago" (two months or two releases, whichever is longer)

+ remove affected code

* Do the actual release changeset

+ update version number

- increment as per Semantic Versioning rules

- remove ``+dev`` tag from version number

+ Run ``towncrier``

- review history change

- ``git rm`` changes

+ commit

* push to your personal repository, "release" branch

* create pull request to ``python-trio/trio``'s "release" branch

* announce PR on gitter

+ wait for feedback

+ fix problems, if any

* verify that all checks succeeded

* acknowledge the release PR

+ or rather, somebody else should do that

* tag with vVERSION

* push to PyPI

+ ``python3 setup.py sdist bdist_wheel upload``

* announce on gitter

* update version number

+ add ``+dev`` tag to the end

* prepare pull request from "release" back to "master"

+ acknowledge it

2 changes: 1 addition & 1 deletion docs/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ with :func:`time.sleep`. ``async/await`` is useless!

Well, not really. Trio has one more trick up its sleeve, that makes
async functions more powerful than regular functions: it can run
multiple async function *at the same time*. Here's an example:
multiple async functions *at the same time*. Here's an example:

.. _tutorial-example-tasks-intro:

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"async_generator >= 1.9",
"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"
Expand Down
3 changes: 3 additions & 0 deletions trio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""Trio - Pythonic async I/O for humans and snake people.
"""

# General layout:
#
# trio/_core/... is the self-contained core library. It does various
Expand Down
7 changes: 7 additions & 0 deletions trio/_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"""
This namespace represents the core functionality that has to be built-in
and deal with private internal data structures. Things in this namespace
are publicly available in either trio, trio.hazmat, or trio.testing.
"""


# Needs to be defined early so it can be imported:
def _public(fn):
# Used to mark methods on _Runner and on IOManager implementations that
Expand Down
14 changes: 1 addition & 13 deletions trio/_core/_io_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
INVALID_HANDLE_VALUE,
raise_winerror,
ErrorCodes,
_handle,
)

# There's a lot to be said about the overall design of a Windows event
Expand Down Expand Up @@ -96,19 +97,6 @@ def _check(success):
return success


def _handle(obj):
# For now, represent handles as either cffi HANDLEs or as ints. If you
# try to pass in a file descriptor instead, it's not going to work
# out. (For that msvcrt.get_osfhandle does the trick, but I don't know if
# we'll actually need that for anything...) For sockets this doesn't
# matter, Python never allocates an fd. So let's wait until we actually
# encounter the problem before worrying about it.
if type(obj) is int:
return ffi.cast("HANDLE", obj)
else:
return obj


@attr.s(frozen=True)
class _WindowsStatistics:
tasks_waiting_overlapped = attr.ib()
Expand Down
10 changes: 4 additions & 6 deletions trio/_core/_ki.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,10 @@
# for any Python program that's written to catch and ignore
# KeyboardInterrupt.)


# We use this class object as a unique key into the frame locals dictionary,
# which in particular is guaranteed not to clash with any possible real local
# name (I bet this will confuse some debugger at some point though...):
class LOCALS_KEY_KI_PROTECTION_ENABLED:
pass
# We use this special string as a unique key into the frame locals dictionary.
# The @ ensures it is not a valid identifier and can't clash with any possible
# real local name. See: https://github.com/python-trio/trio/issues/469
LOCALS_KEY_KI_PROTECTION_ENABLED = '@TRIO_KI_PROTECTION_ENABLED'


# NB: according to the signal.signal docs, 'frame' can be None on entry to
Expand Down
24 changes: 17 additions & 7 deletions trio/_core/_run.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import functools
import inspect
import logging
import os
import random
import select
import threading
from collections import deque
import collections.abc
from contextlib import contextmanager, closing

import outcome
from contextvars import copy_context
from math import inf
from time import monotonic

from sniffio import current_async_library_cvar

import attr
from async_generator import (
async_generator, yield_, asynccontextmanager, isasyncgen
Expand Down Expand Up @@ -745,7 +747,7 @@ def spawn_impl(self, async_fn, args, nursery, name, *, system_task=False):
def _return_value_looks_like_wrong_library(value):
# Returned by legacy @asyncio.coroutine functions, which includes
# a surprising proportion of asyncio builtins.
if inspect.isgenerator(value):
if isinstance(value, collections.abc.Generator):
return True
# The protocol for detecting an asyncio Future-like object
if getattr(value, "_asyncio_future_blocking", None) is not None:
Expand All @@ -764,7 +766,7 @@ def _return_value_looks_like_wrong_library(value):
coro = async_fn(*args)
except TypeError:
# Give good error for: nursery.start_soon(trio.sleep(1))
if inspect.iscoroutine(async_fn):
if isinstance(async_fn, collections.abc.Coroutine):
raise TypeError(
"trio was expecting an async function, but instead it got "
"a coroutine object {async_fn!r}\n"
Expand Down Expand Up @@ -797,7 +799,7 @@ def _return_value_looks_like_wrong_library(value):
# for things like functools.partial objects wrapping an async
# function. So we have to just call it and then check whether the
# result is a coroutine object.
if not inspect.iscoroutine(coro):
if not isinstance(coro, collections.abc.Coroutine):
# Give good error for: nursery.start_soon(func_returning_future)
if _return_value_looks_like_wrong_library(coro):
raise TypeError(
Expand Down Expand Up @@ -874,8 +876,14 @@ def task_exited(self, task, result):
task._cancel_stack[-1]._remove_task(task)
self.tasks.remove(task)
if task._parent_nursery is None:
# the init task should be the last task to exit
assert not self.tasks
# the init task should be the last task to exit. If not, then
# something is very wrong. Probably it hit some unexpected error,
# in which case we re-raise the error (which will later get
# converted to a TrioInternalError, but at least we'll get a
# traceback). Otherwise, raise a new error.
if self.tasks: # pragma: no cover
result.unwrap()
raise TrioInternalError
else:
task._parent_nursery._child_finished(task, result)
if task is self.main_task:
Expand Down Expand Up @@ -1235,11 +1243,13 @@ def run(
clock = SystemClock()
instruments = list(instruments)
io_manager = TheIOManager()
system_context = copy_context()
system_context.run(current_async_library_cvar.set, "trio")
runner = Runner(
clock=clock,
instruments=instruments,
io_manager=io_manager,
system_context=copy_context(),
system_context=system_context,
)
GLOBAL_RUN_CONTEXT.runner = runner
locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True
Expand Down
Loading