[issue20828] inspect.getargspec() returns wrong answer with datetime.today.__call__()

mike bayer report at bugs.python.org
Sun Mar 2 16:10:47 CET 2014


New submission from mike bayer:

this appears like it may be related to http://bugs.python.org/issue20786, at least in terms of inspect.getargspec() seems to be returning answers in 3.4 where it used to raise TypeError, however like in 20786 it's again returning the wrong answer.  I'm a little concerned that some change was made to allow inspection of lots of builtins that wasn't before, but the argument lists haven't been checked.

test case:

import inspect
import datetime

try:
    insp = inspect.getargspec(datetime.datetime.today.__call__)
except TypeError:
    pass
else:
    print(insp)
    assert insp == (["self"], "args", "kwargs", None)

    # claims to accept "args" and "kwargs", ok let's try...
    datetime.datetime.today.__call__(1, 2, foo='bar')

    # raises:
    # TypeError: today() takes no keyword arguments

----------
components: Library (Lib)
messages: 212556
nosy: zzzeek
priority: normal
severity: normal
status: open
title: inspect.getargspec() returns wrong answer with datetime.today.__call__()
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20828>
_______________________________________


More information about the Python-bugs-list mailing list