Repository navigation
Conversation
facelessuser
left a comment
There was a problem hiding this comment.
This is a good find. Please make the requested adjustment so we can merge this in.
| @pytest.mark.parametrize('base', [pathlib.WindowsPath, pathlib.PosixPath]) | ||
| @pytest.mark.parametrize('depth', [1, 2]) | ||
| def test_subclass(self, base, depth, tmp_path): | ||
| """Keep platform restrictions and glob functionality when subclassing paths.""" |
There was a problem hiding this comment.
Please add "subclassing" to en-custom.txt to avoid having it cause the spell checker to fail.
There was a problem hiding this comment.
@9Kun in case you missed it, we are just needing one change in order to get this merged. We would love to get this in the next release.
|
@9Kun We are going to manually merge this PR this time, but if you plan to contribute in the future, we require contributors to be available for follow-up questions and revisions if providing a PR.
|
|
@9Kun We are going to manually merge this PR this time, but if you plan to contribute in the future, we require contributors to be available for follow-up questions and revisions when submitting a PR. As noted in our documentation:
|
Summary
Fix construction of
WindowsPathsubclasses on Windows with Python 3.12+.The platform check compares the class identity with
WindowsPath, so a subclassis treated as a non-Windows path and rejected before it can be used.
Reproduced on Windows with Python 3.12.14 and 3.14.0 (upstream
9f8a9f6b7479e8ee4d033976d0a24faaca4a1830, wcmatch 11.0.1):The equivalent standard-library subclass can be instantiated on Windows. This
prevents applications from extending the concrete path class with their own
helpers while retaining wcmatch's glob methods.
Use
issubclassfor the existing platform check. This also keeps Windows-derivedconcrete paths from being instantiated on non-Windows hosts. The pre-3.12 branch,
exception type, and matching implementation are unchanged.
Four regression/control cases cover direct and indirect subclasses of both
concrete path classes. On the native platform they check construction, joining,
file access, matching,
glob/rglob, and preservation of the subclass in returnedpaths; the other platform's concrete subclasses must still be rejected.
Validation
2 failed, 2 passed. The failures are the direct and indirect Windows subclasses.
statement/branch coverage reported by coverage.py.
python -m mypy: passes on both tested interpreters.python -m ruff check .: passes, including the configured style checks.python -m build: sdist and wheel-from-sdist builds pass in isolated build environments.construction, joining, file access, matching, and glob/rglob.
python -m pip checkandgit diff --check: pass.The 166 skips also occur on the unchanged baseline and reflect existing
platform/option conditions, unavailable symlink support and
dir_fdsupport.Linux/macOS and the remaining supported Python versions were not run locally.
Documentation/spelling checks were not run; no documentation was changed.
AI assistance
This contribution was found through source inspection and local reproduction,
not a reported production incident. OpenAI Codex (GPT-6 Astra), acting with the
submitting account owner's authorization, selected the issue, wrote the patch
and tests, ran the checks above, reviewed the diff, and prepared this PR. No
independent human review is claimed. No matching issue or existing fix was found
in the issue/PR searches, so no separate issue was opened.