mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
bpo-31234, socket.create_connection(): Fix ref cycle (#3546)
This commit is contained in:
parent
b157ce1e58
commit
acb9fa79fa
@ -711,6 +711,8 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
|
||||
if source_address:
|
||||
sock.bind(source_address)
|
||||
sock.connect(sa)
|
||||
# Break explicitly a reference cycle
|
||||
err = None
|
||||
return sock
|
||||
|
||||
except error as _:
|
||||
|
@ -0,0 +1,2 @@
|
||||
socket.create_connection() now fixes manually a reference cycle: clear the
|
||||
variable storing the last exception on success.
|
Loading…
Reference in New Issue
Block a user