[Python-checkins] r62303 - in python/trunk: Doc/library/warnings.rst Include/Python.h Include/pyerrors.h Include/sysmodule.h Include/traceback.h Include/warnings.h Lib/test/test_support.py Lib/test/test_warnings.py Lib/warnings.py Makefile.pre.in

Brett Cannon brett at python.org
Sun Apr 27 01:18:29 CEST 2008


On Sat, Apr 26, 2008 at 3:34 PM, Alexandre Vassalotti
<alexandre at peadrop.com> wrote:
> On Sat, Apr 12, 2008 at 7:44 PM, brett.cannon
> <python-checkins at python.org> wrote:
> > Author: brett.cannon
> > Date: Sun Apr 13 01:44:07 2008
> > New Revision: 62303
> >
> > Log:
> > Re-implement the 'warnings' module in C. This allows for usage of the
> > 'warnings' code in places where it was previously not possible (e.g., the
> > parser). It could also potentially lead to a speed-up in interpreter start-up
> > if the C version of the code (_warnings) is imported over the use of the
> > Python version in key places.
> >
> > Closes issue #1631171.
> [Snip]
> > Modified: python/trunk/Python/traceback.c
> > ==============================================================================
> > --- python/trunk/Python/traceback.c (original)
> > +++ python/trunk/Python/traceback.c Sun Apr 13 01:44:07 2008
> [Snip]
> >
> > static int
> > -tb_printinternal(PyTracebackObject *tb, PyObject *f, int limit)
> > +tb_displayline(PyObject *f, const char *filename, int lineno, const char *name)
> > +{
> > + int err = 0;
> > + char linebuf[2000];
> > +
> > + if (filename == NULL || name == NULL)
> > + return -1;
> > + /* This is needed by Emacs' compile command */
> > +#define FMT " File \"%.500s\", line %d, in %.500s\n"
> > + PyOS_snprintf(linebuf, sizeof(linebuf), FMT, filename, lineno, name);
> > + err = PyFile_WriteString(linebuf, f);
> > + if (err != 0)
> > + return err;
> > +
> > + err = PyFile_WriteString(" ", f);
> > + return Py_DisplaySourceLine(f, filename, lineno);
> > +}
>> I think the output extra spaces here are not necessary. This seems to
> add an indent before the exception name:
>> >>> raise KeyError
> Traceback (most recent call last):
> ...
> KeyError

Bloody fidgety output! Bah. You're right, it's off. Don't know why
there is not test failure for this. Opened issue #2699. Assigned it to
myself and made it a release blocker, but anyone who wants to beat me
to it can. =)
-Brett


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /