File: close-file-handles.patch

package info (click to toggle)
libkdtree%2B%2B 0.7.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 872 kB
  • sloc: cpp: 2,078; sh: 623; python: 597; makefile: 89
file content (31 lines) | stat: -rw-r--r-- 1,126 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Description: Close file handles properly
Author: Sebastian Ramacher <sramacher@debian.org>
Origin: vendor
Last-Update: 2026-02-28
Forwarded: http://lists.alioth.debian.org/pipermail/libkdtree-devel/2012-October/000363.html
Forwarded: https://github.com/nvmd/libkdtree/pull/9
Applied-Upstream: https://github.com/nvmd/libkdtree/commit/0211a734ae081c26daf379d7d7b22dbbf400c05

---
 python-bindings/gen-swig-hpp.py |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/python-bindings/gen-swig-hpp.py b/python-bindings/gen-swig-hpp.py
index c675648..314820d 100755
--- a/python-bindings/gen-swig-hpp.py
+++ b/python-bindings/gen-swig-hpp.py
@@ -183,8 +183,10 @@ def write_swig_file(tmpl_fn_name, swig_fn_name):
     TMPL_BODY = "\n\n".join(TMPL_BODY_LIST)
 
     # write swig file
-    i_content = open(tmpl_fn_name, "r").read()
+    f = open(tmpl_fn_name, "r")
+    i_content = f.read()
     i_content = i_content.replace("%%TMPL_BODY%%", TMPL_BODY).replace("%%TMPL_PY_CLASS_DEF%%", "\n".join(TMPL_PY_CLASS))
+    f.close()
     f=open(swig_fn_name, "w")
     f.write(i_content)
     f.close()
-- 
1.7.10.4