python / cpython

The Python programming language
https://www.python.org
Other
63.42k stars 30.37k forks source link

Create public API for typing._eval_type #85668

Open 9e91563d-5324-47be-9efc-a18b9f8d164b opened 4 years ago

9e91563d-5324-47be-9efc-a18b9f8d164b commented 4 years ago
BPO 41496
Nosy @gvanrossum, @ilevkivskyi, @Dominik1123
PRs
  • python/cpython#21753
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['type-feature', '3.10'] title = 'Create public API for typing._eval_type' updated_at = user = 'https://github.com/Dominik1123' ``` bugs.python.org fields: ```python activity = actor = 'Dominik V.' assignee = 'none' closed = False closed_date = None closer = None components = [] creation = creator = 'Dominik V.' dependencies = [] files = [] hgrepos = [] issue_num = 41496 keywords = ['patch'] message_count = 1.0 messages = ['374933'] nosy_count = 3.0 nosy_names = ['gvanrossum', 'levkivskyi', 'Dominik V.'] pr_nums = ['21753'] priority = 'normal' resolution = None stage = 'patch review' status = 'open' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue41496' versions = ['Python 3.10'] ```

    9e91563d-5324-47be-9efc-a18b9f8d164b commented 4 years ago

    In this python-ideas thread it was suggested to create a public API for typing._eval_type in order to be able to create custom versions of get_type_hints. Specifically a version that allows to specify an upper boundary in the MRO when retrieving type hints for a class object.

    The public API should use None as defaults for globalns and localns and not expose the recursive_guard parameter.