File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ trio-asyncio (0.7.5-1) unstable; urgency=medium
2+
3+ * trio.hazmat.Result is deprecated.
4+
5+ -- Matthias Urlichs <matthias@urlichs.de> Mon, 23 Jul 2018 20:54:55 +0200
6+
17trio-asyncio (0.7.4-5) unstable; urgency=medium
28
39 * Debianization
Original file line number Diff line number Diff line change 11# This file is imported from __init__.py and exec'd from setup.py
22
3- __version__ = "0.7.4 "
3+ __version__ = "0.7.5 "
Original file line number Diff line number Diff line change 22import sys
33import threading
44import weakref
5+ import outcome
56
67import trio
78
@@ -37,7 +38,8 @@ def _compute_returncode(status):
3738 raise UnknownStatus (status )
3839
3940
40- NOT_FOUND = trio .hazmat .Error (ChildProcessError ())
41+ def NOT_FOUND ():
42+ return outcome .Error (ChildProcessError ())
4143
4244
4345class ProcessWaiter :
@@ -131,7 +133,7 @@ def _wait_pid(self, blocking):
131133 except ChildProcessError :
132134 # The child process may already be reaped
133135 # (may happen if waitpid() is called elsewhere).
134- self .__result = NOT_FOUND
136+ self .__result = NOT_FOUND ()
135137 else :
136138 if pid == 0 :
137139 # The child process is still alive.
@@ -141,7 +143,7 @@ def _wait_pid(self, blocking):
141143
142144 def _handle_exitstatus (self , sts ):
143145 """This overrides an internal API of subprocess.Popen"""
144- self .__result = trio . hazmat . Result .capture (_compute_returncode , sts )
146+ self .__result = outcome .capture (_compute_returncode , sts )
145147
146148 @property
147149 def returncode (self ):
Original file line number Diff line number Diff line change 22import queue
33import asyncio
44import threading
5+ import outcome
56
67from .base import BaseTrioEventLoop
78from .handles import Handle
@@ -135,7 +136,7 @@ async def _run_coroutine(self, future):
135136 def is_done (_ ):
136137 nonlocal result
137138
138- result = trio . hazmat . Result .capture (future .result )
139+ result = outcome .capture (future .result )
139140 self .stop ()
140141
141142 future .add_done_callback (is_done )
@@ -198,11 +199,11 @@ async def __trio_thread_main(self):
198199 break
199200 async_fn , args = req
200201
201- result = await trio . hazmat . Result .acapture (async_fn , * args )
202- if type (result ) == trio . hazmat .Error and type (result .error ) == trio .Cancelled :
202+ result = await outcome .acapture (async_fn , * args )
203+ if type (result ) == outcome .Error and type (result .error ) == trio .Cancelled :
203204 res = RuntimeError ("Main loop cancelled" )
204205 res .__cause__ = result .error .__cause__
205- result = trio . hazmat .Error (res )
206+ result = outcome .Error (res )
206207 self .__blocking_result_queue .put (result )
207208 with trio .open_cancel_scope (shield = True ):
208209 await self ._main_loop_exit ()
Original file line number Diff line number Diff line change 44import trio
55import asyncio
66import sys
7+ import outcome
78from async_generator import async_generator , yield_
89
910__all__ = ['run_future' ]
@@ -20,7 +21,7 @@ async def run_future(future):
2021 raise_cancel = None
2122
2223 def done_cb (_ ):
23- trio .hazmat .reschedule (task , trio . hazmat . Result .capture (future .result ))
24+ trio .hazmat .reschedule (task , outcome .capture (future .result ))
2425
2526 future .add_done_callback (done_cb )
2627
@@ -60,14 +61,14 @@ async def run_generator(loop, async_generator):
6061 async def consume_next ():
6162 try :
6263 item = await async_generator .__anext__ ()
63- result = trio . hazmat .Value (value = item )
64+ result = outcome .Value (value = item )
6465 except StopAsyncIteration :
65- result = trio . hazmat .Value (value = STOP )
66+ result = outcome .Value (value = STOP )
6667 except asyncio .CancelledError :
6768 # Once we are cancelled, we do not call reschedule() anymore
6869 return
6970 except Exception as e :
70- result = trio . hazmat .Error (error = e )
71+ result = outcome .Error (error = e )
7172
7273 trio .hazmat .reschedule (task , result )
7374
You can’t perform that action at this time.
0 commit comments