diff --git a/importlib_metadata/__init__.py b/importlib_metadata/__init__.py index c2c4b1e9..94818f62 100644 --- a/importlib_metadata/__init__.py +++ b/importlib_metadata/__init__.py @@ -19,7 +19,7 @@ import posixpath import collections -from .compat.py38 import relative_fix +from .compat.py311 import relative_fix from . import _adapters, _meta, _py39compat from ._collections import FreezableDefaultDict, Pair from ._compat import ( diff --git a/importlib_metadata/compat/py38.py b/importlib_metadata/compat/py311.py similarity index 53% rename from importlib_metadata/compat/py38.py rename to importlib_metadata/compat/py311.py index 2499c3f6..d4b6f359 100644 --- a/importlib_metadata/compat/py38.py +++ b/importlib_metadata/compat/py311.py @@ -6,10 +6,9 @@ def wrap(path): """ - Workaround for https://github.com/python/cpython/issues/67271 where ".." - isn't added by pathlib.Path.relative_to() when path is not - a subpath of root. - One example of such a package is dask-labextension, which uses + Workaround for https://github.com/python/cpython/issues/84538 + to add backward compatibility for walk_up=True. + An example affected package is dask-labextension, which uses jupyter-packaging to install JupyterLab javascript files outside of site-packages. """ @@ -20,4 +19,4 @@ def relative_to(root, *, walk_up=False): return types.SimpleNamespace(relative_to=relative_to) -relative_fix = wrap if sys.version_info < (3, 9) else lambda x: x +relative_fix = wrap if sys.version_info < (3, 12) else lambda x: x