summaryrefslogtreecommitdiffstats
path: root/clang/bindings/python/tests/cindex
diff options
context:
space:
mode:
authorJonathan Coe <jbcoe@me.com>2017-04-20 10:11:01 +0000
committerJonathan Coe <jbcoe@me.com>2017-04-20 10:11:01 +0000
commite93970c55d411a7656eb4f6009d7ae7d4adc3bcd (patch)
tree78cb0dab12936e4ab8f996b40b5b68eff11549e4 /clang/bindings/python/tests/cindex
parentdcf037a6f07ef63e74e547cce5f29d758536735c (diff)
downloadbcm5719-llvm-e93970c55d411a7656eb4f6009d7ae7d4adc3bcd.tar.gz
bcm5719-llvm-e93970c55d411a7656eb4f6009d7ae7d4adc3bcd.zip
Add Python 3 support to clang.cindex
Summary: Introduce an interop string to convert from unicode to c-strings where needed. Add missing conversions from _CXString to strings in function registrations. Explicitly evaluate lists where Python 3's lazy iterators would not otherwise do so. This is an improvement upon the reverted change proposed in https://reviews.llvm.org/D26082 Reviewers: compnerd, skalinichev, modocache, MathieuDuponchelle Reviewed By: compnerd Subscribers: cfe-commits Tags: #clang-c Differential Revision: https://reviews.llvm.org/D31568 llvm-svn: 300829
Diffstat (limited to 'clang/bindings/python/tests/cindex')
-rw-r--r--clang/bindings/python/tests/cindex/test_translation_unit.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/bindings/python/tests/cindex/test_translation_unit.py b/clang/bindings/python/tests/cindex/test_translation_unit.py
index be6cd671ae0..65d1ee02ffa 100644
--- a/clang/bindings/python/tests/cindex/test_translation_unit.py
+++ b/clang/bindings/python/tests/cindex/test_translation_unit.py
@@ -59,9 +59,12 @@ int SOME_DEFINE;
assert spellings[-1] == 'y'
def test_unsaved_files_2():
- import StringIO
+ try:
+ from StringIO import StringIO
+ except:
+ from io import StringIO
tu = TranslationUnit.from_source('fake.c', unsaved_files = [
- ('fake.c', StringIO.StringIO('int x;'))])
+ ('fake.c', StringIO('int x;'))])
spellings = [c.spelling for c in tu.cursor.get_children()]
assert spellings[-1] == 'x'
OpenPOWER on IntegriCloud