Skip to content

Commit

Permalink
#2839: Mention new ValueError in docstring; clearer message
Browse files Browse the repository at this point in the history
  • Loading branch information
jwallwork23 committed Jan 8, 2025
1 parent 44da2ea commit 347af2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/psyclone/psyir/frontend/fortran.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ class FortranReader():
for more precise control it also accepts a list of module names.
Defaults to False.
:raises ValueError: If ignore_directives is set to False but
ignore_comments is set to True.
'''
# Save parser object across instances to reduce the initialisation time
_parser = None
Expand All @@ -85,8 +88,8 @@ def __init__(self, free_form: bool = True, ignore_comments: bool = True,
self._free_form = free_form
if ignore_comments and not ignore_directives:
raise ValueError(
"Setting ignore_directives to False will only have an effect"
" if ignore_comments is also set to False"
"Setting ignore_directives to False in the FortranReader will"
" only have an effect if ignore_comments is also set to False."
)
self._ignore_comments = ignore_comments
self._processor = Fparser2Reader(ignore_directives,
Expand Down
4 changes: 2 additions & 2 deletions src/psyclone/tests/psyir/frontend/fortran_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def test_fortran_psyir_from_file(fortran_reader, tmpdir_factory):
with pytest.raises(ValueError) as err:
FortranReader(ignore_comments=True, ignore_directives=False)
msg = (
"Setting ignore_directives to False will only have an effect if"
" ignore_comments is also set to False"
"Setting ignore_directives to False in the FortranReader will"
" only have an effect if ignore_comments is also set to False."
)
assert msg in str(err.value)

0 comments on commit 347af2e

Please sign in to comment.