mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #22435: Fix a file descriptor leak when SocketServer bind fails.
This commit is contained in:
commit
acbf5235b8
3 changed files with 18 additions and 2 deletions
|
@ -439,8 +439,12 @@ class TCPServer(BaseServer):
|
|||
self.socket = socket.socket(self.address_family,
|
||||
self.socket_type)
|
||||
if bind_and_activate:
|
||||
self.server_bind()
|
||||
self.server_activate()
|
||||
try:
|
||||
self.server_bind()
|
||||
self.server_activate()
|
||||
except:
|
||||
self.server_close()
|
||||
raise
|
||||
|
||||
def server_bind(self):
|
||||
"""Called by constructor to bind the socket.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue