[gobject-introspection] giscanner: use mkstemp() instead of mktemp()



commit 4894c75fcc5a0b33d5862ed8ea87eccc6f7cb4eb
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date:   Wed Mar 20 07:48:59 2013 +0100

    giscanner: use mkstemp() instead of mktemp()
    
    mktemp was deprecated in Python 2.3...
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697624

 giscanner/sourcescanner.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index de13776..bd84a60 100644
--- a/giscanner/sourcescanner.py
+++ b/giscanner/sourcescanner.py
@@ -303,8 +303,8 @@ class SourceScanner(object):
             proc.stdin.write('#include <%s>\n' % (filename, ))
         proc.stdin.close()
 
-        tmp = tempfile.mktemp()
-        fp = open(tmp, 'w+')
+        tmp_fd, tmp_name = tempfile.mkstemp()
+        fp = os.fdopen(tmp_fd, 'w+b')
         while True:
             data = proc.stdout.read(4096)
             if data is None:
@@ -321,4 +321,4 @@ class SourceScanner(object):
 
         self._scanner.parse_file(fp.fileno())
         fp.close()
-        os.unlink(tmp)
+        os.unlink(tmp_name)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]