8000 Allow type ignores of PEP 695 constructs by hauntsaninja · Pull Request #16608 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Allow type ignores of PEP 695 constructs #16608

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

Merged
merged 6 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
.
  • Loading branch information
hauntsaninja committed Dec 4, 2023
commit 0da87d6177c2a3c7333f9c407c68abd4bd1d8e8c
4 changes: 2 additions & 2 deletions mypy/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def parse(
source: str | bytes, fnam: str, module: str | None, errors: Errors, options: Options
source: str | bytes, fnam: str, module: str | None, errors: Errors, options: Options, raise_on_error: bool = False
) -> MypyFile:
"""Parse a source file, without doing any semantic analysis.

Expand All @@ -20,6 +20,6 @@ def parse(
import mypy.fastparse

tree = mypy.fastparse.parse(source, fnam=fnam, module=module, errors=errors, options=options)
if errors.is_errors():
if raise_on_error and errors.is_errors():
errors.raise_error()
return tree
2 changes: 2 additions & 0 deletions mypy/test/testparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def test_parser(testcase: DataDrivenTestCase) -> None:
module="__main__",
errors=Errors(options),
options=options,
raise_on_error=True,
)
a = n.str_with_options(options).split("\n")
except CompileError as e:
Expand Down Expand Up @@ -91,6 +92,7 @@ def test_parse_error(testcase: DataDrivenTestCase) -> None:
"__main__",
errors=Errors(options),
options=options,
raise_on_error=True,
)
raise AssertionError("No errors reported")
except CompileError as e:
Expand Down
0