Message350667
Ok, I'm able to reproduce the crash using:
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir _build
cd _build
cmake3 ../llvm -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/install -DPYTHON_EXECUTABLE=$HOME/sources/cpython/_build/install/bin/python3
make -j4
make check-clang-python
The crash occurs in the test_access_specifiers() method defined in tests/cindex/test_access_specifiers.py. This test uses ctypes to call functions of the libclang.so dynamic library.
I reduced the test case from 4350 lines of Python code to 131 lines of Python which only depends on the standard library and libclang.so.
$ cd llvm-project/clang/bindings/python
$ wc -l tests/cindex/test_access_specifiers.py tests/cindex/util.py clang/cindex.py
41 tests/cindex/test_access_specifiers.py
90 tests/cindex/util.py
4219 clang/cindex.py
4350 total
$ wc -l bug.py
131 bug.py
See attached bug.py script. Python 3.7 is fine, whereas Python 3.8 does crash:
$ python3.7 bug.py
spelling
spelling = None
_CXString del: obj id=7f0904a6dcb0
spelling = None ---
$ python3.8 bug.py
spelling
spelling = None
_CXString del: obj id=7f4fa6180c40
_CXString del: obj id=7f4fa6180ac0
free(): double free detected in tcache 2
Aborted (core dumped)
Notice that _CXString.__del__() is only called once in Python 3.7, but called twice in Python 3.8. |
|
Date |
User |
Action |
Args |
2019-08-28 16:12:51 | vstinner | set | recipients:
+ vstinner, petr.viktorin, steve.dower, serge-sans-paille, Paul Monson |
2019-08-28 16:12:51 | vstinner | set | messageid: <1567008771.55.0.669059479157.issue37140@roundup.psfhosted.org> |
2019-08-28 16:12:51 | vstinner | link | issue37140 messages |
2019-08-28 16:12:51 | vstinner | create | |
|