• Jeremy Hylton's avatar
    Print the offending line of code in the traceback for SyntaxErrors · 9f1b9932
    Jeremy Hylton yazdı
    raised by the compiler.
    
    XXX For now, text entered into the interactive intepreter is not
    printed in the traceback.
    
    Inspired by a patch from Roman Sulzhyk
    
    compile.c:
    
    Add helper fetch_program_text() that opens a file and reads until it
    finds the specified line number.  The code is a near duplicate of
    similar code in traceback.c.
    
    Modify com_error() to pass two arguments to SyntaxError constructor,
    where the second argument contains the offending text when possible.
    
    Modify set_error_location(), now used only by the symtable pass, to
    set the text attribute on existing exceptions.
    
    pythonrun.c:
    
    Change parse_syntax_error() to continue of the offset attribute of a
    SyntaxError is None.  In this case, it sets offset to -1.
    
    Move code from PyErr_PrintEx() into helper function
    print_error_text().  In the helper, only print the caret for a
    SyntaxError if offset > 0.
    9f1b9932
Adı
Son kayıt (commit)
Son güncelleme
Demo Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Python Loading commit data...
Tools Loading commit data...
.cvsignore Loading commit data...
.hgtags Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README Loading commit data...
acconfig.h Loading commit data...
config.h.in Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
install-sh Loading commit data...
setup.py Loading commit data...