authenticator.py
6.63 KB
-
fix: "ResourceWarning: unclosed SSLSocket" · 3eb14542
Relates to: #2153 When running `poetry update`, during the download phase when `PYTHONWARNINGS="default"` environment variable is set, multiple different sessions trigger resource warnings. This fixes one of them that occurs during the download phase of the package update. ``` /Users/username/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:594: ResourceWarning: unclosed <ssl.SSLSocket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('REDACTED', 59025), raddr=('140.108.3.33', 80)> ``` This line references: ``` 593 │ try: 594 │ archive = self._download_archive(operation, link) 595 │ except BaseException: 596 │ cache_directory = self._chef.get_cache_directory_for_link(link) ``` The issue is being caused because the session is being left open when the class is later cleaned up. By adding a destructor method, we can close the session if it exists, preventing this error.Kevin Kirsche committed