Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up allocated TLS socket @ PyPI filter #226

Closed
wants to merge 1 commit into from

Conversation

webknjaz
Copy link
Member

Invoking python -Werror -m sphinx -b spelling ... surfaces a resource warning related to not releasing the TLS socket that xmlrpc.client.ServerProxy() opens. There's no explicit mention of a cleanup method in the stdlib docs but there's one example with a context manager. I inspected the source code and it seems like we should either use a CM or a rather weird callable interface (xmlrpc.client.ServerProxy()('close')()). I opted for a CM.

[...]
Ignoring wiki words
Ignoring acronyms
Adding package names from PyPI to local dictionary…
Exception ignored in: <ssl.SSLSocket fd=3, family=2, type=1, proto=6, laddr=('192.168.1.114', 53560), raddr=('146.75.120.223', 443)>
Traceback (most recent call last):
  File "~/src/github/a/project/.tox/build-docs/lib/python3.12/site-packages/sphinxcontrib/spelling/builder.py", line 65, in init
    f.append(filters.PyPIFilterFactory())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ResourceWarning: unclosed <ssl.SSLSocket fd=3, family=2, type=1, proto=6, laddr=('192.168.1.114', 53560), raddr=('146.75.120.223', 443)>
Ignoring Python builtins
Ignoring importable module names
Ignoring contributor names
[...]

Disclaimer

This patch is coded in-browser on the GH UI w/ no testing. It might need some love and/or tests.

Invoking `python -Werror -m sphinx -b spelling ...` surfaces a resource warning related to not releasing the TLS socket that `xmlrpc.client.ServerProxy()` opens. There's no explicit mention of a cleanup method in the stdlib docs but there's one example with a context manager. I inspected the source code and it seems like we should either use a CM or a rather weird callable interface (`xmlrpc.client.ServerProxy()('close')()`). I opted for a CM.

```python-traceback
[...]
Ignoring wiki words
Ignoring acronyms
Adding package names from PyPI to local dictionary…
Exception ignored in: <ssl.SSLSocket fd=3, family=2, type=1, proto=6, laddr=('192.168.1.114', 53560), raddr=('146.75.120.223', 443)>
Traceback (most recent call last):
  File "~/src/github/a/project/.tox/build-docs/lib/python3.12/site-packages/sphinxcontrib/spelling/builder.py", line 65, in init
    f.append(filters.PyPIFilterFactory())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ResourceWarning: unclosed <ssl.SSLSocket fd=3, family=2, type=1, proto=6, laddr=('192.168.1.114', 53560), raddr=('146.75.120.223', 443)>
Ignoring Python builtins
Ignoring importable module names
Ignoring contributor names
[...]
```

## Disclaimer

This patch is coded in-browser on the GH UI w/ no testing. It might need some love and/or tests.
@dhellmann
Copy link
Member

The change looks generally OK. The linter doesn't like the line length and some of the test jobs are failing.

@webknjaz
Copy link
Member Author

I don't think I'll have time to work on this, just wanted to put it out there so it's not lost in my brain and forgotten ;)

@webknjaz
Copy link
Member Author

With #227, it doesn't make sense to fix it. XML-RPC should instead be deleted.

@webknjaz webknjaz closed this Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants