Skip to content

Commit 7f2f8b4

Browse files
committed
Merge remote-tracking branch 'origin/main' into remove_notes_to_self
2 parents 64035c2 + 7d9c4a6 commit 7f2f8b4

File tree

91 files changed

+1434
-754
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1434
-754
lines changed

.github/workflows/autodeps.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ jobs:
2424
- name: Setup python
2525
uses: actions/setup-python@v5
2626
with:
27-
python-version: "3.8"
27+
python-version: "3.9"
2828

2929
- name: Bump dependencies
3030
run: |
3131
python -m pip install -U pip pre-commit
3232
python -m pip install -r test-requirements.txt
33-
uv pip compile --universal --python-version=3.8 --upgrade test-requirements.in -o test-requirements.txt
33+
uv pip compile --universal --python-version=3.9 --upgrade test-requirements.in -o test-requirements.txt
3434
uv pip compile --universal --python-version=3.11 --upgrade docs-requirements.in -o docs-requirements.txt
3535
pre-commit autoupdate --jobs 0
3636
@@ -43,7 +43,7 @@ jobs:
4343

4444
- name: uv
4545
run: |
46-
uv pip compile --universal --python-version=3.8 test-requirements.in -o test-requirements.txt
46+
uv pip compile --universal --python-version=3.9 test-requirements.in -o test-requirements.txt
4747
uv pip compile --universal --python-version=3.11 docs-requirements.in -o docs-requirements.txt
4848
4949
- name: Commit changes and create automerge PR

