Repository navigation
misc: close leaked files in m.proj, g.extension, G_debug and an r.in.gdal test - #8127
Closed
abhinav-phi wants to merge 1 commit into
Closed
abhinav-phi wants to merge 1 commit into
abhinav-phi wants to merge 1 commit into
Conversation
…gdal test Close m.proj input/output files, g.extension /dev/null output and the file opened for each G_debug message. Use a context manager in fix_newlines() and in the r.in.gdal testsuite.
Member
|
Again, understand your changes, and do actual useful validations of your work. Grass 7.8 and anything other than the state of your branch is not useful |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
m.proj: close the input and output files after the conversion.g.extension: close the/dev/nulloutput handle ininstall_extension_win()andinstall_extension_std_platforms(); use a context manager for the probe read infix_newlines().grass.pygrass.modules.interface.env.G_debug(): closeGRASS_DEBUG_FILEafter each message instead of leaking one handle per call.r.in.gdaltestsuite: close the file read intest_r_in_gdal.py.Motivation and context
Part of #8122. These are the remaining small, independent leaks listed there.
How has this been tested?
G_debug(), called three times withGRASS_DEBUG_FILEset andPYTHONDEVMODE=1: before the change oneResourceWarning: unclosed file ... dbg.txt; after the change none.m.proj: the change closes handles afterp.wait(); I could not run the reproducer here because GRASS 7.8 does not acceptg.proj format=proj4, which currentm.projuses.g.extension: not run (needs an add-on download); the change only closes handles at the end of the two install functions and wraps oneopen()inwith.Types of changes
Checklist
AI assistance was used to prepare this change and the test results above.