Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Improve handling of Type[...] so distinguish between types and instances properly

Open
#33 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
compilers

Research direction

Start by tracing how Type[...] and class-versus-instance values are represented for the produce() and reveal_type(C) example. Examine the can_assign_from path mentioned in the issue and determine how it should handle a Value rather than a class. Done means the example no longer infers Type[type], using one of the intended Type[object], Type[typing.Any], or Type[dynamic] results.

Written by the indexing model from the issue text.

Description

sp-correctness staticpython

Currently we don't really fully handle instances of types correctly. One example of this is:

def produce() -> type:
    @final
    class C:
        pass
    return C
C = produce()
reveal_type(C)

The inferred type of "C" becomes "Type[type]", when it really should be "Type[object]", "Type[typing.Any]" or "Type[dynamic]".

There's other places that tie into this like can_assign_from might be better taking a Value vs. a class.

Dominant language
Python
Stars
3.8k
Forks
139
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from facebookincubator/MetaPython

All issues in facebookincubator/MetaPython

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.