Skip to content

Possible regression in MultiplexedPath.joinpath in 3.12 #106614

@frenzymadness

Description

@frenzymadness

Bug report

In Python 3.11, it's possible to use MultiplexedPath.joinpath("") (with an empty argument) and it returns the first path stored in MultiplexedPath._paths, for example:

>>> from importlib.resources import files
>>> files("jupyterlab_server.test_data")
MultiplexedPath('/usr/lib/python3.11/site-packages/jupyterlab_server/test_data')
>>> files("jupyterlab_server.test_data").joinpath("")
PosixPath('/usr/lib/python3.11/site-packages/jupyterlab_server/test_data')

But in Python 3.12, this doesn't work anymore:

>>> from importlib.resources import files
>>> files("jupyterlab_server.test_data")
MultiplexedPath('/usr/lib/python3.12/site-packages/jupyterlab_server/test_data')
>>> files("jupyterlab_server.test_data").joinpath(".")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.12/importlib/resources/readers.py", line 92, in joinpath
    return super().joinpath(*descendants)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/importlib/resources/abc.py", line 117, in joinpath
    target = next(names)
             ^^^^^^^^^^^
StopIteration

The implementation has been changed in: cea910e#diff-2e741d925220d74a9cc04cda1314d3649d9d189c0efc7db18e5387a51225b61c

Your environment

Python 3.12 beta 3 installed from Fedora RPM, Fedora 38, x86_64

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixestopic-importlibtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions