X Tutup
Skip to content

Use os.fsencode() and os.fsdecode() for pathlike byte strings#3489

Draft
slook wants to merge 1 commit intonicotine-plus:masterfrom
slook:shares-scan-fsencode-fsdecode
Draft

Use os.fsencode() and os.fsdecode() for pathlike byte strings#3489
slook wants to merge 1 commit intonicotine-plus:masterfrom
slook:shares-scan-fsencode-fsdecode

Conversation

@slook
Copy link
Member

@slook slook commented Sep 25, 2025

Closes #3485 (possibly - testing todo)

@slook slook force-pushed the shares-scan-fsencode-fsdecode branch from acf35aa to 9322d7b Compare November 29, 2025 21:47
@slook slook force-pushed the shares-scan-fsencode-fsdecode branch from 9322d7b to ca5c85a Compare December 24, 2025 09:47
@mathiascode
Copy link
Member

The largest issue I have with this is that os.fsdecode() uses the 'surrogateescape' error handler, which will likely bring back a bunch of UnicodeEncodeErrors when trying to print those paths or encode them to utf-8.

Especially here, this change would likely crash immediately:

encoded_key = key.encode("utf-8")

pallets/click#2395

@slook slook marked this pull request as draft January 17, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Critical Error (constant crashing)

2 participants

X Tutup