New submission from Simon Percivall:

For classes with ForwardRef annotations, typing.get_type_hints is unusable.

As example, we have two files:

a.py:
class Base:
    a: 'A'

class A:
    pass

b.py:
from a import Base

class MyClass(Base):
    b: 'B'

class B:
    pass


>>> from typing import get_type_hints
>>> from b import MyClass
>>> get_type_hints(MyClass) #  NameError


What should globals/locals be here?

----------
messages: 291058
nosy: simon.percivall
priority: normal
severity: normal
status: open
title: typing.get_type_hints doesn't really work for classes with ForwardRefs
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29966>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to