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.

Title: 2to3 fix for operator.isCallable()
Type: enhancement Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, berker.peksag, corona10, eric.araujo, levkivskyi, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2017-11-16 09:09 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 4417 merged corona10, 2017-11-16 11:14
Messages (6)
msg306346 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-16 09:09
Currently 2to3 converts `operator.isCallable(obj)` to `hasattr(obj, '__call__')`. This looks cumbersome, and can be deceived by instance attribute __call__. The more correct way is to use `isinstance(obj,`. Starting from Python 3.2 it can use the callable() builtin.
msg306454 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2017-11-17 19:27
I would convert this to `callable()` -- the conversion to is more verbose and requires an extra import (that can be slow).
msg307142 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2017-11-28 16:27
New changeset a489599793f9b00ddc2c68e2ce3bce9cbb2c09a2 by Éric Araujo (Dong-hee Na) in branch 'master':
bpo-32046: Update 2to3 when converts operator.isCallable(obj). (#4417)
msg307143 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2017-11-28 16:29
Merged in master, I suppose stable branches should be left alone?
msg321608 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2018-07-13 13:27
If we don't have plans with backporting patches than we can close this issue.
msg322998 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2018-08-02 23:52
> I suppose stable branches should be left alone?

We do backport lib2to3 PRs to maintenance branches, but since this is already in 3.7 and 3.6 is four months away from being in security-fix-only mode, I think we can close this as 'fixed' now.
Date User Action Args
2022-04-11 14:58:54adminsetgithub: 76227
2018-08-02 23:52:19berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg322998

resolution: fixed
stage: patch review -> resolved
2018-07-13 15:13:43gvanrossumsetnosy: - gvanrossum
2018-07-13 13:27:18corona10setmessages: + msg321608
2017-11-28 16:29:21eric.araujosetmessages: + msg307143
2017-11-28 16:27:00eric.araujosetmessages: + msg307142
2017-11-17 19:27:57gvanrossumsetnosy: + gvanrossum
messages: + msg306454
2017-11-16 18:26:02eric.araujosetmessages: - msg306393
2017-11-16 18:25:43eric.araujosetnosy: + eric.araujo
messages: + msg306393
2017-11-16 14:52:23corona10setnosy: + corona10
2017-11-16 11:14:20corona10setkeywords: + patch
stage: patch review
pull_requests: + pull_request4366
2017-11-16 09:09:32serhiy.storchakacreate