Skip to content

Update hello_world.py - #9

Open
tauseef-a wants to merge 1 commit into
masterfrom
tauseef-a-patch-6
Open

Update hello_world.py#9
tauseef-a wants to merge 1 commit into
masterfrom
tauseef-a-patch-6

Conversation

@tauseef-a

Copy link
Copy Markdown
Owner

No description provided.

Comment thread scripts/hello_world.py
fp = open("def.txt")
fp.close()
try:
fp = open("def.txt")

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Problem
This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.

Fix
Consider closing the following resource: fp. The resource is allocated by call builtins.open. Execution paths that do not contain closure statements were detected. To prevent this resource leak, close fp in a try-finally block or declare it using a with statement.

More info
View details about the with statement in the Python developer's guide (external link).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant