Commit 10550cd
committed
Issue #23834: Simplify timeout handling
* Use the new _PyTime_FromSeconds() function to set the timeout to -1 second
for socket.settimeout(None). It avoids a special case in internal_select()
because of a rounding issue: -1 nanosecond is rounded to 0 millisecond which
means non-blocking, instead of blocking.
* Check if the interval the negative in sock_call_ex() instead of doing the
check in internal_select(). sock_call_ex() remembers if the socket has a
timeout or not, which avoids a race condition if the timeout is modified in a
different thread.1 parent 13019fd commit 10550cd
1 file changed
Lines changed: 13 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | 632 | | |
644 | 633 | | |
645 | 634 | | |
| |||
654 | 643 | | |
655 | 644 | | |
656 | 645 | | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
| 646 | + | |
661 | 647 | | |
662 | 648 | | |
663 | 649 | | |
664 | 650 | | |
665 | 651 | | |
666 | 652 | | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
| 653 | + | |
673 | 654 | | |
674 | 655 | | |
675 | 656 | | |
| |||
741 | 722 | | |
742 | 723 | | |
743 | 724 | | |
744 | | - | |
745 | | - | |
746 | 725 | | |
| 726 | + | |
| 727 | + | |
747 | 728 | | |
748 | 729 | | |
749 | 730 | | |
| |||
753 | 734 | | |
754 | 735 | | |
755 | 736 | | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
756 | 745 | | |
757 | | - | |
758 | | - | |
759 | 746 | | |
760 | | - | |
761 | 747 | | |
762 | 748 | | |
763 | 749 | | |
| |||
2332 | 2318 | | |
2333 | 2319 | | |
2334 | 2320 | | |
2335 | | - | |
| 2321 | + | |
2336 | 2322 | | |
2337 | 2323 | | |
2338 | 2324 | | |
| |||
0 commit comments