microsoft / cascadia-code

This is a fun, new monospaced font that includes programming ligatures and is designed to enhance the modern look and feel of the Windows Terminal.
Other
25.16k stars 797 forks source link

Don't leak an open file handle; fix Pyling R1732 #584

Closed NaelsonDouglas closed 2 years ago

NaelsonDouglas commented 2 years ago

The problem The code had a case of a manual file handler pitfall, where a resource stream is opened manually and never closed.

This pitfall was detected using Pyling, which triggered a massage of code R1732 with the message "Consider using 'with' for resource-allocating operations"

The solution Used a 'with' block to automatically close the open stream on the file just after it is no longer needed