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 dariusp
Recipients dariusp
Date 2009-01-16.05:53:15
SpamBayes Score 9.6856915e-08
Marked as misclassified No
Message-id <1232085201.15.0.206392471567.issue4959@psf.upfronthosting.co.za>
In-reply-to
Content
Hi,

Suggested log message:
formatargspec now handles keyword only args that don't have defaults. 
Previously it expected an empty dict but was being given None.


Patch:
The patch contains a suggested fix to inspect.py and a new test in
test_inspect.py and inspect_fodder2.py to demonstrate the issue.


Before:
>>> def foo(*, a):
...  print(a)
... 
>>> help(foo)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.0/site.py", line 427, in __call__
    return pydoc.help(*args, **kwds)
  File "/usr/local/lib/python3.0/pydoc.py", line 1672, in __call__
    self.help(request)
  File "/usr/local/lib/python3.0/pydoc.py", line 1716, in help
    else: doc(request, 'Help on %s:')
  File "/usr/local/lib/python3.0/pydoc.py", line 1504, in doc
    pager(render_doc(thing, title, forceload))
  File "/usr/local/lib/python3.0/pydoc.py", line 1499, in render_doc
    return title % desc + '\n\n' + text.document(object, name)
  File "/usr/local/lib/python3.0/pydoc.py", line 322, in document
    if inspect.isroutine(object): return self.docroutine(*args)
  File "/usr/local/lib/python3.0/pydoc.py", line 1263, in docroutine
    formatannotation=inspect.formatannotationrelativeto(object))
  File "/usr/local/lib/python3.0/inspect.py", line 895, in formatargspec
    if kwonlyarg in kwonlydefaults:
TypeError: argument of type 'NoneType' is not iterable


After:
>>> def foo(*, a):
...  print(a)
... 
>>> help(foo)

Help on function foo in module __main__:

foo(*, a)
History
Date User Action Args
2009-01-16 05:53:21dariuspsetrecipients: + dariusp
2009-01-16 05:53:21dariuspsetmessageid: <1232085201.15.0.206392471567.issue4959@psf.upfronthosting.co.za>
2009-01-16 05:53:19dariusplinkissue4959 messages
2009-01-16 05:53:18dariuspcreate