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.

Author xtreak
Recipients ilya, xtreak
Date 2020-02-19.03:46:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582084015.02.0.844775891753.issue39670@roundup.psfhosted.org>
In-reply-to
Content
The fixers are supposed to be executed on Python 2 files where apply was a builtin and was shadowed. So from the context of the fixer it tries to make the modification and it cannot distinguish that it's a builtin or user-defined call. In Python 3 the apply function can be defined by the user and 2to3 fixer doesn't make sense to be executed on Python 3 files. filter is another example where the call is transformed into a list comprehension by 2to3 but by the issue it shouldn't be done because filter is a user-defined function though it's a builtin in Python 2.

def filter(func, iterable):
    pass

filter(lambda x: x % 2 == 0, range(10))

RefactoringTool: Refactored /tmp/foo.py
--- /tmp/foo.py	(original)
+++ /tmp/foo.py	(refactored)
@@ -1,4 +1,4 @@
 def filter(func, iterable):
     pass

-filter(lambda x: x % 2 == 0, range(10))
+[x for x in range(10) if x % 2 == 0]
History
Date User Action Args
2020-02-19 03:46:55xtreaksetrecipients: + xtreak, ilya
2020-02-19 03:46:55xtreaksetmessageid: <1582084015.02.0.844775891753.issue39670@roundup.psfhosted.org>
2020-02-19 03:46:55xtreaklinkissue39670 messages
2020-02-19 03:46:54xtreakcreate
Morty Proxy This is a proxified and sanitized view of the page, visit original site.