Issue1596

classification
Title: SynchronizedCallable does not report that it is callable [suggested fix]
Type: behaviour Severity: normal
Components: Core Versions: 2.5.1
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: bpedman, pjenvey
Priority: Keywords:

Created on 2010-04-12.15:50:46 by bpedman, last changed 2010-04-14.02:45:21 by pjenvey.

Messages
msg5682 (view) Author: Brandon (bpedman) Date: 2010-04-12.15:50:46
When I get a SynchronizedCallable object back from looking up an attribute on an object it does not report that it is callable. This makes it hard to determine whether the object is just a regular attribute or a method or something else. (In my case I really just need to detect that it is callable). This occurs by calling object.isCallable() and any SynchronizedCallable will return false even though it should be callable.

The reason this happens is because the actual object that would report that it is callable is stored as an attribute on the object. To fix this there are a couple of options, both include creating a method in the SynchronizedCallable class:

1.) Just return true since it is a callable

public boolean isCallable(){
    return true;
}

2) check the isCallable() function on the callable object
public boolean isCallable(){
    return callable.isCallable();
}

I think option 2 is more safe but I don't know what leads up to the creation of a SynchronizedCallable or if there is any verification that happens to make sure the callable object is callable, so it could just be by virtue of it being a SynchronizedCallable that it is in fact callable.
msg5698 (view) Author: Philip Jenvey (pjenvey) Date: 2010-04-14.02:45:21
I commited #1 in r7026, because it does implement __call__, but __call__ is not exposed on the object. We could expose it via the exposed annotations, but it's not that big of a deal for a simple class like this
History
Date User Action Args
2010-04-14 02:45:22pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg5698
nosy: + pjenvey
2010-04-12 15:50:46bpedmancreate