This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nnorwitz
Recipients alexandre.vassalotti, christian.heimes, donmez, gregory.p.smith, gvanrossum, loewis, nnorwitz
Date 2008-01-28.02:41:04
SpamBayes Score 0.013795196
Marked as misclassified No
Message-id <ee2a432c0801271841y59269f3di188946e30eeadee8@mail.gmail.com>
In-reply-to <1201487330.59.0.0890154001472.issue1621@psf.upfronthosting.co.za>
Content
I just added -Wstrict-overflow to the code in sysmodule.c
(sys_getframe) and tried with gcc 4.2.1.  It doesn't warn.  I wonder
if 4.3 is more picky or warns when it shouldn't?

Unless if I changed the code so it doesn't work:

typedef struct {int ref;} PyObject;
typedef struct { PyObject* f_back; } PyFrameObject;
int PyArg_ParseTuple(PyObject*, const char*, int*);

PyObject *
sys_getframe(PyFrameObject *f, PyObject *self, PyObject *args)
{
        int depth = -1;

        if (!PyArg_ParseTuple(args, "|i:_getframe", &depth))
                return 0;

        while (depth > 0 && f != 0) {
                f = (PyFrameObject*)f->f_back;
                --depth;
        }
        return (PyObject*)f;
}

Compiled with:
gcc-4.2.1-glibc-2.3.2/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-gcc
-Wstrict-overflow -c xx.c

produced no warnings.  This is not a stock gcc 4.2.1, so that could
also be an issue.  Did I run it correctly.  Is there anything else I
need to do?  If you run the code above with gcc 4.3, does it produce a
warning?
History
Date User Action Args
2008-01-28 02:41:06nnorwitzsetspambayes_score: 0.0137952 -> 0.013795196
recipients: + nnorwitz, gvanrossum, loewis, gregory.p.smith, christian.heimes, alexandre.vassalotti, donmez
2008-01-28 02:41:05nnorwitzlinkissue1621 messages
2008-01-28 02:41:04nnorwitzcreate