Skip to content

fix: make update_command.py runnable on Python >= 3.9#26

Merged
hozblok merged 2 commits into
masterfrom
fix/13-update-command-py39-compatible
May 16, 2026
Merged

fix: make update_command.py runnable on Python >= 3.9#26
hozblok merged 2 commits into
masterfrom
fix/13-update-command-py39-compatible

Conversation

@hozblok

@hozblok hozblok commented May 11, 2026

Copy link
Copy Markdown
Owner

Problem. boost_headers/update_command.py had boost_entry: os.DirEntry | None = None. PEP 604 union syntax is a runtime expression only on Python 3.10+. The package's python_requires is >= 3.9, < 4, so contributors on 3.9 got TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' the moment they ran the script. The # Use Python 3.10. comment at the top was the symptom; someone clearly tripped on it before.

Fix. boost_headers/update_command.py — import typing.Optional, switch the annotation to Optional[os.DirEntry], and update the header comment to call out the 3.9-compat constraint.

No functional change. AST scan confirms no remaining X | None in annotation context. Full pytest suite 316/316.

hozblok and others added 2 commits May 11, 2026 15:21
The script's `boost_entry: os.DirEntry | None = None` used PEP 604 union
syntax, which is a runtime expression only on Python 3.10+. Contributors
on 3.9 (which the package's python_requires still includes) got
`TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'`
the moment they ran the script. The `# Use Python 3.10.` comment at the
top was clearly added after someone tripped on this.

Switch to `typing.Optional[os.DirEntry]` (importing Optional alongside
the other stdlib modules) and update the header comment to call out the
3.9-compat constraint.

See ai/improvements_2026-05-09.md item #13.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hozblok hozblok marked this pull request as ready for review May 16, 2026 22:08
@hozblok hozblok merged commit aa8daff into master May 16, 2026
5 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.

1 participant