-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Bump astroid to 3.0.0, update changelog #2303
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2303 +/- ##
=======================================
Coverage 92.85% 92.85%
=======================================
Files 94 94
Lines 11056 11056
=======================================
Hits 10266 10266
Misses 790 790
Flags with carried forward coverage won't be shown. Click here to find out more.
|
We should consider reverting #1873 as part of this. It was a good idea at the time, but we did a good job with the changelog fragments. I don't know what other content we would put in the upgrade guide. |
Should we move this near the top? |
441ec9b
to
b85b5d5
Compare
b85b5d5
to
dfe9e91
Compare
Sorry, I had to put the date in. If it's ready today then.. I know the date 😄 |
@Pierre-Sassoulas do you want to wait a day or two to give @mbyrnepr2 a chance to look at #2305? |
Yeah, let's release a last 2.x maintenance version of astroid. |
Fix a regression in 2.15.7 for ``unsubscriptable-object``. Raise an `InferenceError` when there is a `SyntaxError` due to an invalid `TypeVar` name. This reverts commit 89dfb48. Closes #2305 Closes pylint-dev/pylint#9069 (cherry picked from commit 1f0f2f8) Co-authored-by: Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ready for a rebase
dfe9e91
to
2891daf
Compare
This will need a merge commit because I also merged the maintenance branch at the same time (squash or rebase won't do). |
Add support for Python 3.12, including PEP 695 type parameter syntax.
Closes Implement new nodes for PEP 695: Type Parameter Syntax #2201
Remove support for Python 3.7.
Refs Drop support for Python 3.7 #2137
Use the global inference cache when inferring, even without an explicit
InferenceContext
. This is a significant performance improvement given howoften methods default to
None
for the context argument. (Lintingastroid
itself now takes ~5% less time on Python 3.12; other projects requiring more
complex inference calculations will see greater speedups.)
Refs Improving inference caching (unnecessary context clones?) #529
Following a deprecation period starting in astroid 2.7.0, the
astroid.node_classes
and
astroid.scoped_nodes
modules have been removed in favor ofastroid.nodes.node_classes
and
astroid.nodes.scoped_nodes
.Closes Remove deprecated
astroid.node_classes
andastroid.scoped_nodes
#1072Following a deprecation period starting in astroid 2.12.0, the
astroid.mixins
modulehas been removed in favor of
astroid.nodes._base_nodes
(private).Refs Move
mixins.py
toastroid.nodes._base_nodes
#1633Return all existing arguments when calling
Arguments.arguments()
. This also meansfind_argname
will nowuse the whole list of arguments for its search.
Closes
.arguments
property ignores keyword-only args, *args, and **kwargs #2213Exclude class attributes from the
__members__
container of anEnum
class when they arenodes.AnnAssign
nodes with no assigned value.Refs false positive for type-hinted Enum class instance variable pylint#7402
Remove
@cached
and@cachedproperty
decorator (just use@cached_property
from the stdlib).Closes Astroid is leaking memory #1780
Refs Remove cachedproperty decorator #2140
Remove the
inference
module. Node inference methods are now in the moduledefining the node, rather than being associated to the node afterward.
Closes Remove monkey-patching of methods onto classes #679
Move
LookupMixIn
toastroid.nodes._base_nodes
and make it private.Remove the shims for
OperationError
,BinaryOperationError
, andUnaryOperationError
in
exceptions
. They were moved toutil
in astroid 1.5.0.Move
safe_infer()
fromhelpers
toutil
. This avoids some circular imports.Reduce file system access in
ast_from_file()
.Reduce time to
import astroid
by delayingastroid_bootstrapping()
untilthe first instantiation of
AstroidBuilder
.Closes Make
import astroid
faster (again) #2161Make
igetattr()
idempotent. This addresses some reports of varying resultswhen running pylint with
--jobs
.Closes Different results with -j4 and -j8 pylint#4356
Refs very long run time and/or stack overflow during inference #7
Fix incorrect cache keys for inference results, thereby correctly inferring types
for calls instantiating types dynamically.
Closes Wrong type inferred - inference type cache is missing context #1828
Closes pylint is confusing ExitStack() and AsyncExitStack() when both are used pylint#7464
Closes False positive
not-a-mapping
withcast
andTypeVar
pylint#8074Fix interrupted
InferenceContext
call chains, thereby addressing performanceproblems when linting
sqlalchemy
.Closes SQLAlchemy 2.0.0 takes forever to lint pylint#8150
nodes.FunctionDef
no longer inherits fromnodes.Lambda
.This is a breaking change but considered a bug fix as the nodes did not share the same
API and were not interchangeable.
We have tried to minimize the amount of breaking changes caused by this change
but some are unavoidable.
infer_call_result
now shares the same interface across all implementations. Namely:This is a breaking change for
nodes.FunctionDef
where previouslycaller
had a default ofNone
. PassingNone
again will not create a behaviour change.The breaking change allows us to better type and re-use the method within
astroid
.Improved signature of the
__init__
and__postinit__
methods of most nodes.This includes making
lineno
,col_offset
,end_lineno
,end_col_offset
andparent
required arguments for
nodes.NodeNG
and its subclasses.For most other nodes, arguments of their
__postinit__
methods have been made required to betterrepresent how they would normally be constructed by the standard library
ast
module.The following nodes were changed or updated:
nodes.AnnAssign
nodes.Arguments
nodes.Assign
nodes.AssignAttr
nodes.AssignName
nodes.Attribute
nodes.AugAssign
nodes.Await
nodes.BaseContainer
nodes.BinOp
nodes.Call
nodes.ClassDef
nodes.Compare
nodes.Comprehension
nodes.Decorators
nodes.Delete
nodes.DelAttr
nodes.DelName
nodes.Dict
nodes.DictComp
nodes.ExceptHandler
nodes.Expr
nodes.For
nodes.FunctionDef
nodes.GeneratorExp
nodes.If
nodes.IfExp
nodes.Keyword
nodes.Lambda
nodes.ListComp
nodes.Module
nodes.Name
nodes.NodeNG
nodes.Raise
nodes.Return
nodes.SetComp
nodes.Slice
nodes.Starred
objects.Super
, we also added thecall
parameter to its__init__
method.nodes.Subscript
nodes.UnaryOp
nodes.While
nodes.Yield
These changes involve breaking changes to their API but should be considered bug fixes. We
now make arguments required when they are instead of always providing defaults.
nodes.If.self.is_orelse
has been removed as it was never set correctly and thereforeprovided a false value.
Remove dependency on
wrapt
.Remove dependency on
lazy_object_proxy
. This includes the removalof the associated
lazy_import
,lazy_descriptor
andproxy_alias
utility functions.CallSite._unpack_args
andCallSite._unpack_keywords
now usesafe_infer()
forbetter inference and fewer false positives.
Closes False positive
no-value-for-parameter
due to inference edge case pylint#8544Add
attr.Factory
to the recognized class attributes for classes decorated withattrs
.Closes attrs: wrong type inferred from Factory attribute (using auto_attribs) pylint#4341
infer_property()
now observes the same property-specific workaround asinfer_functiondef
.Refs Audit the correctness of adding parent.name to child's locals in
ClassDef.__init__()
andFunctionDef.__init__()
#1490Remove unused and / or deprecated constants:
astroid.bases.BOOL_SPECIAL_METHOD
astroid.bases.BUILTINS
astroid.const.BUILTINS
astroid.const.PY38_PLUS
astroid.const.Load
astroid.const.Store
astroid.const.Del
Refs Remove unused constants #2141
frame()
raisesParentMissingError
andstatement()
raisesStatementMissing
formissing parents regardless of the value of the
future
argument (which gave this behavioralready).
The
future
argument to each method is deprecated and will be removed in astroid 4.0.Refs Add typing to
NodeNG.statement
#1217Remove deprecated
Ellipsis
,ExtSlice
,Index
nodes.Refs Remove deprecated nodes #2152
Remove deprecated
is_sys_guard
andis_typing_guard
methods.Refs Remove deprecated
is_sys_guard
+is_typing_guard
#2153Remove deprecated
doc
attribute forModule
,ClassDef
, andFunctionDef
.Use the
doc_node
attribute instead.Refs Remove deprecated
doc
attribute #2154Add new
nodes.Try
to better match Python AST. Replaces theTryExcept
and
TryFinally
nodes which have been removed.Publicize
NodeNG.repr_name()
to facilitate finding a node's nice name.Refs Crash: AttributeError: 'Call' object has no attribute 'name' pylint#8598
Fix false positives for
no-member
andinvalid-name
when using the_name_
,_value_
and_ignore_
sunders in Enums.Closes Pylint complains about _ignore_ in enum classes pylint#9015