Skip to content

docs: remove broken LiteralString overloads example (closes #2090)#2311

Open
ashishpatel26 wants to merge 1 commit into
python:mainfrom
ashishpatel26:fix/2090-delete-literalstring-overload-example
Open

docs: remove broken LiteralString overloads example (closes #2090)#2311
ashishpatel26 wants to merge 1 commit into
python:mainfrom
ashishpatel26:fix/2090-delete-literalstring-overload-example

Conversation

@ashishpatel26

Copy link
Copy Markdown

Summary

Fixes #2090.

The LiteralString "Interactions with Overloads" section contained an overload example that type checkers flag as unsafe overlaps (e.g. pyright errors because Literal["foo"] is a subtype of LiteralString, making the two overloads ambiguous). The section specified no normative behaviour — it was purely illustrative — so the simplest correct fix is removal, as suggested by @JelleZijlstra in the issue.

Also removes the See :ref:\literalstring-overloads`cross-reference in the precedingLiteral` note (the target no longer exists).

Changes

  • docs/spec/literal.rst: delete the 24-line "Interactions with Overloads" sub-section and its anchor; drop the stale See :ref: from the Literal note.

Test plan

  • make html (or ReadTheDocs build) succeeds with no broken-reference warnings

The "Interactions with Overloads" section under LiteralString contained
an example that does not typecheck in pyright (and other checkers) because
the `Literal["foo"]` and `LiteralString` overloads overlap unsafely.
The section specified no normative behavior — it was purely illustrative —
so the cleanest fix is to remove it.

Also drop the `See :ref:\`literalstring-overloads\`` back-reference from
the preceding Literal-type note, since the target no longer exists.

Fixes: python#2090
@srittau srittau added the topic: typing spec For improving the typing spec label Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: typing spec For improving the typing spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LiteralString overload example doesn't typecheck

2 participants