Skip to content

Error for Required[Required[int]] #2372

Closed

Description

@JelleZijlstra

In typeddicts_required.py the conformance suite requires an error for Required[Required[int]], but in the spec (typeddict.rst) we say:

This annotation expression contains a :term:type expression, optionally qualified with one of the :term:type qualifiers <type qualifier> Required, NotRequired, or ReadOnly. These type qualifiers may be nested arbitrarily or wrapped in Annotated[]. It is an error to use both Required and NotRequired in the same item definition.

That means that nesting Required/NotRequired in itself is allowed. (I wrote that sentence. I was probably intending to allow nesting Required in ReadOnly and vice versa.)

Repeating the same qualifier is obviously useless and all type checkers already disallow it, so I'd propose to change the spec to explicitly disallow it.

Activity

  1. added a commit that references this issue on Oct 28, 2026
    af86235
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

    topic: otherOther topics not covered

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions