Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-109118: Allow lambdas in annotation scopes in classes#118019
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looks fine! I do think this will probably be the most intuitive behavior, though it's a little weird in principle for visibility to not be transitive. I guess it didn't turn out to be the case at all that this non-transitivity would require re-working abstractions insymtable.c
!
I apologize in advance for the difficulties I assume you will encounter in making this work for comprehensions :/
Thanks! Yes, I tried locally to do the same thing for comprehensions and couldn't get it to work yet. The naive change (just remove the code that throws a SyntaxError for comprehensions in annotation scopes) no longer crashes like it did in#109118, but due to inlining it doesn't produce the right scoping semantics. I tried to do something like what we did last year in#104528 but couldn't get it to work yet. I haven't had time yet to get back to this. |
One approach I thought of was to simply not inline comprehensions in annotation scopes, but that doesn't seem right as comprehensions would now behave differently in annotation scopes versus elsewhere. |
85f727c
intopython:mainUh oh!
There was an error while loading.Please reload this page.
If you want to (at some point when you get back to it, no rush) push a non-working version with inlined comprehensions in annotation scopes, I'm also willing to take a look and see what I can figure out. |
Thanks! I opened#118160 with what I have so far. |
Uh oh!
There was an error while loading.Please reload this page.
📚 Documentation preview 📚:https://cpython-previews--118019.org.readthedocs.build/