Issue 9326: Error message for incorrect number of (function) args is incorrect (original) (raw)
Issue9326
Created on 2010-07-21 20:44 by midnightdf, last changed 2022-04-11 14:57 by admin. This issue is now closed.
Messages (6) | ||
---|---|---|
msg111116 - (view) | Author: Dave Fugate (midnightdf) | Date: 2010-07-21 20:44 |
The error message below should state something along the lines of "f() takes at least 1 non-keyword argument (0 given)". Regardless, this is a regression from 2.6 which would have emitted "f() takes at least 1 argument (0 given)" which while not perfect, is a more accurate description of the problem: D:\rft\vsl\dlr\Languages\IronPython\Tests>27 Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> def f(a, b=2): pass ... >>> f(b=2) Traceback (most recent call last): File "", line 1, in TypeError: f() takes at least 1 argument (1 given) >>> | ||
msg111117 - (view) | Author: Dave Fugate (midnightdf) | Date: 2010-07-21 20:46 |
Actually CPython 2.6 emits precisely what I'd expect: D:\rft\vsl\dlr\Languages\IronPython\Tests>26 Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> def f(a, b=2): pass ... >>> f(b=2) Traceback (most recent call last): File "", line 1, in TypeError: f() takes at least 1 non-keyword argument (0 given) | ||
msg111141 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2010-07-22 00:43 |
Benjamin was the last one who worked on this code (in issue 6474), adding him to nosy. | ||
msg137291 - (view) | Author: Armin Rigo (arigo) * ![]() |
Date: 2011-05-30 15:16 |
FWIW, this case is tested in PyPy: http://paste.pocoo.org/show/397732/ | ||
msg137292 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2011-05-30 15:20 |
I think some one should just rewrite this code from scratch. Every time I fix something, it breaks something else. | ||
msg370426 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2020-05-31 12:02 |
In Python 3: TypeError: f() missing 1 required positional argument: 'a' |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:57:04 | admin | set | github: 53572 |
2020-05-31 12:02:04 | serhiy.storchaka | set | status: open -> closednosy: + serhiy.storchakamessages: + resolution: out of datestage: test needed -> resolved |
2011-05-30 15:20:56 | benjamin.peterson | set | messages: + |
2011-05-30 15:16:33 | arigo | set | nosy: + arigomessages: + |
2010-07-22 00:43:50 | r.david.murray | set | nosy: + r.david.murray, benjamin.petersonmessages: + stage: test needed |
2010-07-21 20:46:10 | midnightdf | set | messages: + |
2010-07-21 20:44:05 | midnightdf | create |