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

Correct references to removed TryExcept node #2248

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ Release date: TBA
- ``nodes.Slice``
- ``nodes.Starred``
- ``objects.Super``, we also added the ``call`` parameter to its ``__init__`` method.
- ``nodes.TryExcept``
- ``nodes.Subscript``
- ``nodes.UnaryOp``
- ``nodes.While``
Expand Down
4 changes: 2 additions & 2 deletions astroid/nodes/node_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def are_exclusive(stmt1, stmt2, exceptions: list[str] | None = None) -> bool:
algorithm :
1) index stmt1's parents
2) climb among stmt2's parents until we find a common parent
3) if the common parent is a If or TryExcept statement, look if nodes are
3) if the common parent is a If or Try statement, look if nodes are
in exclusive branches
"""
# index stmt1's parents
Expand Down Expand Up @@ -2542,7 +2542,7 @@ class ExceptHandler(
print("Error!")
''')
>>> node
<TryExcept l.2 at 0x7f23b2e9d908>
<Try l.2 at 0x7f23b2e9d908>
>>> node.handlers
[<ExceptHandler l.4 at 0x7f23b2e9e860>]
"""
Expand Down
7 changes: 2 additions & 5 deletions doc/api/astroid.nodes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ Nodes
astroid.nodes.Slice
astroid.nodes.Starred
astroid.nodes.Subscript
astroid.nodes.TryExcept
astroid.nodes.TryFinally
astroid.nodes.Try
astroid.nodes.TryStar
astroid.nodes.Tuple
astroid.nodes.TypeAlias
Expand Down Expand Up @@ -224,9 +223,7 @@ Nodes

.. autoclass:: astroid.nodes.Subscript

.. autoclass:: astroid.nodes.TryExcept

.. autoclass:: astroid.nodes.TryFinally
.. autoclass:: astroid.nodes.Try

.. autoclass:: astroid.nodes.TryStar

Expand Down
3 changes: 1 addition & 2 deletions tests/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -6025,8 +6025,7 @@ def test_exception_lookup_last_except_handler_wins() -> None:
assert isinstance(inferred_exc, Instance)
assert inferred_exc.name == "OSError"

# Check that two except handlers on the same TryExcept works the same as separate
# TryExcepts
# Two except handlers on the same Try work the same as separate
node = extract_node(
"""
try:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_nodes_lineno.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ def test_end_lineno_dict() -> None:

@staticmethod
def test_end_lineno_try() -> None:
"""TryExcept, TryFinally, ExceptHandler."""
"""Try, ExceptHandler."""
code = textwrap.dedent(
"""
try: #@
Expand Down
Loading