.github/workflows/ci.yml

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,28 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
python: ['pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12']
21+
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
2222
arch: ['x86', 'x64']
2323
lsp: ['']
2424
lsp_extract_file: ['']
2525
extra_name: ['']
2626
include:
27-
- python: '3.8'
27+
- python: '3.9'
2828
arch: 'x64'
2929
lsp: 'https://raw.githubusercontent.com/python-trio/trio-ci-assets/master/komodia-based-vpn-setup.zip'
3030
lsp_extract_file: 'komodia-based-vpn-setup.exe'
3131
extra_name: ', with Komodia LSP'
32-
- python: '3.8'
32+
- python: '3.9'
3333
arch: 'x64'
3434
lsp: 'https://www.proxifier.com/download/legacy/ProxifierSetup342.exe'
3535
lsp_extract_file: ''
3636
extra_name: ', with IFS LSP'
37-
#- python: '3.8'
37+
- python: 'pypy-3.10'
38+
arch: 'x64'
39+
lsp: ''
40+
lsp_extract_file: ''
41+
extra_name: ''
42+
#- python: '3.9'
3843
# arch: 'x64'
3944
# lsp: 'http://download.pctools.com/mirror/updates/9.0.0.2308-SDavfree-lite_en.exe'
4045
# lsp_extract_file: ''
@@ -87,16 +92,16 @@ jobs:
8792
strategy:
8893
fail-fast: false
8994
matrix:
90-
python: ['pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
95+
python: ['pypy-3.10', '3.9', '3.10', '3.11', '3.12', '3.13']
9196
check_formatting: ['0']
9297
no_test_requirements: ['0']
9398
extra_name: ['']
9499
include:
95-
- python: '3.12'
100+
- python: '3.13'
96101
check_formatting: '1'
97102
extra_name: ', check formatting'
98103
# separate test run that doesn't install test-requirements.txt
99-
- python: '3.8'
104+
- python: '3.9'
100105
no_test_requirements: '1'
101106
extra_name: ', no test-requirements'
102107
continue-on-error: >-
@@ -143,7 +148,7 @@ jobs:
143148
strategy:
144149
fail-fast: false
145150
matrix:
146-
python: ['pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12']
151+
python: ['pypy-3.10', '3.9', '3.10', '3.11', '3.12', '3.13']
147152
continue-on-error: >-
148153
${{
149154
(
@@ -203,7 +208,15 @@ jobs:
203208
strategy:
204209
fail-fast: false
205210
matrix:
206-
python: ['3.8', '3.12']
211+
include:
212+
- python: '3.9' # We support running on cython 2 and 3 for 3.9
213+
cython: '<3' # cython 2
214+
- python: '3.9'
215+
cython: '>=3' # cython 3 (or greater)
216+
- python: '3.11' # 3.11 is the last version Cy2 supports
217+
cython: '<3' # cython 2
218+
- python: '3.13' # We support running cython3 on 3.13
219+
cython: '>=3' # cython 3 (or greater)
207220
steps:
208221
- name: Checkout
209222
uses: actions/checkout@v4
@@ -216,18 +229,11 @@ jobs:
216229
- name: install trio and setuptools
217230
run: python -m pip install --upgrade pip . setuptools
218231

219-
- name: install cython<3
220-
run: python -m pip install "cython<3"
221-
- name: compile pyx file
222-
run: cythonize -i tests/cython/test_cython.pyx
223-
- name: import & run module
224-
run: python -c 'import tests.cython.test_cython'
232+
- name: install cython & compile pyx file
233+
run: |
234+
python -m pip install "cython${{ matrix.cython }}"
235+
cythonize --inplace tests/cython/test_cython.pyx
225236
226-
- name: install cython>=3
227-
run: python -m pip install "cython>=3"
228-
- name: compile pyx file
229-
# different cython version should trigger a re-compile, but --force just in case
230-
run: cythonize --inplace --force tests/cython/test_cython.pyx
231237
- name: import & run module
232238
run: python -c 'import tests.cython.test_cython'
233239

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v4
1313
- uses: actions/setup-python@v5
1414
with:
15-
python-version: "3.8"
15+
python-version: "3.9"
1616
- run: python -m pip install build
1717
- run: python -m build
1818

.pre-commit-config.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
ci:
2-
autofix_commit_msg: "[pre-commit.ci] auto fixes from pre-commit.com hooks"
3-
autofix_prs: false
4-
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
2+
autofix_prs: true
53
autoupdate_schedule: weekly
64
submodules: false
75
skip: [regenerate-files]
@@ -24,7 +22,7 @@ repos:
2422
hooks:
2523
- id: black
2624
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: v0.6.9
25+
rev: v0.8.0
2826
hooks:
2927
- id: ruff
3028
types: [file]

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ demonstration of implementing the "Happy Eyeballs" algorithm in an
9292
older library versus Trio.
9393

9494
**Cool, but will it work on my system?** Probably! As long as you have
95-
some kind of Python 3.8-or-better (CPython or `currently maintained versions of
95+
some kind of Python 3.9-or-better (CPython or `currently maintained versions of
9696
PyPy3 <https://doc.pypy.org/en/latest/faq.html#which-python-versions-does-pypy-implement>`__
9797
are both fine), and are using Linux, macOS, Windows, or FreeBSD, then Trio
9898
will work. Other environments might work too, but those

check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fi
7878

7979
# Check pip compile is consistent
8080
echo "::group::Pip Compile - Tests"
81-
uv pip compile --universal --python-version=3.8 test-requirements.in -o test-requirements.txt
81+
uv pip compile --universal --python-version=3.9 test-requirements.in -o test-requirements.txt
8282
echo "::endgroup::"
8383
echo "::group::Pip Compile - Docs"
8484
uv pip compile --universal --python-version=3.11 docs-requirements.in -o docs-requirements.txt

docs-requirements.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file was autogenerated by uv via the following command:
22
# uv pip compile --universal --python-version=3.11 docs-requirements.in -o docs-requirements.txt
3-
alabaster==0.7.16
3+
alabaster==1.0.0
44
# via sphinx
55
attrs==24.2.0
66
# via
@@ -16,17 +16,17 @@ cffi==1.17.1 ; platform_python_implementation != 'PyPy' or os_name == 'nt'
1616
# via
1717
# -r docs-requirements.in
1818
# cryptography
19-
charset-normalizer==3.3.2
19+
charset-normalizer==3.4.0
2020
# via requests
2121
click==8.1.7
2222
# via towncrier
2323
colorama==0.4.6 ; sys_platform == 'win32' or platform_system == 'Windows'
2424
# via
2525
# click
2626
# sphinx
27-
cryptography==43.0.1
27+
cryptography==43.0.3
2828
# via pyopenssl
29-
docutils==0.20.1
29+
docutils==0.21.2
3030
# via
3131
# sphinx
3232
# sphinx-rtd-theme
@@ -38,14 +38,14 @@ idna==3.10
3838
# requests
3939
imagesize==1.4.1
4040
# via sphinx
41-
immutables==0.20
41+
immutables==0.21
4242
# via -r docs-requirements.in
4343
jinja2==3.1.4
4444
# via
4545
# -r docs-requirements.in
4646
# sphinx
4747
# towncrier
48-
markupsafe==2.1.5
48+
markupsafe==3.0.2
4949
# via jinja2
5050
outcome==1.3.0.post0
5151
# via -r docs-requirements.in
@@ -67,7 +67,7 @@ sortedcontainers==2.4.0
6767
# via -r docs-requirements.in
6868
soupsieve==2.6
6969
# via beautifulsoup4
70-
sphinx==7.4.7
70+
sphinx==8.1.3
7171
# via
7272
# -r docs-requirements.in
7373
# sphinx-codeautolink
@@ -79,7 +79,7 @@ sphinx-codeautolink==0.15.2
7979
# via -r docs-requirements.in
8080
sphinx-hoverxref==1.4.1
8181
# via -r docs-requirements.in
82-
sphinx-rtd-theme==3.0.0
82+
sphinx-rtd-theme==3.0.1
8383
# via -r docs-requirements.in
8484
sphinxcontrib-applehelp==2.0.0
8585
# via sphinx

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Vital statistics:
4545

4646
* Supported environments: We test on
4747

48-
- Python: 3.8+ (CPython and PyPy)
48+
- Python: 3.9+ (CPython and PyPy)
4949
- Windows, macOS, Linux (glibc and musl), FreeBSD
5050

5151
Other environments might also work; give it a try and see.

docs/source/reference-lowlevel.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,46 @@ These transitions are accomplished using two function decorators:
377377
poorly-timed :exc:`KeyboardInterrupt` could leave the lock in an
378378
inconsistent state and cause a deadlock.
379379

380+
Since KeyboardInterrupt protection is tracked per code object, any attempt to
381+
conditionally protect the same block of code in different ways is unlikely to behave
382+
how you expect. If you try to conditionally protect a closure, it will be
383+
unconditionally protected instead::
384+
385+
def example(protect: bool) -> bool:
386+
def inner() -> bool:
387+
return trio.lowlevel.currently_ki_protected()
388+
if protect:
389+
inner = trio.lowlevel.enable_ki_protection(inner)
390+
return inner()
391+
392+
async def amain():
393+
assert example(False) == False
394+
assert example(True) == True # once protected ...
395+
assert example(False) == True # ... always protected
396+
397+
trio.run(amain)
398+
399+
If you really need conditional protection, you can achieve it by giving each
400+
KI-protected instance of the closure its own code object::
401+
402+
def example(protect: bool) -> bool:
403+
def inner() -> bool:
404+
return trio.lowlevel.currently_ki_protected()
405+
if protect:
406+
inner.__code__ = inner.__code__.replace()
407+
inner = trio.lowlevel.enable_ki_protection(inner)
408+
return inner()
409+
410+
async def amain():
411+
assert example(False) == False
412+
assert example(True) == True
413+
assert example(False) == False
414+
415+
trio.run(amain)
416+
417+
(This isn't done by default because it carries some memory overhead and reduces
418+
the potential for specializing optimizations in recent versions of CPython.)
419+
380420
.. autofunction:: currently_ki_protected
381421

382422

docs/source/tutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Okay, ready? Let's get started.
8888
Before you begin
8989
----------------
9090

91-
1. Make sure you're using Python 3.8 or newer.
91+
1. Make sure you're using Python 3.9 or newer.
9292

9393
2. ``python3 -m pip install --upgrade trio`` (or on Windows, maybe
9494
``py -3 -m pip install --upgrade trio`` – `details

0 commit comments

Comments
 (0)