Niklas Rosenstein <rosensteinnik...@gmail.com> added the comment:
Guido, sorry for the late response on this. I have a work around, but it involves passing along my own "context" from which to resolve strings on the go as they are encountered while decomposing the type hint. https://github.com/NiklasRosenstein/databind/commit/960da61149b7139ec81b0e49d407fae321581914 I'm using `typing.get_type_hints()` expecting it to fully resolve all forward references, but that no longer happens with PEP 585 generics. https://github.com/NiklasRosenstein/databind/blob/960da61149b7139ec81b0e49d407fae321581914/databind.core/src/databind/core/types/utils.py#L129-L138 I understand the documentation has been updated to reflect this behaviour, but it was an issue for me because it broke it's original API contract. > In addition, forward references encoded as string literals are handled by > evaluating them in globals and locals namespaces. Arguably the same has happened when `include_extras` was added (Annotated was now stripped from the returned resolved type hints by default), but that had an easy fix by simply wrapping it with `include_extra=True` depending on the Python version. The fix for the forward references in PEP 585 was not so trivial because we can't hook into what `get_type_hints()` does when it encounters a string. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41370> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com