Fix traceback in sys.doc, sys.list_functions

This fixes #5779. In addition, it adds support for an arbitrary number
of positional arguments.
Merge pull request #5788 from terminalmage/issue5779

Fix traceback in sys.doc, sys.list_functions