Skip to content

Commit

Permalink
Correct references to removed TryExcept node
Browse files Browse the repository at this point in the history
Follow-up to e91a3b5.
  • Loading branch information
jacobtylerwalls committed Jul 13, 2023
1 parent cdeb259 commit ef2a416
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
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

0 comments on commit ef2a416

Please sign in to comment.