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.
| Name |
Last commit
|
Last Update |
|---|---|---|
| .github | Loading commit data... | |
| assets | Loading commit data... | |
| docs | Loading commit data... | |
| src/poetry | Loading commit data... | |
| tests | Loading commit data... | |
| .cirrus.yml | Loading commit data... | |
| .flake8 | Loading commit data... | |
| .gitignore | Loading commit data... | |
| .pre-commit-config.yaml | Loading commit data... | |
| CHANGELOG.md | Loading commit data... | |
| CODE_OF_CONDUCT.md | Loading commit data... | |
| CONTRIBUTING.md | Loading commit data... | |
| LICENSE | Loading commit data... | |
| README.md | Loading commit data... | |
| get-poetry.py | Loading commit data... | |
| install-poetry.py | Loading commit data... | |
| poetry.lock | Loading commit data... | |
| pyproject.toml | Loading commit data... | |
| tox.ini | Loading commit data... |