Bug description:
Lib/test/libregrtest/results.py imports TYPE_CHECKING only to guard a type-only import:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from xml.etree.ElementTree import Element
Now that explicit lazy imports are available, this can be replaced with:
lazy from xml.etree.ElementTree import Element
The stringized list['Element'] annotation can then become list[Element]. This keeps xml.etree.ElementTree from being imported eagerly while making the annotation name available at runtime.
Lib/test/libregrtest/mypy.ini should also target Python 3.15, following the approach used for pyrepl in gh-149985 and gh-149992.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Bug description:
Lib/test/libregrtest/results.pyimportsTYPE_CHECKINGonly to guard a type-only import:Now that explicit lazy imports are available, this can be replaced with:
The stringized
list['Element']annotation can then becomelist[Element]. This keepsxml.etree.ElementTreefrom being imported eagerly while making the annotation name available at runtime.Lib/test/libregrtest/mypy.inishould also target Python 3.15, following the approach used for pyrepl in gh-149985 and gh-149992.CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs