Skip to content

Python: -> Self / typing.Self annotation mints a sourceless god node self #4381

Closed

Description

@rajatnagda45

Version/commit: v0.9.87 (v8 @ 7536dc0)
Environment: macOS, Python 3.13, uv sync --all-extras

Problem

PEP 673 Self names the enclosing class, not a corpus symbol, but the Python type-ref pass treats the bare identifier Self (and the typing.Self tail) as a type reference and runs it through the sourceless-stub path. This fabricates a node with the bare id self that every Self-annotated method in the corpus collapses onto — a god node. It parallels the already-fixed Rust Self keyword hub.

Reproduction

from typing import Self
class Builder:
    def set(self, x) -> Self:
        return self

Expected

Self is dropped, exactly as the -> "Builder" string self forward-ref is already left unresolved. No sourceless self node.

Actual

A sourceless node labeled Self (id self) with a references edge from the method.

Fix PR to follow.

Activity

  1. github-actions commented on Oct 12, 2026

    @github-actions

    Thanks for opening this issue, @rajatnagda45. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. safishamsi commented on Oct 12, 2026

    @safishamsi
    Member

    Fixed in v0.9.88 (graphifyy 0.9.88 on PyPI) via #4386.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions