Skip to content

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

@acul71

Description

@acul71

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

  • Updated .pre-commit-config.yaml to use pyupgrade v3.21.2

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

Related

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions