This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author quentel
Recipients quentel
Date 2021-07-26.14:23:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1627309419.51.0.550971310919.issue44741@roundup.psfhosted.org>
In-reply-to
Content
This code

    match range(42):
        case [x, *w, y]:
            z = 0

sets w to a list with 40 items : the length of the subject, minus the number of non-star subpatterns.

But this code (adapted from test_patma_186) enters an infinite loop

    import collections.abc

    class Seq(collections.abc.Sequence):
        def __getitem__(self, i):
            print('get item', i)
            return i
        def __len__(self):
            return 42

    match Seq():
        case [x, *w, y]:
            z = 0

__getitem__ gets called forever, instead of stopping when the expected number of items in w is reached.
History
Date User Action Args
2021-07-26 14:23:39quentelsetrecipients: + quentel
2021-07-26 14:23:39quentelsetmessageid: <1627309419.51.0.550971310919.issue44741@roundup.psfhosted.org>
2021-07-26 14:23:39quentellinkissue44741 messages
2021-07-26 14:23:39quentelcreate