This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2005年09月06日 19:12 by japierro, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg26218 - (view) | Author: japierro (japierro) | Date: 2005年09月06日 19:12 | |
Python 2.3.3 on Windows XP If the user supplies one valid and one invalid keyword to a function that defines two required keyword arguments, PyArg_ParseTupleAndKeywords will raise this exception: TypeError: function takes exactly 2 arguments (1 given) If, in getargs.c, vgetargskeywords, the check for "extraneous keywords" were done near the top of the function, a more meaningful exception would be thrown: TypeError: 'bad' is an invalid keyword argument for this function |
|||
| msg26219 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2005年12月16日 19:43 | |
Logged In: YES user_id=1188172 Any opinions? |
|||
| msg26220 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2005年12月27日 13:48 | |
Logged In: YES
user_id=21627
I agree that the error message should be fixed; this is even
an 'XXX' comment ("an this isn't a bug?").
Unfortunately, just looking for bad keyword arguments is not
enough - it might even be that an optional keyword argument
is supplied, and still the error message is confusing, e.g. for
>>> re.compile("a").match(pos=10)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: match() takes at least 1 argument (0 given)
Instead, I think the error message should read:
TypeError: "pattern" argument for match() is missing
as we know exactly what "meaning" the missing argument has.
This might still be unspecific if multiple required
arguments are missing, but I think just giving the first one
would be informative enough - or else it could read
TypeError: "pattern" argument for match() is missing (+2 more)
if there are 2 more missing.
Yet alternatively, it could read
TypeError: required arguments for match() missing:
'pattern', 'foo', 'bar'
Patches in this direction are welcome; the precise wording
proposal should be mentioned on python-dev.
|
|||
| msg83876 - (view) | Author: Daniel Diniz (ajaksu2) * (Python triager) | Date: 2009年03月20日 22:31 | |
Fixed on trunk and py3k, can someone test on the release branches?
Python 2.7a0 (trunk, Feb 24 2009, 10:30:17)
>>> re.compile("a").match(pos=10)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Required argument 'pattern' (pos 1) not found
|
|||
| msg85501 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2009年04月05日 14:31 | |
Looks like the new message is in 2.6 as well. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:12 | admin | set | github: 42347 |
| 2009年04月05日 14:31:48 | georg.brandl | set | status: open -> closed nosy: + georg.brandl messages: + msg85501 resolution: fixed |
| 2009年03月20日 22:31:06 | ajaksu2 | set | nosy:
+ ajaksu2 messages: + msg83876 versions: + Python 2.6, Python 3.0 |
| 2005年09月06日 19:12:46 | japierro | create | |