Mailing List Archive

Misleading syntax error text
[Extracted from the psa-members list...]

Gordon McMillan wrote:
>
> Chris Fama wrote,
> > And now the rub: the exact same function definition has passed
> > through byte-compilation perfectly OK many times before with no
> > problems... of course, this points rather clearly to the
> > preceding code, but it illustrates a failing in Python's syntax
> > error messages, and IMHO a fairly serious one at that, if this is
> > indeed so.
>
> My simple experiments refuse to compile a "del getattr(..)" at
> all.

Hmm, it seems to be a failry generic error:

>>> del f(x,y)
SyntaxError: can't assign to function call

How about chainging the com_assign_trailer function in Python/compile.c
to:

static void
com_assign_trailer(c, n, assigning)
struct compiling *c;
node *n;
int assigning;
{
REQ(n, trailer);
switch (TYPE(CHILD(n, 0))) {
case LPAR: /* '(' [exprlist] ')' */
com_error(c, PyExc_SyntaxError,
assigning ? "can't assign to function call":
"can't delete expression");
break;
case DOT: /* '.' NAME */
com_assign_attr(c, CHILD(n, 1), assigning);
break;
case LSQB: /* '[' subscriptlist ']' */
com_subscriptlist(c, CHILD(n, 1), assigning);
break;
default:
com_error(c, PyExc_SystemError, "unknown trailer type");
}
}

or something along those lines...

BTW, has anybody tried my import patch recently ? I haven't heard
any citicism since posting it and wonder what made the list fall
asleep over the topic :-)

--
Marc-Andre Lemburg
______________________________________________________________________
Y2000: 61 days left
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/
Re: Misleading syntax error text [ In reply to ]
> How about chainging the com_assign_trailer function in Python/compile.c
> to:

Please don't use the python-dev list for issues like this. The place
to go is the python-bugs database
(http://www.python.org/search/search_bugs.html) or you could just send
me a patch (please use a context diff and include the standard disclaimer
language).

--Guido van Rossum (home page: http://www.python.org/~guido/)
Re: Misleading syntax error text [ In reply to ]
Guido van Rossum wrote:
>
> > How about chainging the com_assign_trailer function in Python/compile.c
> > to:
>
> Please don't use the python-dev list for issues like this. The place
> to go is the python-bugs database
> (http://www.python.org/search/search_bugs.html) or you could just send
> me a patch (please use a context diff and include the standard disclaimer
> language).

This wasn't really a bug report... I was actually looking for some
feedback prior to sending a real (context) patch.

--
Marc-Andre Lemburg
______________________________________________________________________
Y2000: 60 days left
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/