From 1d59a4dc0a2e4c8a448a1ac49960fbb111a813ee Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Jul 12 2022 20:46:50 +0000 Subject: Replace syntax_test error fix with a more upstreamable one --- diff --git a/0001-Ignore-deprecated-module-in-access_attr_before_def_f.patch b/0001-Ignore-deprecated-module-in-access_attr_before_def_f.patch index 0b112cb..64537a3 100644 --- a/0001-Ignore-deprecated-module-in-access_attr_before_def_f.patch +++ b/0001-Ignore-deprecated-module-in-access_attr_before_def_f.patch @@ -1,7 +1,7 @@ -From 8ba868c03275c72a54cbed94fa66714eeefe11ae Mon Sep 17 00:00:00 2001 +From 0bc66afdc10cf15bcfb8298846f4260c2b54fddb Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 11 Jul 2022 14:06:29 -0700 -Subject: [PATCH 1/4] Ignore deprecated-module in +Subject: [PATCH 1/5] Ignore deprecated-module in access_attr_before_def_false_positive This is because telnetlib is deprecated in Python 3.11. It's @@ -18,13 +18,13 @@ Signed-off-by: Adam Williamson 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/a/access/access_attr_before_def_false_positive.py b/tests/functional/a/access/access_attr_before_def_false_positive.py -index cb978c84c..1771e18bd 100644 +index cb978c84c..c723eb099 100644 --- a/tests/functional/a/access/access_attr_before_def_false_positive.py +++ b/tests/functional/a/access/access_attr_before_def_false_positive.py @@ -1,5 +1,5 @@ # pylint: disable=invalid-name,too-many-public-methods,attribute-defined-outside-init -# pylint: disable=useless-object-inheritance,too-few-public-methods -+# pylint: disable=useless-object-inheritance,too-few-public-methods deprecated-module ++# pylint: disable=useless-object-inheritance,too-few-public-methods,deprecated-module """This module demonstrates a possible problem of pyLint with calling __init__ s from inherited classes. Initializations done there are not considered, which results in Error E0203 for diff --git a/0001-NOT-UPSTREAMABLE-update-expected-syntax-errors-for-Py.patch b/0001-NOT-UPSTREAMABLE-update-expected-syntax-errors-for-Py.patch deleted file mode 100644 index ad19aa2..0000000 --- a/0001-NOT-UPSTREAMABLE-update-expected-syntax-errors-for-Py.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 86fa2b12d25a1e0fe7f117dd8b3c0d9dbf529905 Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Mon, 11 Jul 2022 15:59:38 -0700 -Subject: [PATCH] NOT UPSTREAMABLE: update expected syntax errors for Python - 3.11 - -Signed-off-by: Adam Williamson ---- - tests/functional/i/import_error.txt | 2 +- - tests/functional/s/syntax/syntax_error.txt | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/functional/i/import_error.txt b/tests/functional/i/import_error.txt -index 28e94dc72..5ecad8098 100644 ---- a/tests/functional/i/import_error.txt -+++ b/tests/functional/i/import_error.txt -@@ -1,5 +1,5 @@ - import-error:3:0:3:22::Unable to import 'totally_missing':UNDEFINED - import-error:21:4:21:26::Unable to import 'maybe_missing_2':UNDEFINED - no-name-in-module:33:0:33:49::No name 'syntax_error' in module 'functional.s.syntax':UNDEFINED --syntax-error:33:0:None:None::Cannot import 'functional.s.syntax.syntax_error' due to syntax error 'invalid syntax (, line 1)':UNDEFINED -+syntax-error:33:0:None:None::"Cannot import 'functional.s.syntax.syntax_error' due to syntax error ""expected '(' (, line 1)""":UNDEFINED - multiple-imports:78:0:78:15::Multiple imports on one line (foo, bar):UNDEFINED -diff --git a/tests/functional/s/syntax/syntax_error.txt b/tests/functional/s/syntax/syntax_error.txt -index 2dafd9eb3..db2afffd8 100644 ---- a/tests/functional/s/syntax/syntax_error.txt -+++ b/tests/functional/s/syntax/syntax_error.txt -@@ -1 +1 @@ --syntax-error:1:10:None:None::invalid syntax (, line 1):UNDEFINED -+syntax-error:1:10:None:None::expected '(' (, line 1):UNDEFINED --- -2.37.0 - diff --git a/0002-Split-asyncio.coroutine-tests-and-set-max_pyver-3.10.patch b/0002-Split-asyncio.coroutine-tests-and-set-max_pyver-3.10.patch index c99f7af..ae98e0d 100644 --- a/0002-Split-asyncio.coroutine-tests-and-set-max_pyver-3.10.patch +++ b/0002-Split-asyncio.coroutine-tests-and-set-max_pyver-3.10.patch @@ -1,7 +1,7 @@ -From 23df6fd770d89c4620e799580c505cd012d5cd34 Mon Sep 17 00:00:00 2001 +From 0e5d0b418369f5e460f9022441ae7bde1e502305 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 11 Jul 2022 14:23:45 -0700 -Subject: [PATCH 2/4] Split asyncio.coroutine tests and set max_pyver 3.10 for +Subject: [PATCH 2/5] Split asyncio.coroutine tests and set max_pyver 3.10 for them iterable_context_py3 includes some checks that we don't emit @@ -11,22 +11,24 @@ removed in Python 3.11, so we need to set a max version of Signed-off-by: Adam Williamson --- - .../functional/i/iterable_context_asyncio.py | 41 +++++++++++++++++++ + .../functional/i/iterable_context_asyncio.py | 43 +++++++++++++++++++ .../functional/i/iterable_context_asyncio.rc | 2 + - tests/functional/i/iterable_context_py3.py | 37 ----------------- - 3 files changed, 43 insertions(+), 37 deletions(-) + tests/functional/i/iterable_context_py3.py | 37 ---------------- + 3 files changed, 45 insertions(+), 37 deletions(-) create mode 100644 tests/functional/i/iterable_context_asyncio.py create mode 100644 tests/functional/i/iterable_context_asyncio.rc diff --git a/tests/functional/i/iterable_context_asyncio.py b/tests/functional/i/iterable_context_asyncio.py new file mode 100644 -index 000000000..2ab207d9f +index 000000000..20a32cefd --- /dev/null +++ b/tests/functional/i/iterable_context_asyncio.py -@@ -0,0 +1,41 @@ +@@ -0,0 +1,43 @@ +""" +Checks that we don't erroneously emit not-an-iterable errors for +coroutines built with asyncio.coroutine. ++ ++These decorators were deprecated in 3.8 and removed in 3.10. +""" +# pylint: disable=missing-docstring,too-few-public-methods,unused-argument,bad-mcs-method-argument +# pylint: disable=wrong-import-position diff --git a/0003-Don-t-emit-super-init-not-called-for-Enum-subclasses.patch b/0003-Don-t-emit-super-init-not-called-for-Enum-subclasses.patch index 9a6a5c9..2b0481f 100644 --- a/0003-Don-t-emit-super-init-not-called-for-Enum-subclasses.patch +++ b/0003-Don-t-emit-super-init-not-called-for-Enum-subclasses.patch @@ -1,7 +1,7 @@ -From e32efbc39664433ff0cdb17cb6782b72441cdc36 Mon Sep 17 00:00:00 2001 +From 207ddecfd73799a69bbb32b5b000cac6474c438c Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 11 Jul 2022 15:07:02 -0700 -Subject: [PATCH 3/4] Don't emit super-init-not-called for Enum subclasses +Subject: [PATCH 3/5] Don't emit super-init-not-called for Enum subclasses For some reason, commit 83d544b to cpython added a `__init__` to `Enum` which does nothing (it just says `pass`). The examples diff --git a/0004-Set-max_pyver-3.10-for-some-deprecations-removed-in-.patch b/0004-Set-max_pyver-3.10-for-some-deprecations-removed-in-.patch index 5ad96b8..6b6926e 100644 --- a/0004-Set-max_pyver-3.10-for-some-deprecations-removed-in-.patch +++ b/0004-Set-max_pyver-3.10-for-some-deprecations-removed-in-.patch @@ -1,7 +1,7 @@ -From a606c5fb4d620b19ba4a618b39d683b374241a6b Mon Sep 17 00:00:00 2001 +From 18a067bf2e664bc6040e849d59d0a1be425e660c Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 11 Jul 2022 16:35:20 -0700 -Subject: [PATCH 4/4] Set max_pyver 3.10 for some deprecations removed in 3.11 +Subject: [PATCH 4/5] Set max_pyver 3.10 for some deprecations removed in 3.11 The `binhex` module and `binascii.b2a_hqx()` function, which were deprecated in 3.9, are removed entirely in 3.11. diff --git a/0005-Change-syntax_error-test-for-consistent-output.patch b/0005-Change-syntax_error-test-for-consistent-output.patch new file mode 100644 index 0000000..3b93045 --- /dev/null +++ b/0005-Change-syntax_error-test-for-consistent-output.patch @@ -0,0 +1,36 @@ +From fcbbe282c1bc80d45318b61fe3f2b5b5209a4bf5 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Tue, 12 Jul 2022 12:25:04 -0700 +Subject: [PATCH 5/5] Change syntax_error test for consistent output + +Python 3.11 changes the string representation of the +SyntaxError triggered by this test - it now says "expected '('" +instead of just "invalid syntax". This changes the test to use +a different error (incomplete `for` loop) which still has just +"invalid syntax" as its description in Python 3.11. This is the +same 'bad code' used in the similar `test_stdin_syntaxerror` in +the unit tests. + +Signed-off-by: Adam Williamson +--- + tests/functional/s/syntax/syntax_error.py | 2 +- + tests/functional/s/syntax/syntax_error.txt | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/functional/s/syntax/syntax_error.py b/tests/functional/s/syntax/syntax_error.py +index c93df6b05..a52040112 100644 +--- a/tests/functional/s/syntax/syntax_error.py ++++ b/tests/functional/s/syntax/syntax_error.py +@@ -1 +1 @@ +-def toto # [syntax-error] ++for # [syntax-error] +diff --git a/tests/functional/s/syntax/syntax_error.txt b/tests/functional/s/syntax/syntax_error.txt +index 2dafd9eb3..78a055cf6 100644 +--- a/tests/functional/s/syntax/syntax_error.txt ++++ b/tests/functional/s/syntax/syntax_error.txt +@@ -1 +1 @@ +-syntax-error:1:10:None:None::invalid syntax (, line 1):UNDEFINED ++syntax-error:1:5:None:None::invalid syntax (, line 1):UNDEFINED +-- +2.37.0 + diff --git a/pylint.spec b/pylint.spec index d617b83..a6dd0e8 100644 --- a/pylint.spec +++ b/pylint.spec @@ -20,15 +20,10 @@ Patch2: 0001-Ignore-deprecated-module-in-access_attr_before_def_f.patch Patch3: 0002-Split-asyncio.coroutine-tests-and-set-max_pyver-3.10.patch Patch4: 0003-Don-t-emit-super-init-not-called-for-Enum-subclasses.patch Patch5: 0004-Set-max_pyver-3.10-for-some-deprecations-removed-in-.patch +Patch6: 0005-Change-syntax_error-test-for-consistent-output.patch # Fix a test that breaks if pytest is passed any args # https://github.com/PyCQA/pylint/pull/7165 -Patch6: 0001-test_run_pylint_config-ignore-pytest-args.patch -# NOT UPSTREAMABLE: patch a couple of tests for a Python 3.11 change to -# SyntaxError string. Upstream is aware of this and will likely fix it -# better, I wasn't able to come up with a good upstreamable fix. See -# https://github.com/PyCQA/pylint/pull/6551#issuecomment-1180893393 and -# replies -Patch7: 0001-NOT-UPSTREAMABLE-update-expected-syntax-errors-for-Py.patch +Patch7: 0001-test_run_pylint_config-ignore-pytest-args.patch # Use 'trace' instead of 'turtle' in a test so it works when turtle # isn't there (we split it into python-tkinter) # https://github.com/PyCQA/pylint/pull/7168