|
80 | 80 |
|
81 | 81 | PosArgT = TypeVarTuple("PosArgT")
|
82 | 82 |
|
83 |
| - # Needs to be guarded, since Unpack[] would be evaluated at runtime. |
84 |
| - class _NurseryStartFunc(Protocol[Unpack[PosArgT], StatusT_co]): |
85 |
| - """Type of functions passed to `nursery.start() <trio.Nursery.start>`.""" |
86 |
| - |
87 |
| - def __call__( |
88 |
| - self, *args: Unpack[PosArgT], task_status: TaskStatus[StatusT_co] |
89 |
| - ) -> Awaitable[object]: |
90 |
| - ... |
91 |
| - |
92 | 83 |
|
93 | 84 | DEADLINE_HEAP_MIN_PRUNE_THRESHOLD: Final = 1000
|
94 | 85 |
|
@@ -937,7 +928,7 @@ class NurseryManager:
|
937 | 928 |
|
938 | 929 | """
|
939 | 930 |
|
940 |
| - strict_exception_groups: bool = attr.ib(default=False) |
| 931 | + strict_exception_groups: bool = attr.ib(default=True) |
941 | 932 |
|
942 | 933 | @enable_ki_protection
|
943 | 934 | async def __aenter__(self) -> Nursery:
|
@@ -1004,9 +995,10 @@ def open_nursery(
|
1004 | 995 | have exited.
|
1005 | 996 |
|
1006 | 997 | Args:
|
1007 |
| - strict_exception_groups (bool): If true, even a single raised exception will be |
1008 |
| - wrapped in an exception group. This will eventually become the default |
1009 |
| - behavior. If not specified, uses the value passed to :func:`run`. |
| 998 | + strict_exception_groups (bool): Unless set to False, even a single raised exception |
| 999 | + will be wrapped in an exception group. If not specified, uses the value passed |
| 1000 | + to :func:`run`, which defaults to true. Setting it to False will be deprecated |
| 1001 | + and ultimately removed in a future version of Trio. |
1010 | 1002 |
|
1011 | 1003 | """
|
1012 | 1004 | if strict_exception_groups is None:
|
@@ -2171,7 +2163,7 @@ def run(
|
2171 | 2163 | clock: Clock | None = None,
|
2172 | 2164 | instruments: Sequence[Instrument] = (),
|
2173 | 2165 | restrict_keyboard_interrupt_to_checkpoints: bool = False,
|
2174 |
| - strict_exception_groups: bool = False, |
| 2166 | + strict_exception_groups: bool = True, |
2175 | 2167 | ) -> RetT:
|
2176 | 2168 | """Run a Trio-flavored async function, and return the result.
|
2177 | 2169 |
|
@@ -2228,9 +2220,10 @@ def run(
|
2228 | 2220 | main thread (this is a Python limitation), or if you use
|
2229 | 2221 | :func:`open_signal_receiver` to catch SIGINT.
|
2230 | 2222 |
|
2231 |
| - strict_exception_groups (bool): If true, nurseries will always wrap even a single |
2232 |
| - raised exception in an exception group. This can be overridden on the level of |
2233 |
| - individual nurseries. This will eventually become the default behavior. |
| 2223 | + strict_exception_groups (bool): Unless set to False, nurseries will always wrap |
| 2224 | + even a single raised exception in an exception group. This can be overridden |
| 2225 | + on the level of individual nurseries. Setting it to False will be deprecated |
| 2226 | + and ultimately removed in a future version of Trio. |
2234 | 2227 |
|
2235 | 2228 | Returns:
|
2236 | 2229 | Whatever ``async_fn`` returns.
|
@@ -2288,7 +2281,7 @@ def start_guest_run(
|
2288 | 2281 | clock: Clock | None = None,
|
2289 | 2282 | instruments: Sequence[Instrument] = (),
|
2290 | 2283 | restrict_keyboard_interrupt_to_checkpoints: bool = False,
|
2291 |
| - strict_exception_groups: bool = False, |
| 2284 | + strict_exception_groups: bool = True, |
2292 | 2285 | ) -> None:
|
2293 | 2286 | """Start a "guest" run of Trio on top of some other "host" event loop.
|
2294 | 2287 |
|
|
0 commit comments