Skip to content
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

[self-tests] failure against Python 3.10.3 #12451

Closed
stanislavlevin opened this issue Mar 25, 2022 · 0 comments · Fixed by #12452
Closed

[self-tests] failure against Python 3.10.3 #12451

stanislavlevin opened this issue Mar 25, 2022 · 0 comments · Fixed by #12452
Labels
bug mypy got something wrong topic-tests

Comments

@stanislavlevin
Copy link
Contributor

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
@stanislavlevin stanislavlevin added the bug mypy got something wrong label Mar 25, 2022
stanislavlevin added a commit to stanislavlevin/mypy that referenced this issue Mar 25, 2022
Python 3.10.3 is more correct about syntax error for
`mypy` test case `testBlocker`.

See https://bugs.python.org/issue46240 for details.

Closes python#12451

Signed-off-by: Stanislav Levin <slev@altlinux.org>
JelleZijlstra pushed a commit that referenced this issue Mar 25, 2022
…12452)

Python 3.10.3 is more correct about syntax error for
`mypy` test case `testBlocker`.

See https://bugs.python.org/issue46240 for details.

Closes #12451

Signed-off-by: Stanislav Levin <slev@altlinux.org>
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Apr 1, 2022
https://build.opensuse.org/request/show/965437
by user mcepl + dimstar_suse
- Add 12452-stringent-err-msg.patch to make mypy work
  with more stringent error messages in Python
  >= 3.10.3 (gh#python/mypy#12451).

- Update to version 0.942:
 - Fixes to Regressions:
  - Let overload item have a more general return type than the implementation (Jukka Lehtosalo, PR 12435)
  - Fix inheritance false positives with dataclasses/attrs (Jukka Lehtosalo, PR 12411)
  - Support overriding dunder attributes in Enum subclass (Petter Friberg, PR 12138)
  - Fix small conditional overload regression (Marc Mueller, PR 12336)
 - Other Fixes:
  - Fix issues related to the order of processing in the builtins import cycle (Jukka Lehtosalo, PR 12431)
  - Fix crash in match statement if class name is undefined (Jukka Lehtosalo, PR 12417)
  - Allow non-final __match_args__ and overriding (
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants