Skip to content

Commit

Permalink
Merge remote-tracking branch 'python-trio/master' into memory_channel…
Browse files Browse the repository at this point in the history
…_named_tuple
  • Loading branch information
pquentin committed Nov 2, 2020
2 parents 9041145 + 8586816 commit 7e6191c
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
extra_name: ', with Komodia LSP'
- python: '3.8'
arch: 'x64'
lsp: 'http://www.proxifier.com/download/ProxifierSetup.exe'
lsp: 'https://www.proxifier.com/download/legacy/ProxifierSetup342.exe'
lsp_extract_file: ''
extra_name: ', with IFS LSP'
- python: '3.8'
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
dist: bionic
- language: generic
env: PYPY_NIGHTLY_BRANCH=py3.6
- language: generic
env: PYPY_NIGHTLY_BRANCH=py3.7
# Qemu tests are also slow
# FreeBSD:
- language: generic
Expand Down
8 changes: 4 additions & 4 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jinja2==2.11.2 # via sphinx, towncrier
markupsafe==1.1.1 # via jinja2
outcome==1.0.1 # via -r docs-requirements.in
packaging==20.4 # via sphinx
pygments==2.7.1 # via sphinx
pygments==2.7.2 # via sphinx
pyparsing==2.4.7 # via packaging
pytz==2020.1 # via babel
pytz==2020.4 # via babel
requests==2.24.0 # via sphinx
six==1.15.0 # via packaging
sniffio==1.2.0 # via -r docs-requirements.in
Expand All @@ -37,6 +37,6 @@ 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.2 # via -r docs-requirements.in
toml==0.10.1 # via towncrier
toml==0.10.2 # via towncrier
towncrier==19.2.0 # via -r docs-requirements.in
urllib3==1.25.10 # via requests
urllib3==1.25.11 # via requests
6 changes: 4 additions & 2 deletions docs/source/reference-core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1638,9 +1638,11 @@ an exception, where can that exception be reraised?

If you have an async generator that wants to ``yield`` from within a nursery
or cancel scope, your best bet is to refactor it to be a separate task
that communicates over memory channels.
that communicates over memory channels. The ``trio_util`` package offers a
`decorator that does this for you transparently
<https://trio-util.readthedocs.io/en/latest/#trio_util.trio_async_generator>`__.

For more discussion and some experimental partial workarounds, see
For more discussion, see
Trio issues `264 <https://github.com/python-trio/trio/issues/264>`__
(especially `this comment
<https://github.com/python-trio/trio/issues/264#issuecomment-418989328>`__)
Expand Down
1 change: 1 addition & 0 deletions newsfragments/1765.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a crash in pypy-3.7
12 changes: 6 additions & 6 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ black==20.8b1 ; implementation_name == "cpython" # via -r test-requirements.in
cffi==1.14.3 # via cryptography
click==7.1.2 # via black
coverage==5.3 # via pytest-cov
cryptography==3.1.1 # via pyopenssl, trustme
cryptography==3.2.1 # via pyopenssl, trustme
decorator==4.4.2 # via ipython
flake8==3.8.4 # via -r test-requirements.in
idna==2.10 # via -r test-requirements.in, trustme
immutables==0.14 # via -r test-requirements.in
iniconfig==1.1.1 # via pytest
ipython-genutils==0.2.0 # via traitlets
ipython==7.18.1 # via -r test-requirements.in
ipython==7.19.0 # via -r test-requirements.in
isort==5.6.4 # via pylint
jedi==0.17.2 # via -r test-requirements.in, ipython
lazy-object-proxy==1.4.3 # via astroid
Expand All @@ -41,17 +41,17 @@ py==1.9.0 # via pytest
pycodestyle==2.6.0 # via flake8
pycparser==2.20 # via cffi
pyflakes==2.2.0 # via flake8
pygments==2.7.1 # via ipython
pygments==2.7.2 # via ipython
pylint==2.6.0 # via -r test-requirements.in
pyopenssl==19.1.0 # via -r test-requirements.in
pyparsing==2.4.7 # via packaging
pytest-cov==2.10.1 # via -r test-requirements.in
pytest==6.1.1 # via -r test-requirements.in, pytest-cov
regex==2020.10.23 # via black
pytest==6.1.2 # via -r test-requirements.in, pytest-cov
regex==2020.10.28 # via black
six==1.15.0 # via astroid, cryptography, packaging, pyopenssl
sniffio==1.2.0 # via -r test-requirements.in
sortedcontainers==2.2.2 # via -r test-requirements.in
toml==0.10.1 # via black, pylint, pytest
toml==0.10.2 # via black, pylint, pytest
traitlets==5.0.5 # via ipython
trustme==0.6.0 # via -r test-requirements.in
typed-ast==1.4.1 ; implementation_name == "cpython" # via -r test-requirements.in, black, mypy
Expand Down
21 changes: 17 additions & 4 deletions trio/_core/_wakeup_socketpair.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,23 @@
from .. import _core
from .._util import is_main_thread

if sys.version_info >= (3, 7):
HAVE_WARN_ON_FULL_BUFFER = True
else:
HAVE_WARN_ON_FULL_BUFFER = False

def _has_warn_on_full_buffer():
if sys.version_info < (3, 7):
return False

if "__pypy__" not in sys.builtin_module_names:
# CPython has warn_on_full_buffer. Don't need to inspect.
# Also, CPython doesn't support inspecting built-in functions.
return True

import inspect

args_spec = inspect.getfullargspec(signal.set_wakeup_fd)
return "warn_on_full_buffer" in args_spec.kwonlyargs


HAVE_WARN_ON_FULL_BUFFER = _has_warn_on_full_buffer()


class WakeupSocketpair:
Expand Down
4 changes: 4 additions & 0 deletions trio/_core/tests/test_guest_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ async def trio_main(in_host):


@pytest.mark.skipif(buggy_pypy_asyncgens, reason="PyPy 7.2 is buggy")
@pytest.mark.xfail(
sys.implementation.name == "pypy" and sys.version_info >= (3, 7),
reason="async generator issue under investigation",
)
def test_guest_mode_asyncgens():
import sniffio

Expand Down

0 comments on commit 7e6191c

Please sign in to comment.