Skip to content

Commit 1584b96

Browse files
committed
Update wrapper to rely on 'relative_to(walk_up=True)' on Python 3.12 and compatibility wrapper on Python 3.11 and earlier.
1 parent 08d74cc commit 1584b96

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

importlib_metadata/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import posixpath
2020
import collections
2121

22-
from .compat.py38 import relative_fix
22+
from .compat.py311 import relative_fix
2323
from . import _adapters, _meta, _py39compat
2424
from ._collections import FreezableDefaultDict, Pair
2525
from ._compat import (
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66

77
def wrap(path):
88
"""
9-
Workaround for https://github.com/python/cpython/issues/67271 where ".."
10-
isn't added by pathlib.Path.relative_to() when path is not
11-
a subpath of root.
12-
One example of such a package is dask-labextension, which uses
9+
Workaround for https://github.com/python/cpython/issues/84538
10+
to add backward compatibility for walk_up=True.
11+
An example affected package is dask-labextension, which uses
1312
jupyter-packaging to install JupyterLab javascript files outside
1413
of site-packages.
1514
"""
@@ -20,4 +19,4 @@ def relative_to(root, *, walk_up=False):
2019
return types.SimpleNamespace(relative_to=relative_to)
2120

2221

23-
relative_fix = wrap if sys.version_info < (3, 9) else lambda x: x
22+
relative_fix = wrap if sys.version_info < (3, 12) else lambda x: x

0 commit comments

Comments
 (0)