GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Avoid ResourceWarning: Implicitly cleaning up <addinfourl ...> by hroncok · Pull Request #591 · html5lib/html5lib-python

Conversation

@hroncok

@hroncok hroncok commented Jan 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Close the urllib.response.addinfourl by using a context manager.

Without this:

=================================== FAILURES ===================================
_________________________________ test session _________________________________
/usr/lib64/python3.14/tempfile.py:484: in __del__
    _warnings.warn(self.warn_message, ResourceWarning)
E   ResourceWarning: Implicitly cleaning up <addinfourl at 281473371898608 whose fp = <http.client.HTTPResponse object at 0xffff9fe82470>>
The above exception was the direct cause of the following exception:
/usr/lib/python3.14/site-packages/_pytest/runner.py:344: in from_call
    result: TResult | None = func()
                             ^^^^^^
/usr/lib/python3.14/site-packages/_pytest/runner.py:246: in <lambda>
    lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/pluggy/_hooks.py:512: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/_pytest/logging.py:850: in pytest_runtest_call
    yield
/usr/lib/python3.14/site-packages/_pytest/capture.py:900: in pytest_runtest_call
    return (yield)
            ^^^^^
/usr/lib/python3.14/site-packages/_pytest/skipping.py:263: in pytest_runtest_call
    return (yield)
            ^^^^^
/usr/lib/python3.14/site-packages/_pytest/unraisableexception.py:158: in pytest_runtest_call
    collect_unraisable(item.config)
/usr/lib/python3.14/site-packages/_pytest/unraisableexception.py:79: in collect_unraisable
    raise errors[0]
/usr/lib/python3.14/site-packages/_pytest/unraisableexception.py:67: in collect_unraisable
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E   pytest.PytestUnraisableExceptionWarning: Exception ignored while calling deallocator <function _TemporaryFileCloser.__del__ at 0xffffa6b34720>: None

CPython reference: python/cpython@bad3cde

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hroncok
Avoid ResourceWarning: Implicitly cleaning up <addinfourl ...>
90be7e7
Close the urllib.response.addinfourl by using a context manager.

Without this:

    =================================== FAILURES ===================================
    _________________________________ test session _________________________________
    /usr/lib64/python3.14/tempfile.py:484: in __del__
        _warnings.warn(self.warn_message, ResourceWarning)
    E   ResourceWarning: Implicitly cleaning up <addinfourl at 281473371898608 whose fp = <http.client.HTTPResponse object at 0xffff9fe82470>>
    The above exception was the direct cause of the following exception:
    /usr/lib/python3.14/site-packages/_pytest/runner.py:344: in from_call
        result: TResult | None = func()
                                 ^^^^^^
    /usr/lib/python3.14/site-packages/_pytest/runner.py:246: in <lambda>
        lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    /usr/lib/python3.14/site-packages/pluggy/_hooks.py:512: in __call__
        return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    /usr/lib/python3.14/site-packages/pluggy/_manager.py:120: in _hookexec
        return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    /usr/lib/python3.14/site-packages/_pytest/logging.py:850: in pytest_runtest_call
        yield
    /usr/lib/python3.14/site-packages/_pytest/capture.py:900: in pytest_runtest_call
        return (yield)
                ^^^^^
    /usr/lib/python3.14/site-packages/_pytest/skipping.py:263: in pytest_runtest_call
        return (yield)
                ^^^^^
    /usr/lib/python3.14/site-packages/_pytest/unraisableexception.py:158: in pytest_runtest_call
        collect_unraisable(item.config)
    /usr/lib/python3.14/site-packages/_pytest/unraisableexception.py:79: in collect_unraisable
        raise errors[0]
    /usr/lib/python3.14/site-packages/_pytest/unraisableexception.py:67: in collect_unraisable
        warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
    E   pytest.PytestUnraisableExceptionWarning: Exception ignored while calling deallocator <function _TemporaryFileCloser.__del__ at 0xffffa6b34720>: None

CPython reference: python/cpython@bad3cde
@hroncok
hroncok force-pushed the close branch from 5b2832d to 90be7e7 Compare January 14, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@hroncok
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.