[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-09 Thread Christian Heimes

Christian Heimes added the comment:

I'm fine with your patch. Can you commit it please?

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Committed revision 59443.

--
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Alexandre Vassalotti

Changes by Alexandre Vassalotti:


--
versions: +Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Alexandre Vassalotti

New submission from Alexandre Vassalotti:

I found that the parser fails to handle correctly the (incorrect) case
where the single-star (*), used for delimiting keyword-only arguments,
is immediately followed by a **keywords parameter:

 def f(*, **kw):
...   pass
... 
python: Python/ast.c:652: handle_keywordonly_args: Assertion `kwonlyargs
!= ((void *)0)' failed.
[1]7872 abort (core dumped)  ./python

--
components: Interpreter Core
keywords: py3k
messages: 58299
nosy: alexandre.vassalotti
severity: normal
status: open
title: Improper use of the keyword-only syntax makes the parser crash
type: crash

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Fixed in r59432

I've altered the assert(). It now checks if either kwonlyargs and
kwdefault or both not NULL or the next node is a DOUBLESTAR.

--
nosy: +tiran

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Christian Heimes

Changes by Christian Heimes:


--
resolution:  - fixed
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Err... I think it should raise a SyntaxError in this case.
See my attached patch.

--
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file8894/kwonly.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__

kwonly.patch
Description: Binary data
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc:


--
status: closed - open

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Why do you want to forbid 

def f(*, **kw)

? It's useful and it also works in release builds of Python 3.0a2. It
only breaks in debug builds because the assert() gets triggered.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Alexandre Vassalotti

Alexandre Vassalotti added the comment:

Amaury is right. def f(*, **kw): pass should raise a SyntaxError. The
keyword-only delimiter is useless since the **kw parameter already only
accepts keywords.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

 Why do you want to forbid
   def f(*, **kw)

Well, TOOWTDI and the like...
and the first time I saw it, it seemed that any number of parameters is
allowed!

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Ah, you and Amaury are right! But I don't like Amaury's error message:

SyntaxError: no name for vararg

It doesn't explain what's wrong. How about

SyntaxError: keyword only arguments require at least one keyword

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Kirk McDonald has an even better error message for us:

SyntaxError: Cannot specify keyword only arguments without named arguments

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Christian Heimes

Christian Heimes added the comment:

Here is another error message from Thomas Wouters 'named arguments must
follow bare *'

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1573] Improper use of the keyword-only syntax makes the parser crash

2007-12-08 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Right.
We should also replace the other occurence of no name for vararg.
Here is another patch, against the current revision (59434).

Added file: http://bugs.python.org/file8895/kwonly2.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1573
__

kwonly2.patch
Description: Binary data
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com