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:
|
if source_address:
|
||||||
sock.bind(source_address)
|
sock.bind(source_address)
|
||||||
sock.connect(sa)
|
sock.connect(sa)
|
||||||
|
# Break explicitly a reference cycle
|
||||||
|
err = None
|
||||||
return sock
|
return sock
|
||||||
|
|
||||||
except error as _:
|
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