| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
- restore 'symtable.SCOPE_OFF' for compatibility purposes - fix `Symbol.is_comp_cell()`
|
Thank you for the review Serhiy. By the way, is it fine for me to re-request a review after addressing what you've reviewed or do you prefer not to have notifications' noise (same question for Jelle)? |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM.
Sorry, something went wrong.
There was a problem hiding this comment.
DEF_FREE_CLASS is used in a case like this:
def f():
x = 1
class C:
x = 2
def method(self):
return x
The method() method should return 1 -- it doesn't see the class-scoped x, but it does see the function-scoped x outside the class. The class-scoped x is marked DEF_FREE_CLASS in this case, to make that work.
It's such a niche use that I don't think we are going to find a method name here that nicely represents it in an intuitive way. Best option is probably just is_free_class to match the flag name.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. |
Sorry, something went wrong.
|
Ah, I should have said "I have made the requested changes; please review again". |
Sorry, something went wrong.
|
Thanks for making the requested changes! @carljm, @serhiy-storchaka: please review the changes made to this pull request. |
Sorry, something went wrong.
|
I think this now needs to be updated for compatibility with the merge of the PEP 649 compiler implementation. |
Sorry, something went wrong.
…e compiler's flags, add methods (python#120099) Expose :class:`symtable.Symbol` methods :meth:`~symtable.Symbol.is_free_class`, :meth:`~symtable.Symbol.is_comp_iter` and :meth:`~symtable.Symbol.is_comp_cell`. --------- Co-authored-by: Carl Meyer <carl@oddbird.net>
…e compiler's flags, add methods (python#120099) Expose :class:`symtable.Symbol` methods :meth:`~symtable.Symbol.is_free_class`, :meth:`~symtable.Symbol.is_comp_iter` and :meth:`~symtable.Symbol.is_comp_cell`. --------- Co-authored-by: Carl Meyer <carl@oddbird.net>
…e compiler's flags, add methods (python#120099) Expose :class:`symtable.Symbol` methods :meth:`~symtable.Symbol.is_free_class`, :meth:`~symtable.Symbol.is_comp_iter` and :meth:`~symtable.Symbol.is_comp_cell`. --------- Co-authored-by: Carl Meyer <carl@oddbird.net>
| Back | FazBrowse Home | New Git URL |
I did not expose is_free_class yet because I don't really know whether it's the best name or not, nor did I handle the DEF_FREE flag because I don't know its difference with the FREE scope itself (see #120029 (comment)).
I've nonethless cleaned up the lambda functions used to getting the scope and also exported SCOPE_OFFSET instead of SCOPE_OFF (those constants are actually private since they are not documented so it should not affect public API). I can revert those changes easily though if you want me to make them in another PR.
cc @JelleZijlstra @carljm
📚 Documentation preview 📚: https://cpython-previews--120099.org.readthedocs.build/