Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix compatibility with python 2.5.

By not using anymore the delete argument of NamedTemporaryFile, it
is possible to have coccigrep running with python 2.5.
  • Loading branch information...
commit 0db22aeae07c40081e4e07988f7a1834b2fe9598 1 parent b89d209
@regit authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/coccigrep.py
View
6 src/coccigrep.py
@@ -421,7 +421,7 @@ def run(self, files):
raise CocciRunException("'%s' is not a file, can't "
"continue" % cfile)
# create tmp cocci file:
- tmp_cocci_file = NamedTemporaryFile(suffix=".cocci", delete=False)
+ tmp_cocci_file = NamedTemporaryFile(suffix=".cocci")
tmp_cocci_file_name = tmp_cocci_file.name
# open file with name matching operation
cocci_file = open(self.operations[self.operation], 'r')
@@ -434,7 +434,7 @@ def run(self, files):
cocci_grep = cocci_smpl + CocciGrep.cocci_python
tmp_cocci_file.write(cocci_grep)
- tmp_cocci_file.close()
+ tmp_cocci_file.flush()
# launch spatch
output = ""
@@ -466,6 +466,7 @@ def run(self, files):
continue
import pickle
err = pickle.loads(ret)
+ tmp_cocci_file.close()
unlink(tmp_cocci_file_name)
_raise_run_err(err, cmd)
# Fallback to one spatch
@@ -484,6 +485,7 @@ def run(self, files):
unlink(tmp_cocci_file_name)
_raise_run_err(err, cmd)
+ tmp_cocci_file.close()
unlink(tmp_cocci_file_name)
prevfile = None
Please sign in to comment.
Something went wrong with that request. Please try again.