Bug 298889

Summary: Kdev-python crashes when parsing Biopython files
Product: [Developer tools] kdev-python Reporter: Luca Beltrame <lbeltrame>
Component: Language supportAssignee: Sven Brauch <mail>
Status: RESOLVED FIXED    
Severity: crash CC: mail
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Backtrace from relevant thread using gdb

Description Luca Beltrame 2012-04-27 08:07:15 UTC
When starting KDevelop using kdev-python, if Biopython is installed, kdev-python will crash when parsing CodonTable from Bio.Data

The relevant lines from the log.

 ====> AST     ====>     building abstract syntax tree for  "/usr/lib64/python2.7/site-packages/Bio/Data/CodonTable.py" 
 ====> DUCHAIN ====>     building duchain for "/usr/lib64/python2.7/site-packages/Bio/Data/CodonTable.py"

Notice that if you remove Bio from PYTHONPATH, no crash occurs.

DrKonqui doesn't manage to get a backtrace, so I generated one with gdb, which is attached to this report.

Reproducible: Always

Steps to Reproduce:
1. Install Biopython (through pip)
2. Load KDevelop
3. Wait for parsing to reach the Bio module
Actual Results:  
KDevelop crashes.

Expected Results:  
No crash occurs.

This is current git master, on top of latest 4.8 kdelibs and latest KDevelop and KDevPlatform git master.
Comment 1 Luca Beltrame 2012-04-27 08:08:13 UTC
Created attachment 70691 [details]
Backtrace from relevant thread using gdb
Comment 2 Luca Beltrame 2012-04-27 08:10:27 UTC
Upon further investigation, there is code that is being executed in the module upon import, including a "sanity test" that involves a number of asserts, and other modifications being made run-time.
Comment 3 Sven Brauch 2012-04-27 22:00:07 UTC
KDevelop does not run any code, so that's not the reason.

There's a fancy list comprehension which the parser chokes on. I'll investigate the issue and let you know as soon as it's fixed.
Comment 4 Sven Brauch 2012-04-27 22:21:43 UTC
Git commit de51c8bf4643462a5f09f16f079bee7b48b93b80 by Sven Brauch.
Committed on 28/04/2012 at 00:19.
Pushed by brauch into branch 'master'.

Fix a crash with fancy generator ranges, and add a unit test for that

M  +27   -54   duchain/contextbuilder.cpp
M  +15   -16   duchain/declarationbuilder.cpp
M  +3    -0    duchain/tests/pyduchaintest.cpp
M  +1    -1    parser/astvisitor.h

http://commits.kde.org/kdev-python/de51c8bf4643462a5f09f16f079bee7b48b93b80
Comment 5 Sven Brauch 2012-04-27 22:23:11 UTC
Try again with current master, please. The issue should be fixed.
Comment 6 Luca Beltrame 2012-05-02 07:12:05 UTC
> Try again with current master, please. The issue should be fixed.

Sorry for the delay in the response. It is indeed fixed.