[Python-checkins] python/dist/src/Python import.c,2.175.2.2,2.175.2.3

Neal Norwitz neal@metaslash.com
Sat, 01 Jun 2002 22:12:00 -0400


Guido van Rossum wrote:
> 
> > +     if (CANT_WRITE(co->co_argcount) ||
> > +         CANT_WRITE(co->co_nlocals) ||
> > +         CANT_WRITE(co->co_stacksize) ||
> > +         CANT_WRITE(co->co_flags) ||
> > +         CANT_WRITE(co->co_firstlineno)) {
> > +             if (Py_VerboseFlag)
> > +                     PySys_WriteStderr(
> > +                             "# code too large: can't write %s\n",
> > +                             cpathname);
> > +             return;
> > +     }
> 
> Maybe this should be a call to PyErr_Warn instead?

That's fine with me.  But I'm not sure the warning will be helpful.
Any suggestions for wording?  Is what's there good enough?

Here's my suggestion:

       PyOS_snprintf(buffer, sizeof(buffer),
                     "code too large: can't write %.80s\n",
                     cpathname);
       PyErr_Warn(PyExc_RuntimeWarning, buffer);

Neal