Commit 9e4d50b
Collapse redundant OSError-subclass tuples to isinstance(e, OSError)
ConnectionError, BrokenPipeError, and TimeoutError are all OSError
subclasses, so listing them next to OSError in an isinstance tuple
or except clause is redundant. The single OSError check also picks
up ConnectionResetError, ConnectionAbortedError, ConnectionRefusedError,
InterruptedError, and socket.gaierror that the narrower enumeration
silently missed.
Cleans up is_disconnect and both do_ping except tuples (the inner
cursor.execute branch and the finally cursor.close branch). Adds a
defensive parametrised test plus a socket.gaierror pin so a future
regression that re-enumerates subclasses cannot silently shrink the
coverage.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1452410 commit 9e4d50b
2 files changed
Lines changed: 43 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | | - | |
364 | | - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
365 | 370 | | |
366 | 371 | | |
367 | 372 | | |
| |||
404 | 409 | | |
405 | 410 | | |
406 | 411 | | |
407 | | - | |
408 | 412 | | |
409 | 413 | | |
410 | 414 | | |
| |||
422 | 426 | | |
423 | 427 | | |
424 | 428 | | |
425 | | - | |
426 | 429 | | |
427 | 430 | | |
428 | 431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
351 | 387 | | |
352 | 388 | | |
353 | 389 | | |
| |||
0 commit comments