MCPcopy
hub / github.com/python-trio/trio / close_all

Function close_all

src/trio/_highlevel_open_tcp_stream.py:120–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

118
119@contextmanager
120def close_all() -> Generator[set[SocketType], None, None]:
121 sockets_to_close: set[SocketType] = set()
122 try:
123 yield sockets_to_close
124 finally:
125 errs = []
126 for sock in sockets_to_close:
127 try:
128 sock.close()
129 except BaseException as exc:
130 errs.append(exc)
131 if len(errs) == 1:
132 raise errs[0]
133 elif errs:
134 raise BaseExceptionGroup("", errs)
135
136
137def reorder_for_rfc_6555_section_5_4( # type: ignore[explicit-any]

Callers 2

test_close_allFunction · 0.90
open_tcp_streamFunction · 0.85

Calls 1

closeMethod · 0.45

Tested by 1

test_close_allFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…