Skip to content

Commit

Permalink
Update error node
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed May 20, 2024
1 parent 8db31d6 commit 814d0d4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pylint/checkers/base/function_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _check_contextmanager_generator_missing_cleanup(
if self._node_fails_contextmanager_cleanup(inferred_node, yield_nodes):
self.add_message(
"contextmanager-generator-missing-cleanup",
node=node,
node=with_node,
args=(node.name,),
)

Expand Down
16 changes: 8 additions & 8 deletions tests/functional/c/contextmanager_generator_missing_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def cm():
print("cm exit")


def genfunc_with_cm(): # [contextmanager-generator-missing-cleanup]
with cm() as context:
def genfunc_with_cm():
with cm() as context: # [contextmanager-generator-missing-cleanup]
yield context * 2


Expand All @@ -27,13 +27,13 @@ def name_cm():
print("cm exit")


def genfunc_with_name_cm(): # [contextmanager-generator-missing-cleanup]
with name_cm() as context:
def genfunc_with_name_cm():
with name_cm() as context: # [contextmanager-generator-missing-cleanup]
yield context * 2


def genfunc_with_cm_after(): # [contextmanager-generator-missing-cleanup]
with after_cm() as context:
def genfunc_with_cm_after():
with after_cm() as context: # [contextmanager-generator-missing-cleanup]
yield context * 2


Expand All @@ -56,8 +56,8 @@ def cm_with_improper_handling():
print("cm exit")


def genfunc_with_cm_improper(): # [contextmanager-generator-missing-cleanup]
with cm_with_improper_handling() as context:
def genfunc_with_cm_improper():
with cm_with_improper_handling() as context: # [contextmanager-generator-missing-cleanup]
yield context * 2


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
contextmanager-generator-missing-cleanup:17:0:17:19:genfunc_with_cm:The context used in function 'genfunc_with_cm' will not be exited.:UNDEFINED
contextmanager-generator-missing-cleanup:30:0:30:24:genfunc_with_name_cm:The context used in function 'genfunc_with_name_cm' will not be exited.:UNDEFINED
contextmanager-generator-missing-cleanup:35:0:35:25:genfunc_with_cm_after:The context used in function 'genfunc_with_cm_after' will not be exited.:UNDEFINED
contextmanager-generator-missing-cleanup:59:0:59:28:genfunc_with_cm_improper:The context used in function 'genfunc_with_cm_improper' will not be exited.:UNDEFINED
contextmanager-generator-missing-cleanup:18:4:19:25:genfunc_with_cm:The context used in function 'genfunc_with_cm' will not be exited.:UNDEFINED
contextmanager-generator-missing-cleanup:31:4:32:25:genfunc_with_name_cm:The context used in function 'genfunc_with_name_cm' will not be exited.:UNDEFINED
contextmanager-generator-missing-cleanup:36:4:37:25:genfunc_with_cm_after:The context used in function 'genfunc_with_cm_after' will not be exited.:UNDEFINED
contextmanager-generator-missing-cleanup:60:4:61:25:genfunc_with_cm_improper:The context used in function 'genfunc_with_cm_improper' will not be exited.:UNDEFINED

0 comments on commit 814d0d4

Please sign in to comment.