diff options
-rw-r--r-- | CONTRIBUTORS.txt | 2 | ||||
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | pylint/checkers/utils.py | 5 |
3 files changed, 11 insertions, 0 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index e0e3d6857..19f4842c1 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -433,3 +433,5 @@ contributors: * Raphael Gaschignard: contributor * Sorin Sbarnea: contributor + +* Batuhan Taskaya: contributor @@ -19,6 +19,10 @@ Pylint's ChangeLog * Add missing checks for deprecated functions. +* Postponed evaluation of annotations are now recognized by default if python version is above 3.10 + + Closes #3992 + What's New in Pylint 2.6.1? =========================== diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 23836f909..6c707e10f 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -50,6 +50,7 @@ import itertools import numbers import re import string +import sys from functools import lru_cache, partial from typing import Callable, Dict, Iterable, List, Match, Optional, Set, Tuple, Union @@ -212,6 +213,7 @@ SPECIAL_METHODS_PARAMS = { for name in methods # type: ignore } PYMETHODS = set(SPECIAL_METHODS_PARAMS) +PY310_PLUS = sys.version_info[:2] >= (3, 10) class NoSuchArgumentError(Exception): @@ -1264,6 +1266,9 @@ def get_node_last_lineno(node: astroid.node_classes.NodeNG) -> int: def is_postponed_evaluation_enabled(node: astroid.node_classes.NodeNG) -> bool: """Check if the postponed evaluation of annotations is enabled""" + if PY310_PLUS: + return True + module = node.root() return "annotations" in module.future_imports |