diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-02-20 07:24:03 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-02-20 07:24:03 +0000 |
commit | 3a4c2a06e45724d557a42a12b9a825ac7065245f (patch) | |
tree | 2583347035a27fc8321755bdeaa82a1c417f2021 /bindings | |
parent | 6c03a38d81cc87645850843824824c2ae1defd32 (diff) |
[libclang/python] Use a Python standard library module to create a temporary file.
Patch by Brian Gesiak!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201762 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/python/tests/cindex/test_translation_unit.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/bindings/python/tests/cindex/test_translation_unit.py b/bindings/python/tests/cindex/test_translation_unit.py index f77998e524..be6cd671ae 100644 --- a/bindings/python/tests/cindex/test_translation_unit.py +++ b/bindings/python/tests/cindex/test_translation_unit.py @@ -1,5 +1,6 @@ import gc import os +import tempfile from clang.cindex import CursorKind from clang.cindex import Cursor @@ -93,15 +94,7 @@ def save_tu(tu): Returns the filename it was saved to. """ - - # FIXME Generate a temp file path using system APIs. - base = 'TEMP_FOR_TRANSLATIONUNIT_SAVE.c' - path = os.path.join(kInputsDir, base) - - # Just in case. - if os.path.exists(path): - os.unlink(path) - + _, path = tempfile.mkstemp() tu.save(path) return path |