+ """Format the exception type and value for display, without the traceback.
+ This is the function you always wished were in the ``traceback`` module but
+ isn't. It's *different* from ``traceback.format_exception``, which includes
+ the traceback, returns a list of lines, and has a trailing newline.
+ If you don't provide an exception object as an argument, it will call
+ ``sys.exc_info()`` to get the current exception.
+ exc_type, exc = sys.exc_info()[:2]
+ lines = traceback.format_exception_only(exc_type, exc)
+ return "".join(lines).rstrip()
def deprecate(message, pending=False, stacklevel=2):
"""Issue a deprecation warning.