Skip to content

Streamline family syntax in Tools/cases_generator #106706

Description

@gvanrossum

The syntax to designate a family currently looks like this:

        family(store_subscr, INLINE_CACHE_ENTRIES_STORE_SUBSCR) = {
            STORE_SUBSCR,
            STORE_SUBSCR_DICT,
            STORE_SUBSCR_LIST_INT,
        };

Here the store_subscr "family name" is redundant (and in fact we even had one case where it was incorrect).

I propose to change it to be more similar to the pseudo syntax, so it will become

        family(STORE_SUBSCR, INLINE_CACHE_ENTRIES_STORE_SUBSCR) = {
            STORE_SUBSCR_DICT,
            STORE_SUBSCR_LIST_INT,
        };

This should be a straightforward change to the parser and code generator in Tools/cases_generator.

Linked PRs

Activity

  1. DanielFrantes commented on Jul 13, 2023

    @DanielFrantes

    Where I find thet code?

  2. gvanrossum commented on Jul 13, 2023

    @gvanrossum
    MemberAuthor

    In Tools/cases_generator/. The example is in Python/bytecodes.c.

  3. added a commit that references this issue on Jul 13, 2023
  4. kgdiem commented on Jul 13, 2023

    @kgdiem
    Contributor

    I started working on this here: https://github.com/kgdiem/cpython/tree/streamline-family-syntax

    I think the correct course of action to change the validations check_families[1] (decrement member length requirement, ensure name is in the macro instructions) and make some simple updates to write_metadata[2] ingenerate_cases.py.

    Is that correct?

    [1] https://github.com/python/cpython/blob/main/Tools/cases_generator/generate_cases.py#L809
    [2] https://github.com/python/cpython/blob/main/Tools/cases_generator/generate_cases.py#L1171

  5. gvanrossum commented on Jul 13, 2023

    @gvanrossum
    MemberAuthor

    @kgdiem You got it!

  6. kgdiem commented on Jul 13, 2023

    @kgdiem
    Contributor

    @kgdiem You got it!

    Awesome! I had one question about changing one of the tests in my PR but I saw you opened another issue wrt them being broken ...

    #105540

  7. gvanrossum commented on Jul 13, 2023

    @gvanrossum
    MemberAuthor

    If you are ready for a review of your code, just make a PR and CC me. [Sorry, realized you already did. Reviewing now.]

  8. added 2 commits that reference this issue on Jul 15, 2023
  9. gvanrossum commented on Jul 16, 2023

    @gvanrossum
    MemberAuthor

    @kgdiem Thanks for your contribution! You're welcome to help out more any time.

  10. kgdiem commented on Jul 17, 2023

    @kgdiem
    Contributor

    @kgdiem Thanks for your contribution! You're welcome to help out more any time.

    Thanks! I'm interested in spending 5-10 hours/week working on Python/Python ecosystem but having some trouble finding another issue I can pick up.

  11. gvanrossum commented on Jul 17, 2023

    @gvanrossum
    MemberAuthor

    Thanks! I'm interested in spending 5-10 hours/week working on Python/Python ecosystem but having some trouble finding another issue I can pick up.

    Cool. May I inquire what motivates you to do this? And what kind of issues are you looking for? Can they involve C code?

  12. kgdiem commented on Jul 17, 2023

    @kgdiem
    Contributor

    May I inquire what motivates you to do this?

    I enjoy it! I code as a hobby (and professionally) and want to do something beyond web development; high perf, systems programming, applied CS, etc

    And what kind of issues are you looking for? Can they involve C code?

    Ya. I started looking at the last issue you'd opened (gh-106608) but was a bit intimidated and was trying to find something "easier" / more in my traditional wheelhouse.

    In thinking about my reply here, re-reviewing the issue & related the code, I'm pretty confident and am going to give it a shot. I'll reach out over there if I need any help.

    Thanks again.

  13. gvanrossum commented on Jul 17, 2023

    @gvanrossum
    MemberAuthor

    Cool, see you at that issue. Be sure not to bang your head against the wall for too long -- ask for help before it starts bleeding! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions