Repository navigation
Improve legacy Windows error diagnostics - #120
Open
dajiaohuang wants to merge 1 commit into
Open
dajiaohuang wants to merge 1 commit into
dajiaohuang wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses the legacy-backend diagnostics described in #117.
SHFileOperationWreturns its own shell status (for exampleDE_INVALIDFILES,0x7c), which this backend maps to an approximate Win32winerror; it also currently reports the short path passed to the shell. Preserve the decoded caller path list and expose the original shell status asOSError.sh_file_operation_result, while retaining the existing mappedwinerrorand message behavior.This does not change shell/recycle behavior or claim to fix the loaded-hard-link refusal. It is separate from #118's preflight for paths that Windows would permanently delete.
Validation
py -3.13 -B -m pytest tests/test_win_legacy_diagnostics.py -q— 1 passed on Windows. The test mocks short-path conversion,SHFileOperationW, andFormatError; it creates no path and invokes no trash API.py -3.13 -B -m py_compile send2trash/win/legacy.py tests/test_win_legacy_diagnostics.py— passed.git diff --check— passed.The existing Windows platform tests/full suite were not run because they invoke native trash APIs and can move files into the host Recycle Bin.
flake8was unavailable in the existing Python environment; no package was installed. CI/review status is not claimed.