Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.13']
python-version: ['3.9', '3.13']
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -121,12 +121,12 @@ jobs:
# Jupyter notebooks are out-of-date
# ( make -C tutorial/notebooks notebook )
- name: Test with pytest
if: ${{ !(matrix.python-version == '3.10') }}
if: ${{ !(matrix.python-version == '3.9') }}
run: |
locale
pytest -n auto --cov=psyclone --cov-report=xml src/psyclone/tests
- name: Test with pytest and C Locale
if: ${{ matrix.python-version == '3.10' }}
if: ${{ matrix.python-version == '3.9' }}
run: |
locale
pytest -n auto --cov=psyclone --cov-report=xml src/psyclone/tests
Expand Down
8 changes: 4 additions & 4 deletions src/psyclone/psyir/frontend/fparser2.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from dataclasses import dataclass, field
import os
import sys
from typing import Iterable
from typing import Iterable, Optional
Comment thread
arporter marked this conversation as resolved.

from fparser.common.readfortran import FortranStringReader
from fparser.two import C99Preprocessor, Fortran2003, utils
Expand Down Expand Up @@ -974,9 +974,9 @@ class SelectTypeInfo:
'class default' clauses, or -1 if no default clause is found.

"""
guard_type: list[str | None] = field(default_factory=list)
guard_type_name: list[str | None] = field(default_factory=list)
intrinsic_type_name: list[str | None] = field(default_factory=list)
guard_type: list[Optional[str]] = field(default_factory=list)
guard_type_name: list[Optional[str]] = field(default_factory=list)
intrinsic_type_name: list[Optional[str]] = field(default_factory=list)
clause_type: list[str] = field(default_factory=list)
stmts: list[list[StmtBase]] = field(default_factory=list)
selector: str = ""
Expand Down
10 changes: 5 additions & 5 deletions src/psyclone/psyir/symbols/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from collections import OrderedDict
from dataclasses import dataclass
from enum import Enum
from typing import Any
from typing import Any, Optional, Union
Comment thread
arporter marked this conversation as resolved.

from psyclone.configuration import Config
from psyclone.errors import InternalError
Expand Down Expand Up @@ -109,7 +109,7 @@ def reference_accesses(self):
return VariablesAccessMap()

@property
def is_allocatable(self) -> bool | None:
def is_allocatable(self) -> Optional[bool]:
'''
:returns: whether this DataType is allocatable. In the base class
set this to be always False.'''
Expand All @@ -124,7 +124,7 @@ def __str__(self):
return "UnresolvedType"

@property
def is_allocatable(self) -> bool | None:
def is_allocatable(self) -> Optional[bool]:
'''
:returns: whether this DataType is allocatable. In case of an
UnresolvedType we don't know.'''
Expand Down Expand Up @@ -354,7 +354,7 @@ def reference_accesses(self):
return access_info

@property
def is_allocatable(self) -> bool | None:
def is_allocatable(self) -> Optional[bool]:
'''If we have enough information in the partial_datatype,
determines whether this data type is allocatable or not.
If it is unknown, it will return None. Note that atm PSyclone
Expand Down Expand Up @@ -1101,7 +1101,7 @@ class ComponentType(CommentableMixin):
:type initial_value: Optional[:py:class:`psyclone.psyir.nodes.Node`]
'''
name: str
datatype: DataType | DataTypeSymbol
datatype: Union[DataType, DataTypeSymbol]
visibility: Symbol.Visibility
initial_value: Any

Expand Down
16 changes: 11 additions & 5 deletions src/psyclone/tests/psyir/transformations/transformations_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
API-agnostic tests for various transformation classes.
'''

import sys
import os
import pytest
from fparser.common.readfortran import FortranStringReader
Expand Down Expand Up @@ -590,11 +591,16 @@ def test_omploop_trans_new_options(sample_psyir):

with pytest.raises(TypeError) as excinfo:
omplooptrans.apply(tree.walk(Loop)[0], collapse="x")
assert ("'OMPLoopTrans' received options with the wrong types:\n"
"'collapse' option expects type 'int | bool' but "
"received 'x' of type 'str'.\n"
"Please see the documentation and check the provided types."
in str(excinfo.value))
if sys.version_info >= (3, 10):
assert ("'OMPLoopTrans' received options with the wrong types:\n"
"'collapse' option expects type 'int | bool' but "
"received 'x' of type 'str'.\n"
"Please see the documentation and check the provided types."
in str(excinfo.value))
else:
assert ("The 'collapse' argument must be an integer or a bool but got"
" an object of type <class 'str'>"
in str(excinfo.value))


def test_omplooptrans_apply_nowait(fortran_reader, fortran_writer):
Expand Down
Loading