Skip to content

COMP: Bump pyupgrade v3.19.0 to v3.21.2 for Python 3.14#6046

Merged
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:mainfrom
hjmjohnson:comp-pyupgrade-py314
Apr 13, 2026
Merged

COMP: Bump pyupgrade v3.19.0 to v3.21.2 for Python 3.14#6046
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:mainfrom
hjmjohnson:comp-pyupgrade-py314

Conversation

@hjmjohnson
Copy link
Copy Markdown
Member

Fix pre-commit run -a failure when pixi provides Python 3.14. pyupgrade v3.19.0 crashes with TypeError: cannot use a bytes pattern on a string-like object because Python 3.14 changed tokenize.cookie_re from bytes to str.

Error trace
File "pyupgrade/_main.py", line 297, in _fix_tokens
    tokenize.cookie_re.match(token.src)
TypeError: cannot use a bytes pattern on a string-like object

Fixed upstream in asottile/pyupgrade. v3.21.2 handles both bytes and str cookie_re variants.

@github-actions github-actions bot added the type:Compiler Compiler support or related warnings label Apr 13, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 13, 2026

Greptile Summary

Bumps pyupgrade from v3.19.0 to v3.21.2 in .pre-commit-config.yaml to fix a TypeError crash introduced by Python 3.14's change of tokenize.cookie_re from bytes to str. No logic, configuration, or behavioral changes beyond the version pin.

Confidence Score: 5/5

Safe to merge — minimal, targeted version bump with no functional changes.

Single-line version pin change with a clear upstream fix and well-documented motivation. No logic, security, or behavioral concerns.

No files require special attention.

Important Files Changed

Filename Overview
.pre-commit-config.yaml Bumps pyupgrade from v3.19.0 to v3.21.2 to fix Python 3.14 incompatibility with tokenize.cookie_re

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[pre-commit run] --> B{Python version}
    B -- Python ≤ 3.13 --> C[pyupgrade v3.19.0\nworks fine]
    B -- Python 3.14 --> D[pyupgrade v3.19.0\ncrashes: TypeError\ncookie_re bytes vs str]
    D --> E[Bump to v3.21.2]
    E --> F[pyupgrade v3.21.2\nhandles both bytes\nand str cookie_re]
    F --> G[pre-commit passes]
    C --> G
Loading

Reviews (1): Last reviewed commit: "COMP: Bump pyupgrade v3.19.0 to v3.21.2 ..." | Re-trigger Greptile

@hjmjohnson hjmjohnson merged commit adaa687 into InsightSoftwareConsortium:main Apr 13, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:Compiler Compiler support or related warnings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants