| 1818 | self.check_sendall_interrupted(True) |
| 1819 | |
| 1820 | def test_dealloc_warn(self): |
| 1821 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 1822 | r = repr(sock) |
| 1823 | with self.assertWarns(ResourceWarning) as cm: |
| 1824 | sock = None |
| 1825 | support.gc_collect() |
| 1826 | self.assertIn(r, str(cm.warning.args[0])) |
| 1827 | # An open socket file object gets dereferenced after the socket |
| 1828 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 1829 | f = sock.makefile('rb') |
| 1830 | r = repr(sock) |
| 1831 | sock = None |
| 1832 | support.gc_collect() |
| 1833 | with self.assertWarns(ResourceWarning): |
| 1834 | f = None |
| 1835 | support.gc_collect() |
| 1836 | |
| 1837 | def test_name_closed_socketio(self): |
| 1838 | with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: |