Skip to content

Commit 4990c61

Browse files
committed
open_cancel_scope → CancelScope
Closes: #52
1 parent fef81f9 commit 4990c61

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

debian/control

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Maintainer: Matthias Urlichs <matthias@urlichs.de>
33
Section: python
44
Priority: optional
55
Build-Depends: dh-python, python3-setuptools, python3-all, debhelper (>= 9),
6-
python3-trio (>= 0.5.0),
6+
python3-trio (>= 0.10.0),
77
python3-pytest-trio,
88
python3-pytest-runner,
99
python3-outcome,
@@ -13,7 +13,7 @@ Homepage: https://github.com/smurfix/trio-asyncio
1313
Package: python3-trio-asyncio
1414
Architecture: all
1515
Depends: ${misc:Depends}, ${python3:Depends},
16-
python3-trio (>= 0.5.0),
16+
python3-trio (>= 0.10.0),
1717
python3-outcome,
1818
Description: Re-implementation of the asyncio mainloop on top of Trio
1919
trio_asyncio allows you to call asyncio code from within Trio,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"""
5454

5555
install_requires = [
56-
"trio >= 0.9.0",
56+
"trio >= 0.10.0",
5757
"async_generator >= 1.6",
5858
"outcome",
5959
]

tests/interop/test_calls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def cancelled_future(seen):
329329
return f # contains error
330330

331331
async def check_cancel(proc, seen):
332-
with trio.open_cancel_scope() as scope:
332+
with trio.CancelScope() as scope:
333333
with pytest.raises(asyncio.CancelledError):
334334
await self.call_t_a(proc, seen, loop=loop)
335335
assert not scope.cancel_called
@@ -359,7 +359,7 @@ def cancelled_future(seen):
359359
return f # contains error
360360

361361
async def check_cancel(proc, seen):
362-
with trio.open_cancel_scope() as scope:
362+
with trio.CancelScope() as scope:
363363
with pytest.raises(asyncio.CancelledError):
364364
await self.call_t_a_depr(proc, seen, loop=loop)
365365
assert not scope.cancel_called

tests/test_misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ async def work_in_trio_no_matter_what(*, task_status=trio.TASK_STATUS_IGNORED):
311311
await trio_asyncio.aio_as_trio(work_in_asyncio)()
312312
try:
313313
# KeyboardInterrupt won't cancel this coroutine thanks to the shield
314-
with trio.open_cancel_scope(shield=True):
314+
with trio.CancelScope(shield=True):
315315
task_status.started()
316316
await asyncio_loop_closed.wait()
317317
finally:
@@ -323,7 +323,7 @@ async def work_in_asyncio():
323323
await asyncio.sleep(0)
324324

325325
async def run_asyncio_loop(nursery, *, task_status=trio.TASK_STATUS_IGNORED):
326-
with trio.open_cancel_scope() as cancel_scope:
326+
with trio.CancelScope() as cancel_scope:
327327
try:
328328
async with trio_asyncio.open_loop():
329329
# Starting a coroutine from here make it inherit the access

trio_asyncio/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ async def __run_trio(self, h):
295295
if f.cancelled(): # pragma: no cover
296296
return
297297
try:
298-
with trio.open_cancel_scope() as scope:
298+
with trio.CancelScope() as scope:
299299
h._scope = scope
300300
res = await proc(*args)
301301
if scope.cancelled_caught:
@@ -582,7 +582,7 @@ def _set_read_handle(self, fd, handle):
582582

583583
async def _reader_loop(self, fd, handle, task_status=trio.TASK_STATUS_IGNORED):
584584
task_status.started()
585-
with trio.open_cancel_scope() as scope:
585+
with trio.CancelScope() as scope:
586586
handle._scope = scope
587587
try:
588588
while not handle._cancelled: # pragma: no branch
@@ -635,7 +635,7 @@ def _set_write_handle(self, fd, handle):
635635
return writer
636636

637637
async def _writer_loop(self, fd, handle, task_status=trio.TASK_STATUS_IGNORED):
638-
with trio.open_cancel_scope() as scope:
638+
with trio.CancelScope() as scope:
639639
handle._scope = scope
640640
task_status.started()
641641
try:

trio_asyncio/handles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ async def _call_async(self, task_status=trio.TASK_STATUS_IGNORED):
110110
return
111111
task_status.started()
112112
try:
113-
with trio.open_cancel_scope() as scope:
113+
with trio.CancelScope() as scope:
114114
self._scope = scope
115115
if self._is_sync is None:
116116
await self._context.run(_set_sniff, self._callback, self)
@@ -129,7 +129,7 @@ async def _call_async(self, task_status=trio.TASK_STATUS_IGNORED):
129129
return
130130
task_status.started()
131131
try:
132-
with trio.open_cancel_scope() as scope:
132+
with trio.CancelScope() as scope:
133133
self._scope = scope
134134
if self._is_sync is None:
135135
await self._callback(self)

trio_asyncio/sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ async def __trio_thread_main(self):
205205
res.__cause__ = result.error.__cause__
206206
result = outcome.Error(res)
207207
self.__blocking_result_queue.put(result)
208-
with trio.open_cancel_scope(shield=True):
208+
with trio.CancelScope(shield=True):
209209
await self._main_loop_exit()
210210
self.__blocking_result_queue.put(None)
211211
nursery.cancel_scope.cancel()

0 commit comments

Comments
 (0)