-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object in localns but signature of inner function not resolved #93
Comments
Actually I would not expect that to resolve. You've hit on one of the big issues in usage of type annotations at runtime. This is a long and complicated topic with lots written elsewhere, so I'll just link to relevant peps and you should search them:
Long story short, that usage just won't be supported. You would need to not use |
You can also read through pydantic/pydantic#2678 Point is, what we're trying to do here (using types at runtime) does have some limitations and caveats, and does kinda rely on a little "participation/cooperation" on the part of the end user, just as it does in pydantic |
Okay interesting, thanks for the info, I'll close this! |
Thinking about it more, of course it wouldn't work, the outer function is defined but never called until runtime |
Description
When resolving the signature of a nested inner function, importing a signature object globally works but importing inside the outer function does not (even though this results in the object being in the local namespace of the outer function).
What I Did
gives:
I have not yet looked into why this is happening but you may know already.
Hopefully I got this right and you would expect this to resolve.
The text was updated successfully, but these errors were encountered: