This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Lincoln Quirk
Recipients Lincoln Quirk
Date 2019-01-26.17:00:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1548522018.14.0.654103456004.issue35834@roundup.psfhosted.org>
In-reply-to
Content
Consider this code:

```
from __future__ import annotations

import typing

class A:
    f: 'Undef'

hints = typing.get_type_hints(A)
```

Since Undef is not defined, I should get an exception when calling get_type_hints, something like "NameError: name 'Undef' is not defined". But instead, get_type_hints returns {'f': ForwardRef('Undef')}.

If I remove the `from __future__ import annotations` line, get_type_hints correctly raises this exception.

I think the behavior should be to raise an exception in both cases.
History
Date User Action Args
2019-01-26 17:00:22Lincoln Quirksetrecipients: + Lincoln Quirk
2019-01-26 17:00:18Lincoln Quirksetmessageid: <1548522018.14.0.654103456004.issue35834@roundup.psfhosted.org>
2019-01-26 17:00:18Lincoln Quirklinkissue35834 messages
2019-01-26 17:00:18Lincoln Quirkcreate