Bug 351147

Summary: Segfault on 1.7.1-py3 branch while parsing a simple file
Product: [Developer tools] kdev-python Reporter: Hai Zaar <haizaar>
Component: generalAssignee: Sven Brauch <mail>
Status: RESOLVED DUPLICATE    
Severity: crash CC: mail
Priority: NOR    
Version First Reported In: 1.7.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Hai Zaar 2015-08-10 08:13:31 UTC
I've built head of 1.7-py3 against Python 3.4.3 using kdev-platform 1.7.1

While parsing the file with the following contents, kdevelop segfaults:

def iterate_tree(tree, depth, callback):
    iterators = [iter(tree.items())]
    args = []
    while iterators:
        True
        while depth:
            for k, v in iterators[-1]:
                args.append(k)

Here is the kdevelop log:
===============================
kdevelop(5981)/kdevplatform (shell) KDevelop::PluginController::loadPluginInternal: Attempting to load ' "kdevpythonsupport" '
kdevelop(5981)/kdevplatform (shell) KDevelop::PluginController::loadPluginInternal: Checking...  "Python Support (Python 3 version)"
kdevelop(5981)/kdevplatform (shell) KDevelop::PluginController::loadPluginInternal: Checked... starting to load: "Python Support (Python 3 version)"
kdevelop(5981)/kdevplatform (shell) KDevelop::PluginController::loadPluginInternal: Successfully loaded plugin ' "kdevpythonsupport" '
kdevelop(5981)/kdevplatform (shell) KDevelop::MainWindowPrivate::addPlugin: add plugin Python::LanguageSupport(0x50068b0) "kdevpythonsupport"
kdevelop(5981)/kdevplatform (language) KDevelop::LanguageController::languagesForMimetype: language-support: 0x50068d8
kdevelop(5981)/kdevplatform (shell) KDevelop::Language::Language: creating language "Python"
kdevelop(5981)/kdevplatform (language) KDevelop::LanguageControllerPrivate::addLanguageForSupport: adding supported mimetype: "text/x-python" language: "Python"
kdevelop(5981)/kdevelop (python support) Python::ParseJob::run:  ====> PARSING ====> parsing file  KUrl("file:///tmp/py/misc.py") ; has priority 10000
kdevelop(5981)/kdevelop (python support) Python::LanguageSupport::language: KDevelop::Language(0x27e81a0)
kdevelop(5981)/kdevelop (python support) Python::AstBuilder::parse:  ====> AST     ====>     building abstract syntax tree for  "/tmp/py/misc.py"
kdevelop(5981)/kdevelop (python support) Python::AstBuilder::parse: Got syntax tree from python parser: 1 1
FIX: [(1, 0) ,  (1, 11) ]  
FIXED: [(1, 0) ,  (1, 11) ]  61 
Segmentation fault (core dumped)
=====================================

Here is the stack trace:
=====================================
#0  _int_malloc (av=0x7f9730000020, bytes=26) at malloc.c:3302
#1  0x00007f9807d4e7b0 in __GI___libc_malloc (bytes=26) at malloc.c:2891
#2  0x00007f97671b88d0 in malloc (this=<optimized out>, aalloc=5) at /usr/include/qt4/QtCore/qvector.h:405
#3  QVector (args=..., this=<synthetic pointer>) at /usr/include/qt4/QtCore/qvector.h:445
#4  Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:117
#5  0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#6  0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#7  0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#8  0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#9  0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#10 0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#11 0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#12 0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#13 0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#14 0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#15 0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#16 0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#17 0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#18 0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#19 0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
#20 0x00007f97671b9004 in Python::RangeFixVisitor::visitAttribute (this=0x7f974e774950, node=0x7f9730048be0) at /home/haizaar/dev/kdev-python/parser/astbuilder.cpp:191
=====================================


Reproducible: Always
Comment 1 Sven Brauch 2015-08-10 09:13:25 UTC

*** This bug has been marked as a duplicate of bug 349990 ***
Comment 2 Hai Zaar 2015-08-10 09:15:01 UTC
Sven, are you hinting that current 1.7-py3 branch is work-in-progress with regards to python-3.4.3?
Comment 3 Sven Brauch 2015-08-10 09:15:57 UTC
If you want to put it that way, yes :)
Or rather, all Python 3 versions are broken with Python 3.4.3 and I didn't yet manage to fix it.