Skip to content

map with lambda is broken in Python 2; gives '<Erased>' object is not iterable #5210

Closed
@gvanrossum

Description

@gvanrossum

@Michael0x2a
This is a regression caused by your PR: f61c2ba Overhaul overload semantics, remove erasure, add union math (#5084).

Example (only works with Python 2 -- it's a syntax error with Python 3):

a = [(1, ''), (2, '')]
b = map(lambda (i, s): str(i) + s, a)

Before that PR, this would pass; now it gives

_.py:2: error: '<Erased>' object is not iterable

Simplifying this further by using a list of ints and a lambda with a non-unpacking argument makes the error going away.

Sorry for being so aggressive with priority etc., this prevents us from using master on our internal code base -- we get a dozen or so of errors due to this. It's not limited to map() -- I see it too for reduce(), imap(), and ifilter(), always with lambda (x, y): ....

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions