dissect.target icon indicating copy to clipboard operation
dissect.target copied to clipboard

Broken Windows pathlib behavior in cpython 3.13.0

Open JSCU-CNI opened this issue 1 month ago • 1 comments

It seems certain Windows pathlib behavior was fixed in cpython 3.13.1. When running cpython 3.13.0, you're gonna have a bad time.

uv run -p cpython-3.13.0 --with pytest pytest tests/plugins/os/windows/test_recyclebin.py
...
>       assert start_dir.source == "\\c:\\$recycle.bin\\$Ihello_world"
E       AssertionError: assert 'c:$recycle.bin\$Ihello_world' == '\\c:\\$recycle.bin\\$Ihello_world'
E        +  where 'c:$recycle.bin\$Ihello_world' = <windows/filesystem/recyclebin hostname=None domain=None ts=1601-01-01 00:00:00+00:00 path='c:\path\to\hello_world' fi...cle.bin\$Rhello_world' source='c:$recycle.bin\$Ihello_world' username=None user_id=None user_group=None user_home=None>.source

tests/plugins/os/windows/test_recyclebin.py:146: AssertionError
================================================================ short test summary info =================================================================
FAILED tests/plugins/os/windows/test_recyclebin.py::test_reading_deleted_directory_entries - AssertionError: assert 'c:$recycle.bin\$Ihello_world' == '\\c:\\$recycle.bin\\$Ihello_world'
uv run -p cpython-3.13.1 --with pytest pytest tests/plugins/os/windows/test_recyclebin.py
...
17 passed in 0.28s

Not sure if this can be fixed in the TargetPath implementation or if we should consider this a won't fix.

This could be related to https://github.com/python/cpython/issues/125069

JSCU-CNI avatar Nov 03 '25 16:11 JSCU-CNI

I'm currently working on pathlib compatibility for 3.14 so I'm fist deep in the pathlib code again, I can take a look.

Schamper avatar Nov 05 '25 10:11 Schamper