[Python-bugs-list] [ python-Bugs-733667 ] kwargs handled incorrectly

SourceForge.net noreply@sourceforge.net
Wed, 07 May 2003 00:54:13 -0700


Bugs item #733667, was opened at 2003-05-07 01:10
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=733667&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
>Priority: 6
Submitted By: Andrew Dalke (dalke)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: kwargs handled incorrectly

Initial Comment:
I'm using Python2.3 (first with a1 then tested with CVS version 
"Python 2.3b1+ (#7, May  6 2003, 23:41:12)" compiled a few
minutes ago).

There's a bug in how it handles an error condition with keyword
arguments.  Here's a reproducible

Python 2.3b1+ (#7, May  6 2003, 23:41:12) 
[GCC 3.1 20020420 (prerelease)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def add(a, b):
...   print "add", repr(a), repr(b)
...   return a + b
... 
>>> add(a=3)
add 'a' 3
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 3, in add
TypeError: cannot concatenate 'str' and 'int' objects
>>>

The expected behaviour is what Python 2.2 does, which is

>>> def add(a, b):
...   return a + b
... 
>>> add(a=3)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: add() takes exactly 2 non-keyword arguments (1 given)
>>> 



----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-05-07 02:54

Message:
Logged In: YES 
user_id=80475

Ouch! This is a bad one.  Bumping up the priority.




----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=733667&group_id=5470