From 3f13bb116db885ab38639a795799d0a7aa750b47 Mon Sep 17 00:00:00 2001 From: mhagger Date: Thu, 16 May 2013 06:06:38 +0000 Subject: [PATCH] Make sure to close CVS repository files after parsing them. Aside from being the right thing to do, this prevents exhaustion of file descriptors on Python implementations that are not based on reference counting. This should fix issue #149. git-svn-id: http://cvs2svn.tigris.org/svn/cvs2svn/trunk@5421 be7e6eca-30d4-0310-a8e5-ac0d63af7087 --- cvs2svn_lib/collect_data.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cvs2svn_lib/collect_data.py b/cvs2svn_lib/collect_data.py index ba7f3b93..151f7b59 100644 --- a/cvs2svn_lib/collect_data.py +++ b/cvs2svn_lib/collect_data.py @@ -1046,7 +1046,11 @@ class _ProjectDataCollector: logger.normal(cvs_file.rcs_path) fdc = _FileDataCollector(self, cvs_file) try: - parse(open(cvs_file.rcs_path, 'rb'), fdc) + f = open(cvs_file.rcs_path, 'rb') + try: + parse(f, fdc) + finally: + f.close() except (RCSParseError, RuntimeError): self.collect_data.record_fatal_error( "%r is not a valid ,v file" % (cvs_file.rcs_path,) -- 2.11.4.GIT