| 318 | _ProactorBasePipeTransport._call_connection_lost), which is harmless but |
| 319 | verbose on Python/Windows when a remote host force-closes a socket.""" |
| 320 | def handler(loop, context): |
| 321 | exc = context.get("exception") |
| 322 | cb = context.get("handle") or context.get("source_traceback", "") |
| 323 | if ( |
| 324 | isinstance(exc, ConnectionResetError) |
| 325 | and "_call_connection_lost" in str(cb) |
| 326 | ): |
| 327 | return # suppress: benign Windows socket cleanup race |
| 328 | log.error("[asyncio] %s", context.get("message", context)) |
| 329 | if exc: |
| 330 | loop.default_exception_handler(context) |
| 331 | return handler |
| 332 | |
| 333 | |