Skip to content

[self-tests] failure against Python 3.10.3 #12451

Closed
@stanislavlevin

Description

@stanislavlevin

Bug Report

1 test of mypy's test suite fails against Python 3.10.3 with:

=================================== FAILURES ===================================
_________________________________ testBlocker __________________________________
[gw13] linux -- Python 3.10.3 /usr/src/RPM/BUILD/python3-module-mypy-0.942/.tox/py3/bin/python
data: /usr/src/RPM/BUILD/python3-module-mypy-0.942/test-data/unit/cmdline.test:1238:
../../RPM/BUILD/python3-module-mypy-0.942/mypy/test/testcmdline.py:43: in run_case
    test_python_cmdline(testcase, step)
../../RPM/BUILD/python3-module-mypy-0.942/mypy/test/testcmdline.py:105: in test_python_cmdline
    assert_string_arrays_equal(expected_out, out,
E   AssertionError: Invalid output (/usr/src/RPM/BUILD/python3-module-mypy-0.942/test-data/unit/cmdline.test, line 1238)
----------------------------- Captured stderr call -----------------------------
Expected:
  pkg/x.py:1: error: invalid syntax. Perhaps you forgot a comma? (diff)
  Found 1 error in 1 file (errors prevented further checking)
  == Return code: 2
Actual:
  pkg/x.py:1: error: invalid syntax             (diff)
  Found 1 error in 1 file (errors prevented further checking)
  == Return code: 2

Alignment of first line difference:
  E: ...: error: invalid syntax. Perhaps you forgot a comma?
  A: ...: error: invalid syntax
                               ^
=========================== short test summary info ============================
FAILED mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.test::testBlocker

To Reproduce
python -m pytest 'mypy/test/testcmdline.py::PythonCmdlineSuite::cmdline.test::testBlocker'

Expected Behavior

All tests should pass.

Your Environment

  • Mypy version used: 0.942
  • Python version used: 3.10.3
  • Operating system and version: ALTLinux

I think this is due to this change:
https://docs.python.org/3/whatsnew/changelog.html#id3

bpo-46240: Correct the error message for unclosed parentheses when the tokenizer doesn’t reach the end of the source when the error is reported.

https://bugs.python.org/issue46240

For example, Python 3.10.0:

[someuser somedir]$ echo 'public static void main(String[] args)' | python3 -
  File "<stdin>", line 1
    public static void main(String[] args)
                                  ^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?

and Python 3.10.3:

[someuser somedir]$ echo 'public static void main(String[] args)' | python3 -
  File "<stdin>", line 1
    public static void main(String[] args)
           ^^^^^^
SyntaxError: invalid syntax

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions