Skip to content

Commit 40b805c

Browse files
committed
Merge branch 'master' into run-types
2 parents ffb1a1f + af3d7d8 commit 40b805c

7 files changed

Lines changed: 61 additions & 50 deletions

File tree

docs-requirements.txt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# pip-compile docs-requirements.in
66
#
7-
alabaster==0.7.12
7+
alabaster==0.7.13
88
# via sphinx
99
async-generator==1.10
1010
# via -r docs-requirements.in
@@ -14,9 +14,9 @@ attrs==22.1.0
1414
# outcome
1515
babel==2.11.0
1616
# via sphinx
17-
certifi==2022.9.24
17+
certifi==2022.12.7
1818
# via requests
19-
charset-normalizer==2.1.1
19+
charset-normalizer==3.0.1
2020
# via requests
2121
click==8.1.3
2222
# via
@@ -28,7 +28,7 @@ docutils==0.17.1
2828
# via
2929
# sphinx
3030
# sphinx-rtd-theme
31-
exceptiongroup==1.0.4
31+
exceptiongroup==1.1.0
3232
# via -r docs-requirements.in
3333
idna==3.4
3434
# via
@@ -49,15 +49,13 @@ markupsafe==2.1.1
4949
# via jinja2
5050
outcome==1.2.0
5151
# via -r docs-requirements.in
52-
packaging==21.3
52+
packaging==23.0
5353
# via sphinx
54-
pygments==2.12.0
54+
pygments==2.14.0
5555
# via sphinx
56-
pyparsing==3.0.9
57-
# via packaging
58-
pytz==2022.4
56+
pytz==2022.7.1
5957
# via babel
60-
requests==2.28.1
58+
requests==2.28.2
6159
# via sphinx
6260
sniffio==1.3.0
6361
# via -r docs-requirements.in
@@ -90,7 +88,7 @@ tomli==2.0.1
9088
# via towncrier
9189
towncrier==22.8.0
9290
# via -r docs-requirements.in
93-
urllib3==1.26.13
91+
urllib3==1.26.14
9492
# via requests
9593

9694
# The following packages are considered to be unsafe in a requirements file:

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ xfail_strict = true
5656
faulthandler_timeout = 60
5757
markers = ["redistributors_should_skip: tests that should be skipped by downstream redistributors"]
5858
junit_family = "xunit2"
59-
filterwarnings = ["error"]
59+
filterwarnings = [
60+
"error",
61+
# https://gitter.im/python-trio/general?at=63bb8d0740557a3d5c688d67
62+
'ignore:You are using cryptography on a 32-bit Python on a 64-bit Windows Operating System. Cryptography will be significantly faster if you switch to using a 64-bit Python.:UserWarning',
63+
]

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@
7979
license="MIT OR Apache-2.0",
8080
packages=find_packages(),
8181
install_requires=[
82-
"attrs >= 19.2.0", # for eq
82+
# attrs 19.2.0 adds `eq` option to decorators
83+
# attrs 20.1.0 adds @frozen
84+
"attrs >= 20.1.0",
8385
"sortedcontainers",
8486
"idna",
8587
"outcome",

test-requirements.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pytest >= 5.0 # for faulthandler in core
33
pytest-cov >= 2.6.0
44
async_generator >= 1.9
55
# ipython 7.x is the last major version supporting Python 3.7
6-
ipython < 7.32 # for the IPython traceback integration tests
6+
ipython < 7.35 # for the IPython traceback integration tests
77
pyOpenSSL >= 22.0.0 # for the ssl + DTLS tests
88
trustme # for the ssl + DTLS tests
99
pylint # for pylint finding all symbols tests
@@ -25,7 +25,7 @@ typing-extensions; implementation_name == "cpython"
2525

2626
# Trio's own dependencies
2727
cffi; os_name == "nt"
28-
attrs >= 19.2.0
28+
attrs >= 20.1.0
2929
sortedcontainers
3030
idna
3131
outcome

test-requirements.txt

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,20 @@ attrs==22.1.0
1717
# pytest
1818
backcall==0.2.0
1919
# via ipython
20-
black==22.10.0 ; implementation_name == "cpython"
20+
black==22.12.0 ; implementation_name == "cpython"
2121
# via -r test-requirements.in
2222
cffi==1.15.1
2323
# via cryptography
2424
click==8.1.3
2525
# via black
2626
coverage[toml]==6.4.1
2727
# via pytest-cov
28-
cryptography==38.0.4
28+
cryptography==39.0.0
2929
# via
3030
# -r test-requirements.in
3131
# pyopenssl
3232
# trustme
33+
# types-pyopenssl
3334
decorator==5.1.1
3435
# via ipython
3536
dill==0.3.6
@@ -40,17 +41,17 @@ idna==3.4
4041
# via
4142
# -r test-requirements.in
4243
# trustme
43-
iniconfig==1.1.1
44+
iniconfig==2.0.0
4445
# via pytest
45-
ipython==7.31.1
46+
ipython==7.34.0
4647
# via -r test-requirements.in
4748
isort==5.10.1
4849
# via pylint
49-
jedi==0.18.1
50+
jedi==0.18.2
5051
# via
5152
# -r test-requirements.in
5253
# ipython
53-
lazy-object-proxy==1.7.1
54+
lazy-object-proxy==1.9.0
5455
# via astroid
5556
matplotlib-inline==0.1.6
5657
# via ipython
@@ -67,17 +68,17 @@ mypy-extensions==0.4.3 ; implementation_name == "cpython"
6768
# mypy
6869
outcome==1.2.0
6970
# via -r test-requirements.in
70-
packaging==21.3
71+
packaging==23.0
7172
# via pytest
7273
parso==0.8.3
7374
# via jedi
74-
pathspec==0.9.0
75+
pathspec==0.10.3
7576
# via black
7677
pexpect==4.8.0
7778
# via ipython
7879
pickleshare==0.7.5
7980
# via ipython
80-
platformdirs==2.5.4
81+
platformdirs==2.6.0
8182
# via
8283
# black
8384
# pylint
@@ -93,15 +94,13 @@ pycparser==2.21
9394
# via cffi
9495
pyflakes==2.4.0
9596
# via flake8
96-
pygments==2.12.0
97+
pygments==2.14.0
9798
# via ipython
9899
pylint==2.14.5
99100
# via -r test-requirements.in
100-
pyopenssl==22.1.0
101+
pyopenssl==23.0.0
101102
# via -r test-requirements.in
102-
pyparsing==3.0.9
103-
# via packaging
104-
pytest==7.2.0
103+
pytest==7.2.1
105104
# via
106105
# -r test-requirements.in
107106
# pytest-cov
@@ -113,15 +112,13 @@ sortedcontainers==2.4.0
113112
# via -r test-requirements.in
114113
tomlkit==0.11.6
115114
# via pylint
116-
traitlets==5.5.0
115+
traitlets==5.8.1
117116
# via
118117
# ipython
119118
# matplotlib-inline
120119
trustme==0.9.0
121120
# via -r test-requirements.in
122-
types-cryptography==3.3.23.1
123-
# via types-pyopenssl
124-
types-pyopenssl==22.1.0.1 ; implementation_name == "cpython"
121+
types-pyopenssl==23.0.0.1 ; implementation_name == "cpython"
125122
# via -r test-requirements.in
126123
typing-extensions==4.4.0 ; implementation_name == "cpython"
127124
# via

trio/_core/tests/test_multierror.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,12 @@ def run_script(name, use_ipython=False):
473473
return completed
474474

475475

476-
def check_simple_excepthook(completed):
476+
def check_simple_excepthook(completed, uses_ipython):
477477
assert_match_in_seq(
478478
[
479-
"in <module>",
479+
"in <cell line: "
480+
if uses_ipython and sys.version_info >= (3, 8)
481+
else "in <module>",
480482
"MultiError",
481483
"--- 1 ---",
482484
"in exc1_fn",
@@ -503,14 +505,14 @@ def check_simple_excepthook(completed):
503505
@need_ipython
504506
def test_ipython_exc_handler():
505507
completed = run_script("simple_excepthook.py", use_ipython=True)
506-
check_simple_excepthook(completed)
508+
check_simple_excepthook(completed, True)
507509

508510

509511
@slow
510512
@need_ipython
511513
def test_ipython_imported_but_unused():
512514
completed = run_script("simple_excepthook_IPython.py")
513-
check_simple_excepthook(completed)
515+
check_simple_excepthook(completed, False)
514516

515517

516518
@slow

trio/_unix_pipes.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1+
from __future__ import annotations
2+
13
import os
24
import errno
5+
from typing import TYPE_CHECKING
36

47
from ._abc import Stream
58
from ._util import ConflictDetector, Final
69

710
import trio
811

12+
if TYPE_CHECKING:
13+
from typing_extensions import Final as FinalType
14+
915
if os.name != "posix":
1016
# We raise an error here rather than gating the import in lowlevel.py
1117
# in order to keep jedi static analysis happy.
1218
raise ImportError
1319

1420
# XX TODO: is this a good number? who knows... it does match the default Linux
1521
# pipe capacity though.
16-
DEFAULT_RECEIVE_SIZE = 65536
22+
DEFAULT_RECEIVE_SIZE: FinalType = 65536
1723

1824

1925
class _FdHolder:
@@ -34,7 +40,9 @@ class _FdHolder:
3440
# impossible to make this mistake – we'll just get an EBADF.
3541
#
3642
# (This trick was copied from the stdlib socket module.)
37-
def __init__(self, fd: int):
43+
fd: int
44+
45+
def __init__(self, fd: int) -> None:
3846
# make sure self.fd is always initialized to *something*, because even
3947
# if we error out here then __del__ will run and access it.
4048
self.fd = -1
@@ -46,10 +54,10 @@ def __init__(self, fd: int):
4654
os.set_blocking(fd, False)
4755

4856
@property
49-
def closed(self):
57+
def closed(self) -> bool:
5058
return self.fd == -1
5159

52-
def _raw_close(self):
60+
def _raw_close(self) -> None:
5361
# This doesn't assume it's in a Trio context, so it can be called from
5462
# __del__. You should never call it from Trio context, because it
5563
# skips calling notify_fd_close. But from __del__, skipping that is
@@ -64,10 +72,10 @@ def _raw_close(self):
6472
os.set_blocking(fd, self._original_is_blocking)
6573
os.close(fd)
6674

67-
def __del__(self):
75+
def __del__(self) -> None:
6876
self._raw_close()
6977

70-
def close(self):
78+
def close(self) -> None:
7179
if not self.closed:
7280
trio.lowlevel.notify_closing(self.fd)
7381
self._raw_close()
@@ -93,7 +101,7 @@ class FdStream(Stream, metaclass=Final):
93101
thrust upon them. For example, you can use
94102
``FdStream(os.dup(sys.stdin.fileno()))`` to obtain a stream for reading
95103
from standard input, but it is only safe to do so with heavy caveats: your
96-
stdin must not be shared by any other processes and you must not make any
104+
stdin must not be shared by any other processes, and you must not make any
97105
calls to synchronous methods of `sys.stdin` until the stream returned by
98106
`FdStream` is closed. See `issue #174
99107
<https://github.com/python-trio/trio/issues/174>`__ for a discussion of the
@@ -106,7 +114,7 @@ class FdStream(Stream, metaclass=Final):
106114
A new `FdStream` object.
107115
"""
108116

109-
def __init__(self, fd: int):
117+
def __init__(self, fd: int) -> None:
110118
self._fd_holder = _FdHolder(fd)
111119
self._send_conflict_detector = ConflictDetector(
112120
"another task is using this stream for send"
@@ -115,7 +123,7 @@ def __init__(self, fd: int):
115123
"another task is using this stream for receive"
116124
)
117125

118-
async def send_all(self, data: bytes):
126+
async def send_all(self, data: bytes) -> None:
119127
with self._send_conflict_detector:
120128
# have to check up front, because send_all(b"") on a closed pipe
121129
# should raise
@@ -151,7 +159,7 @@ async def wait_send_all_might_not_block(self) -> None:
151159
# of sending, which is annoying
152160
raise trio.BrokenResourceError from e
153161

154-
async def receive_some(self, max_bytes=None) -> bytes:
162+
async def receive_some(self, max_bytes: int | None = None) -> bytes:
155163
with self._receive_conflict_detector:
156164
if max_bytes is None:
157165
max_bytes = DEFAULT_RECEIVE_SIZE
@@ -179,12 +187,12 @@ async def receive_some(self, max_bytes=None) -> bytes:
179187

180188
return data
181189

182-
def close(self):
190+
def close(self) -> None:
183191
self._fd_holder.close()
184192

185-
async def aclose(self):
193+
async def aclose(self) -> None:
186194
self.close()
187195
await trio.lowlevel.checkpoint()
188196

189-
def fileno(self):
197+
def fileno(self) -> int:
190198
return self._fd_holder.fd

0 commit comments

Comments
 (0)