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 yselivanov
Recipients Arfrever, larry, ncoghlan, yselivanov, zzzeek
Date 2014-03-02.21:17:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393795032.13.0.521808657584.issue20828@psf.upfronthosting.co.za>
In-reply-to
Content
OK, I see.

I'd recommend you to take a look how inspect.signature is implemented in 3.3 or 3.4 (and maybe backport it to python 2 and use the new API).

To quickly fix your code, I'd suggest the following modifications:

_WrapperDescriptor = type(type.__call__)
_MethodWrapper = type(all.__call__)
_ClassMethodWrapper = type(int.__dict__['from_bytes'])

def get_callable_argspec(fn):
    if inspect.isfunction(fn) or inspect.ismethod(fn):
        inspectable = fn
    elif inspect.isclass(fn):
        inspectable = fn.__init__
    elif hasattr(fn, '__call__'):
        inspectable = fn.__call__
    else:
        inspectable = fn
   
    if isinstance(fn, (_WrapperDescriptor, _MethodWrapper, _ClassMethodWrapper)):
        raise ValueError('unsupported callable {!r}'.format(fn))

    try:
        return inspect.getargspec(inspectable)
    except TypeError:
        raise


I'm closing this issue, as there is no real bug or regression in getargspec.
History
Date User Action Args
2014-03-02 21:17:12yselivanovsetrecipients: + yselivanov, ncoghlan, larry, Arfrever, zzzeek
2014-03-02 21:17:12yselivanovsetmessageid: <1393795032.13.0.521808657584.issue20828@psf.upfronthosting.co.za>
2014-03-02 21:17:12yselivanovlinkissue20828 messages
2014-03-02 21:17:11yselivanovcreate