Fix Python 3.8 compatibility of a TypeAlias.

Review Request #14008 — Created July 2, 2024 and submitted — Latest diff uploaded

Information

Review Board
release-7.x

Reviewers

We had one place where we were defining a TypeAlias using the
newer-style list[...] (and related), which doesn't work for Python
3.8. This works fine for type annotations on all versions, but for type
aliases, it's a runtime error. Luckily this was hidden behind a check
for TYPE_CHECKING so it didn't break production.

This change also moves a couple more things into the TYPE_CHECKING
block.

Ran unit tests.

Diff Revision 1 (Latest)

Commits

First Last Summary ID Author
Fix Python 3.8 compatibility of a TypeAlias.
We had one place where we were defining a `TypeAlias` using the newer-style `list[...]` (and related), which doesn't work for Python 3.8. This works fine for type annotations on all versions, but for type aliases, it's a runtime error. Luckily this was hidden behind a check for `TYPE_CHECKING` so it didn't break production. This change also moves a couple more things into the `TYPE_CHECKING` block. Testing Done: Ran unit tests.
0370247e03f84e75e87de8e46414a261b4cf3d9a David Trowbridge
reviewboard/reviews/views/diffviewer.py
Loading...