Skip to content

Remove tests with invalid syntax (Python 3.14)#2093

Merged
hauntsaninja merged 1 commit into
python:mainfrom
sharkdp:remove-invalid-syntax-tests
Oct 8, 2025
Merged

Remove tests with invalid syntax (Python 3.14)#2093
hauntsaninja merged 1 commit into
python:mainfrom
sharkdp:remove-invalid-syntax-tests

Conversation

@sharkdp

@sharkdp sharkdp commented Oct 8, 2025

Copy link
Copy Markdown
Contributor

The use of named expressions and await expressions results in syntax errors on Python 3.14 (see below). This PR therefore suggests to remove two tests from conformance/tests/qualifiers_annotated.py that were making use of this now-invalid syntax.

▶ uvx python@3.14               
Python 3.14.0 (main, Oct  7 2025, 15:35:21) [Clang 20.1.4 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from typing import Annotated, Literal


>>> Good9: Annotated[Literal[3, 4, 5, None], x := 3]
  File "<python-input-1>", line 1
    Good9: Annotated[Literal[3, 4, 5, None], x := 3]
                                             ^^^^^^
SyntaxError: named expression cannot be used within an annotation



>>> async def func3() -> None:
...     Good10: Annotated[str, await func3()]
...     
  File "<python-input-2>", line 2
    Good10: Annotated[str, await func3()]
                           ^^^^^^^^^^^^^
SyntaxError: await expression cannot be used within an annotation

def run_tests(self, test_files: Sequence[str]) -> dict[str, str]:
proc = run(
["pyrefly", "check", "--output-format", "min-text", "--no-summary"],
["pyrefly", "check", "--output-format", "min-text", "--summary=none"],

@sharkdp sharkdp Oct 8, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a drive-by fix. The latest version of pyrefly does not seem to support --no-summary anymore. Let me know if this should be removed or pulled out into a second PR.

@srittau srittau added the topic: conformance tests Issues with the conformance test suite label Oct 8, 2025

@carljm carljm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

@hauntsaninja hauntsaninja merged commit e7ad24c into python:main Oct 8, 2025
4 checks passed
@sharkdp sharkdp deleted the remove-invalid-syntax-tests branch October 9, 2025 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: conformance tests Issues with the conformance test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants