GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Modernize annotation usage in libregrtest · Issue #156402 · python/cpython

Modernize annotation usage in libregrtest #156402

New issue
Copy link
New issue
Copy link
Closed
Closed
Modernize annotation usage in libregrtest#156402
Copy link
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtopic-typingtype-refactorCode refactoring (with no changes in behavior)Code refactoring (with no changes in behavior)

Description

@ashm-dev
ashm-dev
opened on Aug 26, 2026
Issue body actions

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

  • gh-156402: Modernize annotation usage in libregrtest #156403

Activity

  1. Eclips4
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    type-refactorCode refactoring (with no changes in behavior)Code refactoring (with no changes in behavior)
    on Aug 26, 2026
  2. aisk
    added
    topic-typing
    on Aug 26, 2026
  3. picnixz commented on Aug 26, 2026

    @picnixz
    picnixz
    on Aug 26, 2026
    Member
    More actions

    What is the purpose? it is only used in tests and is entirely churn IMO

  4. JelleZijlstra commented on Aug 26, 2026

    @JelleZijlstra
    JelleZijlstra
    on Aug 26, 2026
    Member
    More actions

    I support doing this, it's a significant code simplification and helps CPython set a good example.

    Reacted by Stan Ulbrych
  5. ashm-dev
    added a commit that references this issue on Sep 15, 2026

    Merge branch 'main' into pythongh-156402

    1ca3172
  6. JelleZijlstra
    added a commit that references this issue on Sep 17, 2026

    gh-156402: Modernize annotation usage in libregrtest (#156403)

    c39a329
  7. hugovk
    closed this as completedon Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirTests in the Lib/test dirtopic-typingtype-refactorCode refactoring (with no changes in behavior)Code refactoring (with no changes in behavior)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.