cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Sync with importlib_metadata for Python 3.13

Open jaraco opened this issue 1 year ago • 1 comments

This issue tracks incorporating updates from importlib_metadata into CPython for Python 3.13, including:

Linked PRs

  • gh-117092
  • gh-117094

jaraco avatar Mar 20 '24 16:03 jaraco

As I started looking into what it would take to move the tests from Lib/test/test_importlib to Lib/test/test_importlib/metadata, I found that there are more instances of the mod module leaking across tests, so I'll need to deal with that too.

ERROR: test_module_resources (test.test_importlib.resources.test_files.ModulesFilesTests.test_module_resources)
A module can have resources found adjacent to the module.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jaraco/code/python/cpython/Lib/test/test_importlib/resources/test_files.py", line 88, in test_module_resources
    actual = resources.files(mod).joinpath('res.txt').read_text(encoding='utf-8')
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/python/cpython/Lib/pathlib/__init__.py", line 568, in read_text
    return _abc.PathBase.read_text(self, encoding, errors, newline)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/python/cpython/Lib/pathlib/_abc.py", line 743, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors, newline=newline) as f:
         ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/python/cpython/Lib/pathlib/__init__.py", line 559, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/f2/2plv6q2n7l932m2x004jlw340000gn/T/tmpbuigpc61/res.txt'

I found tmpbuigpc61 was left over from metadata tests.

jaraco avatar Mar 20 '24 17:03 jaraco

Triage: I think this is ready to be closed.

hugovk avatar Jun 15 '24 12:06 hugovk