Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue20817

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:inspect.getcallargs() raises the wrong error if 3+ arguments are missing
Type:behaviorStage:resolved
Components:Library (Lib)Versions:Python 3.3, Python 3.4
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: yselivanovNosy List: jlowin, larry, ncoghlan, python-dev, yselivanov
Priority:normalKeywords:patch

Created on2014-03-01 16:35 byjlowin, last changed2022-04-11 14:57 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
issue20817.patchjlowin,2014-03-01 16:38review
Messages (4)
msg212514 -(view)Author: Jeremiah Lowin (jlowin)*Date: 2014-03-01 16:35
If inspect.getcallargs() is called on a function and three or more arguments are missing, an IndexError is raised instead of the expected TypeError.This bug is present in Python 3.3 and 3.4.0 rc1 (5e05d7d3db9c). However, it worked as expected in Python 2.7.6.Example:>>> import inspect>>> def fn(a, b, c):>>>     pass>>> inspect.getcallargs(fn)Result:     IndexError: tuple index out of rangeExpected:    TypeError: fn() missing 3 required positional arguments: 'a', 'b' and 'c'
msg212515 -(view)Author: Jeremiah Lowin (jlowin)*Date: 2014-03-01 16:38
The bug is caused by a list of names not getting properly expanded when generating the error message. This patch fixes it (simply by adding a * in the appropriate place) and tests that a TypeError, not an IndexError, is raised.
msg214988 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2014-03-27 22:45
New changeset35302cc4fc93 by Yury Selivanov in branch 'default':inspect: Fix getcallargs() to fail correctly if more than 3 args are missing.http://hg.python.org/cpython/rev/35302cc4fc93New changeset9f06cbb7962b by Yury Selivanov in branch '3.4':inspect: Fix getcallargs() to fail correctly if more than 3 args are missing.http://hg.python.org/cpython/rev/9f06cbb7962b
msg214989 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2014-03-27 22:46
Fixed for 3.4.1 and 3.5.Thanks for the contribution!
History
DateUserActionArgs
2022-04-11 14:57:59adminsetgithub: 65016
2014-03-27 22:46:06yselivanovsetmessages: +msg214989
2014-03-27 22:45:42python-devsetstatus: open -> closed

nosy: +python-dev
messages: +msg214988

resolution: fixed
stage: resolved
2014-03-01 18:39:44yselivanovsetassignee:yselivanov

nosy: +larry,yselivanov,ncoghlan
2014-03-01 16:38:40jlowinsetfiles: +issue20817.patch
keywords: +patch
messages: +msg212515
2014-03-01 16:35:04jlowincreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp