[Python-Dev] cpython (3.3): don't run frame if it has no stack (closes #17669)

Nick Coghlan ncoghlan at gmail.com
Thu Apr 11 12:28:55 CEST 2013


On 11 Apr 2013 07:49, "Antoine Pitrou" <solipsis at pitrou.net> wrote:
>
> On Wed, 10 Apr 2013 23:01:46 +0200 (CEST)
> benjamin.peterson <python-checkins at python.org> wrote:
> > http://hg.python.org/cpython/rev/35cb75b9d653
> > changeset:   83238:35cb75b9d653
> > branch:      3.3
> > parent:      83235:172f825d7fc9
> > user:        Benjamin Peterson <benjamin at python.org>
> > date:        Wed Apr 10 17:00:56 2013 -0400
> > summary:
> >   don't run frame if it has no stack (closes #17669)
>
> Wouldn't it be better with a test?

Benjamin said much the same thing on the issue, but persuading the
interpreter to create a frame without a stack that then gets exposed to
this code path isn't straightforward :P

Cheers,
Nick.

>
> Regards
>
> Antoine.
>
>
>
> >
> > files:
> >   Misc/NEWS           |  2 ++
> >   Objects/genobject.c |  2 +-
> >   2 files changed, 3 insertions(+), 1 deletions(-)
> >
> >
> > diff --git a/Misc/NEWS b/Misc/NEWS
> > --- a/Misc/NEWS
> > +++ b/Misc/NEWS
> > @@ -12,6 +12,8 @@
> >  Core and Builtins
> >  -----------------
> >
> > +- Issue #17669: Fix crash involving finalization of generators using
yield from.
> > +
> >  - Issue #17619: Make input() check for Ctrl-C correctly on Windows.
> >
> >  - Issue #17610: Don't rely on non-standard behavior of the C qsort()
function.
> > diff --git a/Objects/genobject.c b/Objects/genobject.c
> > --- a/Objects/genobject.c
> > +++ b/Objects/genobject.c
> > @@ -178,7 +178,7 @@
> >      PyObject *yf = NULL;
> >      PyFrameObject *f = gen->gi_frame;
> >
> > -    if (f) {
> > +    if (f && f->f_stacktop) {
> >          PyObject *bytecode = f->f_code->co_code;
> >          unsigned char *code = (unsigned char
*)PyBytes_AS_STRING(bytecode);
> >
> >
>
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130411/88027645/attachment.html>


More information about the Python-Dev mailing list