Skip to content

ResourceWarning in test.test_ucn.UnicodeNamesTest.test_named_sequences_full (when http request 404s) #131807

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

Closed
graingert opened this issue Mar 27, 2025 · 0 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@graingert
Copy link
Contributor

graingert commented Mar 27, 2025

Bug report

Bug description:

$ PYTHONTRACEMALLOC=25 ./python -Walways -m unittest test.test_ucn -vvv
test_aliases (test.test_ucn.UnicodeNamesTest.test_aliases) ... ok
test_aliases_names_in_pua_range (test.test_ucn.UnicodeNamesTest.test_aliases_names_in_pua_range) ... ok
test_ascii_letters (test.test_ucn.UnicodeNamesTest.test_ascii_letters) ... ok
test_bmp_characters (test.test_ucn.UnicodeNamesTest.test_bmp_characters) ... ok
test_cjk_unified_ideographs (test.test_ucn.UnicodeNamesTest.test_cjk_unified_ideographs) ... ok
test_errors (test.test_ucn.UnicodeNamesTest.test_errors) ... ok
test_general (test.test_ucn.UnicodeNamesTest.test_general) ... ok
test_hangul_syllables (test.test_ucn.UnicodeNamesTest.test_hangul_syllables) ... ok
test_issue16335 (test.test_ucn.UnicodeNamesTest.test_issue16335) ... skipped 'not enough memory: 12.0G minimum needed'
test_misc_symbols (test.test_ucn.UnicodeNamesTest.test_misc_symbols) ... ok
test_named_sequences_full (test.test_ucn.UnicodeNamesTest.test_named_sequences_full) ... 	fetching http://www.pythontest.net/unicode/15.1.0/NamedSequences.txt ...
skipped "Could not retrieve http://www.pythontest.net/unicode/15.1.0/NamedSequences.txt e=<HTTPError 404: 'Not Found'>"
test_named_sequences_names_in_pua_range (test.test_ucn.UnicodeNamesTest.test_named_sequences_names_in_pua_range) ... ok
test_named_sequences_sample (test.test_ucn.UnicodeNamesTest.test_named_sequences_sample) ... ok
test_strict_error_handling (test.test_ucn.UnicodeNamesTest.test_strict_error_handling) ... ok

----------------------------------------------------------------------
Ran 14 tests in 4.010s

OK (skipped=2)
<sys>:0: ResourceWarning: unclosed <socket.socket [closed] fd=3, family=2, type=1, proto=6>
Object allocated at (most recent call last):
  File "/home/graingert/projects/cpython/Lib/unittest/main.py", lineno 270
    self.result = testRunner.run(self.test)
  File "/home/graingert/projects/cpython/Lib/unittest/runner.py", lineno 240
    test(result)
  File "/home/graingert/projects/cpython/Lib/unittest/suite.py", lineno 84
    return self.run(*args, **kwds)
  File "/home/graingert/projects/cpython/Lib/unittest/suite.py", lineno 122
    test(result)
  File "/home/graingert/projects/cpython/Lib/unittest/suite.py", lineno 84
    return self.run(*args, **kwds)
  File "/home/graingert/projects/cpython/Lib/unittest/suite.py", lineno 122
    test(result)
  File "/home/graingert/projects/cpython/Lib/unittest/suite.py", lineno 84
    return self.run(*args, **kwds)
  File "/home/graingert/projects/cpython/Lib/unittest/suite.py", lineno 122
    test(result)
  File "/home/graingert/projects/cpython/Lib/unittest/case.py", lineno 707
    return self.run(*args, **kwds)
  File "/home/graingert/projects/cpython/Lib/unittest/case.py", lineno 651
    self._callTestMethod(testMethod)
  File "/home/graingert/projects/cpython/Lib/unittest/case.py", lineno 606
    if method() is not None:
  File "/home/graingert/projects/cpython/Lib/test/test_ucn.py", lineno 182
    testdata = support.open_urlresource(url, encoding="utf-8",
  File "/home/graingert/projects/cpython/Lib/test/support/__init__.py", lineno 741
    f = opener.open(url, timeout=INTERNET_TIMEOUT)
  File "/home/graingert/projects/cpython/Lib/urllib/request.py", lineno 489
    response = self._open(req, data)
  File "/home/graingert/projects/cpython/Lib/urllib/request.py", lineno 506
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/home/graingert/projects/cpython/Lib/urllib/request.py", lineno 466
    result = func(*args)
  File "/home/graingert/projects/cpython/Lib/urllib/request.py", lineno 1348
    return self.do_open(http.client.HTTPConnection, req)
  File "/home/graingert/projects/cpython/Lib/urllib/request.py", lineno 1319
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/home/graingert/projects/cpython/Lib/http/client.py", lineno 1338
    self._send_request(method, url, body, headers, encode_chunked)
  File "/home/graingert/projects/cpython/Lib/http/client.py", lineno 1384
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/home/graingert/projects/cpython/Lib/http/client.py", lineno 1333
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/home/graingert/projects/cpython/Lib/http/client.py", lineno 1093
    self.send(msg)
  File "/home/graingert/projects/cpython/Lib/http/client.py", lineno 1037
    self.connect()
  File "/home/graingert/projects/cpython/Lib/http/client.py", lineno 1003
    self.sock = self._create_connection(
  File "/home/graingert/projects/cpython/Lib/socket.py", lineno 844
    sock = socket(af, socktype, proto)

CPython versions tested on:

3.14, CPython main branch, 3.13

Operating systems tested on:

No response

Linked PRs

@graingert graingert added the type-bug An unexpected behavior, bug, or error label Mar 27, 2025
@picnixz picnixz added the tests Tests in the Lib/test dir label Mar 28, 2025
vstinner added a commit that referenced this issue Mar 28, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 28, 2025
(cherry picked from commit adb67ed)

Co-authored-by: Thomas Grainger <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 28, 2025
(cherry picked from commit adb67ed)

Co-authored-by: Thomas Grainger <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this issue Mar 28, 2025
…1846)

gh-131807: fix ResourceWarning in test_ucn.py (GH-131808)
(cherry picked from commit adb67ed)

Co-authored-by: Thomas Grainger <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this issue Mar 28, 2025
…1845)

gh-131807: fix ResourceWarning in test_ucn.py (GH-131808)
(cherry picked from commit adb67ed)

Co-authored-by: Thomas Grainger <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants