Mercurial > p > roundup > code
diff roundup/backends/indexer_dbm.py @ 6491:087cae2fbcea
Handle more ResourceWarning issues.
admin.py - remove unneeded close.
mailer.py - close debug log file.
indexer.py - close read of version file
memorydb.py - close python files being compled. Similiar to instance.
not sure why it's compoing things and not just letting instance do
it.
.travis.ymv disable all except 3.9-dev till we get a handle on errors.
also increase errors to 50 from 20.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 06 Sep 2021 16:03:31 -0400 |
| parents | 3175bb92ca28 |
| children | e605ddb45701 |
line wrap: on
line diff
--- a/roundup/backends/indexer_dbm.py Mon Sep 06 15:14:58 2021 -0400 +++ b/roundup/backends/indexer_dbm.py Mon Sep 06 16:03:31 2021 -0400 @@ -51,7 +51,9 @@ # for now the file itself is a flag self.force_reindex() elif os.path.exists(version): - version = open(version).read() + fd = open(version) + version = fd.read() + fd.close() # check the value and reindex if it's not the latest if version.strip() != '1': self.force_reindex() @@ -63,7 +65,9 @@ shutil.rmtree(self.indexdb_path) os.makedirs(self.indexdb_path) os.chmod(self.indexdb_path, 0o775) # nosec - allow group write - open(os.path.join(self.indexdb_path, 'version'), 'w').write('1\n') + fd = open(os.path.join(self.indexdb_path, 'version'), 'w') + fd.write('1\n') + fd.close() self.reindex = 1 self.changed = 1 @@ -260,6 +264,7 @@ filename = self.indexdb + initchar pickle_fh = open(filename, 'wb') pickle_fh.write(zlib.compress(pickle_str)) + pickle_fh.close() os.chmod(filename, 0o664) # save done
