Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue31071

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:*args unpacking can mask TypeErrors
Type:behaviorStage:resolved
Components:Interpreter CoreVersions:Python 3.7, Python 3.6
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: serhiy.storchakaNosy List: Stefan Pochmann, r.david.murray, serhiy.storchaka
Priority:normalKeywords:

Created on2017-07-28 16:03 byStefan Pochmann, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 2957mergedserhiy.storchaka,2017-07-31 10:31
PR 2991mergedserhiy.storchaka,2017-08-03 08:40
Messages (4)
msg299402 -(view)Author: Stefan Pochmann (Stefan Pochmann)*Date: 2017-07-28 16:03
Python 3.6 makes it sound like maps aren't iterable:>>> map(str, *map(int, [[]]))Traceback (most recent call last):  File "<pyshell#0>", line 1, in <module>    map(str, *map(int, [[]]))TypeError: type object argument after * must be an iterable, not mapMore, including a likely explanation, in my question and its answer here:https://stackoverflow.com/q/45363330/1672429Apparently the TypeError from int([]) gets mistaken for a TypeError indicating non-iterability of the map object.
msg299411 -(view)Author: R. David Murray (r.david.murray)*(Python committer)Date: 2017-07-28 17:07
Thanks for the report.  Retitling because this has nothing to do with map:>>> def foo(*args):...     raise TypeError('fake')...     yield 1... >>> foo(1, *foo())Traceback (most recent call last):  File "<stdin>", line 1, in <module>TypeError: foo() argument after * must be an iterable, not generator>>> foo(*foo())Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "<stdin>", line 2, in fooTypeError: fake
msg299690 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-08-03 08:37
New changeset25e4f779d7ae9f37a1933cb5cbfad06e673c01f9 by Serhiy Storchaka in branch 'master':bpo-31071: Avoid masking original TypeError in call with * unpacking (#2957)https://github.com/python/cpython/commit/25e4f779d7ae9f37a1933cb5cbfad06e673c01f9
msg299694 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-08-03 09:14
New changeset946a0b69e217ff22a6c056047eab42053e9a2d5f by Serhiy Storchaka in branch '3.6':[3.6]bpo-31071: Avoid masking original TypeError in call with * unpacking (GH-2957) (#2991)https://github.com/python/cpython/commit/946a0b69e217ff22a6c056047eab42053e9a2d5f
History
DateUserActionArgs
2022-04-11 14:58:49adminsetgithub: 75254
2017-08-03 09:18:25serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-08-03 09:14:37serhiy.storchakasetmessages: +msg299694
2017-08-03 08:40:10serhiy.storchakasetpull_requests: +pull_request3030
2017-08-03 08:37:19serhiy.storchakasetmessages: +msg299690
2017-07-31 10:32:38serhiy.storchakasetassignee:serhiy.storchaka

nosy: +serhiy.storchaka
components: + Interpreter Core
stage: needs patch -> patch review
2017-07-31 10:31:51serhiy.storchakasetpull_requests: +pull_request3005
2017-07-28 17:07:53r.david.murraysetnosy: +r.david.murray
title: Bad error message about maps not iterable -> *args unpacking can mask TypeErrors
messages: +msg299411

versions: + Python 3.7
stage: needs patch
2017-07-28 16:03:22Stefan Pochmanncreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp