Skip to content

Test lpython.py with multiple CPython versions #1827

Closed

Description

@certik

We need to test the lpython.py tests in integration_tests with multiple CPython versions. It looks like there are some bugs related to that.

Activity

  1. rebcabin commented on May 17, 2023

    @rebcabin
    Contributor
  2. ubaidsk commented on Aug 24, 2023

    @ubaidsk
    Collaborator

    We currently test with Python 3.10 and Python 3.11.4 at the CI. Is this issue safe to close or shall we test other Python versions like Python 3.9, Python 3.8 at the CI?

  3. certik commented on Aug 24, 2023

    @certik
    ContributorAuthor

    We should test with all the Python versions at: https://www.python.org/downloads/, so let's test with 3.8, 3.10, 3.11. Once 3.12 is released, let's test with it as well. To save time, we can probably skip 3.9. Once 3.8 is deprecated, we can test 3.9 instead.

  4. ubaidsk commented on Aug 25, 2023

    @ubaidsk
    Collaborator

    It seems list type is not subscriptable in Python 3.8.

    $ python --version
    Python 3.8.17
    
    $ cat examples/expr2.py 
    from lpython import i32
    
    def print_list(a: list[i32]):
        print(a)
    
    def main0():
        x: list[i32] = [1, 2, 3]
        print_list(x)
    
    main0()
    
    $ python examples/expr2.py
    Traceback (most recent call last):
      File "examples/expr2.py", line 3, in <module>
        def print_list(a: list[i32]):
    TypeError: 'type' object is not subscriptable
    
    $ lpython examples/expr2.py 
    [1, 2, 3]
    

    Please, could you share what we should do?

  5. certik commented on Aug 25, 2023

    @certik
    ContributorAuthor

    Is it subscriptable in Python 3.9? If so, then I would drop 3.8 and only support >= 3.9.

  6. ubaidsk commented on Aug 25, 2023

    @ubaidsk
    Collaborator

    It seems annotation for list is supported since Python 3.9 (reference https://stackoverflow.com/a/64755075).

  7. certik commented on Aug 25, 2023

    @certik
    ContributorAuthor

    Ok, then let's test Python 3.9, 3.10 and 3.11 explicitly, all three. Once 3.12 is released in October, we'll add it as well.

  8. ubaidsk commented on Aug 25, 2023

    @ubaidsk
    Collaborator

    For Python 3.8 and before, it seems one needs to use from typing import List (which I think/guess is subscriptable).

  9. ubaidsk commented on Aug 25, 2023

    @ubaidsk
    Collaborator

    Ok, then let's test Python 3.9, 3.10 and 3.11 explicitly, all three. Once 3.12 is released in October, we'll add it as well.

    Sure, got it.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions