Skip to content

Conversation

@acul71
Copy link
Contributor

@acul71 acul71 commented Dec 16, 2025

Fixes #24

Problem

The CI tests were failing for Python 3.14 lint environments with the following error:

TypeError: cannot use a bytes pattern on a string-like object

This occurred in pyupgrade when processing files with Python 3.14, specifically in the tokenize.cookie_re.match(token.src) call.

Root Cause

pyupgrade v3.15.0 (the version in use) is incompatible with Python 3.14 due to changes in Python 3.14's tokenize module. The tool hasn't been updated to handle Python 3.14's tokenization API changes.

Solution

Update pyupgrade from v3.15.0 to v3.21.2 (latest version, released November 19, 2025) which includes Python 3.14 support.

Changes

Testing

  • ✅ All pre-commit hooks pass locally
  • ✅ Python 3.14 lint tests now pass
  • ✅ All other Python versions (3.10-3.13) continue to work
  • ✅ All tox environments pass in parallel

Related

This fixes the CI failures seen in PR #23 (though the failures were unrelated to that PR's changes).

Fixes #24

Updated pyupgrade from v3.15.0 to v3.21.2 to resolve Python 3.14
compatibility issues in linting. The previous version had a bug with
Python 3.14's tokenize module that caused TypeError when processing files.

- Updated .pre-commit-config.yaml
- Added newsfragment for issue #24
- All Python 3.14 lint tests now pass
@acul71 acul71 merged commit 5d78683 into master Dec 16, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: Update pyupgrade to v3.21.2 for Python 3.14 compatibility

3 participants