Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test lpython.py with multiple CPython versions #1827

Closed
Tracked by #1600
certik opened this issue May 17, 2023 · 9 comments · Fixed by #2298
Closed
Tracked by #1600

Test lpython.py with multiple CPython versions #1827

certik opened this issue May 17, 2023 · 9 comments · Fixed by #2298

Comments

@certik
Copy link
Contributor

certik commented May 17, 2023

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.

@certik certik mentioned this issue May 17, 2023
38 tasks
@rebcabin
Copy link
Contributor

rebcabin commented May 17, 2023 via email

@Shaikh-Ubaid
Copy link
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?

@certik
Copy link
Contributor Author

certik commented Aug 24, 2023

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.

@Shaikh-Ubaid
Copy link
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?

@certik
Copy link
Contributor Author

certik commented Aug 25, 2023

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

@Shaikh-Ubaid
Copy link
Collaborator

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

@certik
Copy link
Contributor Author

certik commented Aug 25, 2023

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.

@Shaikh-Ubaid
Copy link
Collaborator

Shaikh-Ubaid commented Aug 25, 2023

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

@Shaikh-Ubaid
Copy link
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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants