[Python-bugs-list] [Bug #110915] compiler core-dumps on illegal continue

noreply@sourceforge.net noreply@sourceforge.net
Mon, 28 Aug 2000 09:16:02 -0700


Bug #110915, was updated on 2000-Aug-02 05:13
Here is a current snapshot of the bug.

Project: Python
Category: Parser/Compiler
Status: Open
Resolution: None
Bug Group: Platform-specific
Priority: 7
Summary: compiler core-dumps on illegal continue

Details: On my RedHat 6.2 system, the latest CVS version of python still dumps
core on the following script:

-------------------------------------------------
def gentheta():
    while 1:
        try:
            continue
        finally:
            pass

def genkappa():
    if whatsmounted!='crystal':
        mountcrystal()
    while 1:
        if not inhibitmake:
            projtls.moveoutofway('kappa',dirok=1)
            os.mkdir('kappa')
        os.chdir('kappa')
        try:
            announce("Testing Kappa zero-point")
            # Use the detalign.vic produced by the dx calibration
            dal=os.path.join('..','dx','detalign.vic')
            if os.path.exists(dal):
                print "NOTE: Using detalign.vic from dx calibration"
                filecopy(dal,'detalign.vic')
            if not inhibitmake:
                status=os.system('calkappa make')
            else:
                status=os.system('calkappa')
            if status!=0:
                beeper.on()
                answer=command.question(root,'Calkappa Warnings',text='Calkappa issued some warnings and/or errors.\nPlease check what they are, and tell me what to do',
                                        strings=("Ignore them","Retry calkappa","Cancel and quit"))
                beeper.off()
                if answer==2:
                    cancel()
                if answer==1:
                    break
            if os.path.exists('instruct.txt'):
                beeper.on()
                answer=command.fixedfontquestion(
                    root,'Kappa missetting needs correction',
                    text=open('instruct.txt').read(),
                    strings=("I have now done this","I'm ignoring this for now","Cancel and quit"))
                beeper.off()
                if answer==2:
                    cancel()
                if answer==1:
                    break
            else:
                # No instructions means no correction required
                break
        finally:
            os.chdir('..')
-------------------------------------------
Any simplification in the second function makes the compiler
report the "SyntaxError: continue not properly in loop" in line 4.

Stack trace:
-------------------------------------------
no203[140]~%3% gdb =python     
GNU gdb 19991004
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) run x.py
Starting program: /usr/local/nonius/bin/python x.py

Program received signal SIGSEGV, Segmentation fault.
PyErr_NormalizeException (exc=0xbffff73c, val=0xbffff740, tb=0xbffff744)
    at errors.c:153
153             if (PyClass_Check(type)) {
(gdb) where
#0  PyErr_NormalizeException (exc=0xbffff73c, val=0xbffff740, tb=0xbffff744)
    at errors.c:153
#1  0x8063901 in PyErr_PrintEx (set_sys_last_vars=1) at pythonrun.c:672
#2  0x80638d6 in PyErr_Print () at pythonrun.c:663
#3  0x806368b in PyRun_SimpleFile (fp=0x80cb948, filename=0xbffff9a1 "x.py")
    at pythonrun.c:574
#4  0x806335d in PyRun_AnyFile (fp=0x80cb948, filename=0xbffff9a1 "x.py")
    at pythonrun.c:458
#5  0x80513c7 in Py_Main (argc=2, argv=0xbffff824) at main.c:271
#6  0x8050f56 in main (argc=2, argv=0xbffff824) at python.c:10
(gdb) The program is running.  Exit anyway? (y or n) y   


Follow-Ups:

Date: 2000-Aug-07 23:34
By: hooft

Comment:
Since today (compile.c 2.119) This no longer dumps core, but
gives the new "SystemError: lost syntax error" error message.
-------------------------------------------------------

Date: 2000-Aug-25 13:47
By: jhylton

Comment:
Is this bug now fixed?  The most recent comment suggests it is.  If so, please let me know and I'll close this report.

-------------------------------------------------------

Date: 2000-Aug-25 15:45
By: tim_one

Comment:
Well, while raising SystemError is friendlier than a core dump, at heart they're both ways to spell "the compiler is *really* confused" -- we shouldn't ever raise SystemError.
-------------------------------------------------------

Date: 2000-Aug-25 15:55
By: tim_one

Comment:
Note comment from compile.c:
/* This could happen if someone called PyErr_Clear() after
 * an error was reported above.  That's not supposed to
 * happen, but I just plugged one case and I'm not sure
 * there can't be others.  In that case, raise SystemError
 * so that at least it gets reported instead dumping core.
 */
PyErr_SetString(PyExc_SystemError, "lost syntax error");

So we got an internal error going here all right.  Can't reproduce under Windows, though.

-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110915&group_id=5470