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 netbnd
Recipients netbnd
Date 2019-08-13.09:36:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When evaluating the type-hints of an inner-class (a class defined inside a function scope), the forward declaration does not work correctly. In this case the typing.get_type_hints does not get the right namespace, thus the class-string specified is not found.

When using the same syntax for a normal class (defined in global space) it works, or when using another class instead a forward declaration, also everything works.

As a workaround one could pass the local namespace (locals()) from the function where the class has been defined in to typing.get_type_hints. However in normal situations the typing.get_type_hints call is deep in the call hierarchy to do some runtime type-checks and at this point only the reference to the function-object is existing and no-one is aware of the fact, that this is just a method defined in a inner class.

From the outside perspective one would expect, that typing.get_type_hints reacts the same, independent of the type of class.
Date User Action Args
2019-08-13 09:36:43netbndsetrecipients: + netbnd
2019-08-13 09:36:43netbndsetmessageid: <>
2019-08-13 09:36:43netbndlinkissue37835 messages
2019-08-13 09:36:43netbndcreate