Skip to content

Commit 142a9ca

Browse files
spaceonemistotebe
authored andcommitted
fix(ldif): explicitly close sockets after fetching URLs
fixes resource warnings in Python 3.14
1 parent 7ab1fa9 commit 142a9ca

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/ldif.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ def _next_key_and_value(self):
373373
if self._process_url_schemes:
374374
u = urlparse(url)
375375
if u[0] in self._process_url_schemes:
376-
attr_value = urlopen(url).read()
376+
with urlopen(url) as fd:
377+
attr_value = fd.read()
377378
else:
378379
# All values should be valid ascii; we support UTF-8 as a
379380
# non-official, backwards compatibility layer.

0 commit comments

Comments
 (0)