diff Python/ast.c @ 44237:44a24b59b16d

Fixed #1573: Improper use of the keyword-only syntax makes the parser crash >>> def f(*, **kw): ... pass ... python: Python/ast.c:652: handle_keywordonly_args: Assertion 'kwonlyargs != ((void *)0)' failed.
author Christian Heimes <christian@cheimes.de>
date Sat, 08 Dec 2007 22:11:32 +0000
parents f324631462a2
children aac33ee1a8fc
line wrap: on
line diff
--- a/Python/ast.c	Sat Dec 08 18:59:56 2007 +0000
+++ b/Python/ast.c	Sat Dec 08 22:11:32 2007 +0000
@@ -649,8 +649,8 @@
     arg_ty arg;
     int i = start;
     int j = 0; /* index for kwdefaults and kwonlyargs */
-    assert(kwonlyargs != NULL);
-    assert(kwdefaults != NULL);
+    assert((kwonlyargs != NULL && kwdefaults != NULL) ||
+           TYPE(CHILD(n, i)) == DOUBLESTAR);
     while (i < NCH(n)) {
         ch = CHILD(n, i);
         switch (TYPE(ch)) {