Skip to content

Conversation

@pareshjoshij
Copy link
Contributor

This PR fixes a UnicodeDecodeError in tests/lib/local_repos.py that occurs on Windows when running SVN-related tests.

The Bug The function _create_svn_initools_repo downloads a binary SVN dump file (INITools_modified.dump) but opens it using the default text mode (open(filename)).

On Windows, this attempts to decode raw binary bytes using the default encoding (often CP1252 or UTF-8), causing a crash.

It also causes newline translation (\n -> \r\n), which corrupts the stream sent to svnadmin.

The Fix Changed the open() call to use binary mode ('rb') to ensure raw bytes are passed correctly to subprocess.

Verification Verified locally on Windows. The test code now successfully opens the file without crashing.

Fixes #13669

The function `_create_svn_initools_repo` in `tests/lib/local_repos.py` was opening a downloaded SVN dump file using the default text mode (`'r'`).

Because SVN dump files contain binary data, this caused a `UnicodeDecodeError` on Windows and corrupted data due to newline translation when piping to `svnadmin`.

This commit changes the `open()` call to use `'rb'` (binary mode) to ensure the raw bytes are passed to `svnadmin` correctly.
Copy link
Member

@uranusjr uranusjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

@pareshjoshij
Copy link
Contributor Author

pareshjoshij commented Nov 27, 2025

Thanks @uranusjr sir ❤️🙏

Makes sense to me.

@ichard26 ichard26 added the skip news Does not need a NEWS file entry (eg: trivial changes) label Nov 27, 2025
@ichard26 ichard26 enabled auto-merge (squash) November 27, 2025 16:31
@ichard26 ichard26 merged commit b35182d into pypa:main Nov 27, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided skip news Does not need a NEWS file entry (eg: trivial changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TST: UnicodeDecodeError in local_repos.py when opening binary SVN dump

3 participants