diff options
| author | Masud Rahman <llvm@masudrahman.com> | 2017-10-21 16:13:41 +0000 |
|---|---|---|
| committer | Masud Rahman <llvm@masudrahman.com> | 2017-10-21 16:13:41 +0000 |
| commit | c739affc439d57e18a57f0f2c4d113ffc492cb24 (patch) | |
| tree | 950d91c9ebb80a527eec859a4047b85d97b83209 /clang/bindings/python/tests/cindex | |
| parent | 93135cb89a89bb5e32259d0e8ca854e22061ff09 (diff) | |
| download | bcm5719-llvm-c739affc439d57e18a57f0f2c4d113ffc492cb24.tar.gz bcm5719-llvm-c739affc439d57e18a57f0f2c4d113ffc492cb24.zip | |
[bindings] allow null strings in Python 3
Some API calls accept 'NULL' instead of a char array (e.g. the second
argument to 'clang_ParseTranslationUnit'). For Python 3 compatibility,
all strings are passed through 'c_interop_string' which expects to
receive only 'bytes' or 'str' objects. This change extends this
behavior to additionally allow 'None' to be supplied.
A test case was added which breaks in Python 3, and is fixed by this
change. All the test cases pass in both, Python 2 and Python 3.
llvm-svn: 316264
Diffstat (limited to 'clang/bindings/python/tests/cindex')
| -rw-r--r-- | clang/bindings/python/tests/cindex/test_index.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/cindex/test_index.py b/clang/bindings/python/tests/cindex/test_index.py index dc173f04d21..ef76692a526 100644 --- a/clang/bindings/python/tests/cindex/test_index.py +++ b/clang/bindings/python/tests/cindex/test_index.py @@ -13,3 +13,5 @@ def test_parse(): assert isinstance(index, Index) tu = index.parse(os.path.join(kInputsDir, 'hello.cpp')) assert isinstance(tu, TranslationUnit) + tu = index.parse(None, ['-c', os.path.join(kInputsDir, 'hello.cpp')]) + assert isinstance(tu, TranslationUnit) |

