[issue39670] 2to3 fix_apply tries to fix user-defined apply function calls

ilya report at bugs.python.org
Tue Feb 18 21:08:27 EST 2020


ilya <palachev.ilya at yandex.ru> added the comment:

> apply was a builtin in Python 2 and not sure 2to3 can differentiate between user defined functions that shadow builtins. https://docs.python.org/3.8/library/2to3.html#2to3fixer-apply .

> Removes usage of apply(). For example apply(function, *args, **kwargs) is converted to function(*args, **kwargs).

> You can skip the apply fixer: 2to3 -x apply /tmp/bar.py

The problem is that the code is valid both for Python2 and Python3 (for Python3, there is even no builtin shadowing, because there is no apply builtin actually), and fix_apply breaks it.
I'm testing the quality of 2to3 fixers and found this issue.
I know that it's possible to switch this fixer off, but it doesn't seem to be a proper solution because any other bug could have the same answer.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39670>
_______________________________________


More information about the Python-bugs-list mailing list