--- a/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py Tue Oct 13 19:02:26 2020 +0200 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py Wed Oct 14 17:50:39 2020 +0200 @@ -1148,9 +1148,8 @@ if patch: patchFile = self.__tmpPatchFileName() try: - f = open(patchFile, "w") - f.write(patch) - f.close() + with open(patchFile, "w") as f: + f.write(patch) self.vcs.gitApply(self.dname, patchFile, cached=True, noDialog=True) self.on_refreshButton_clicked() @@ -1171,9 +1170,8 @@ if patch: patchFile = self.__tmpPatchFileName() try: - f = open(patchFile, "w") - f.write(patch) - f.close() + with open(patchFile, "w") as f: + f.write(patch) self.vcs.gitApply(self.dname, patchFile, cached=True, reverse=True, noDialog=True) self.on_refreshButton_clicked() @@ -1204,9 +1202,8 @@ if patch: patchFile = self.__tmpPatchFileName() try: - f = open(patchFile, "w") - f.write(patch) - f.close() + with open(patchFile, "w") as f: + f.write(patch) self.vcs.gitApply(self.dname, patchFile, reverse=True, noDialog=True) self.on_refreshButton_clicked()