Return str()able representation of this exception info. :param bool showlocals: Show locals per traceback entry. Ignored if ``style=="native"``. :param str style: long|short|no|native|value traceback style. :param bool abspath:
(
self,
showlocals: bool = False,
style: "_TracebackStyle" = "long",
abspath: bool = False,
tbfilter: bool = True,
funcargs: bool = False,
truncate_locals: bool = True,
chain: bool = True,
)
| 606 | return ReprFileLocation(path, lineno + 1, exconly) |
| 607 | |
| 608 | def getrepr( |
| 609 | self, |
| 610 | showlocals: bool = False, |
| 611 | style: "_TracebackStyle" = "long", |
| 612 | abspath: bool = False, |
| 613 | tbfilter: bool = True, |
| 614 | funcargs: bool = False, |
| 615 | truncate_locals: bool = True, |
| 616 | chain: bool = True, |
| 617 | ) -> Union["ReprExceptionInfo", "ExceptionChainRepr"]: |
| 618 | """Return str()able representation of this exception info. |
| 619 | |
| 620 | :param bool showlocals: |
| 621 | Show locals per traceback entry. |
| 622 | Ignored if ``style=="native"``. |
| 623 | |
| 624 | :param str style: |
| 625 | long|short|no|native|value traceback style. |
| 626 | |
| 627 | :param bool abspath: |
| 628 | If paths should be changed to absolute or left unchanged. |
| 629 | |
| 630 | :param bool tbfilter: |
| 631 | Hide entries that contain a local variable ``__tracebackhide__==True``. |
| 632 | Ignored if ``style=="native"``. |
| 633 | |
| 634 | :param bool funcargs: |
| 635 | Show fixtures ("funcargs" for legacy purposes) per traceback entry. |
| 636 | |
| 637 | :param bool truncate_locals: |
| 638 | With ``showlocals==True``, make sure locals can be safely represented as strings. |
| 639 | |
| 640 | :param bool chain: |
| 641 | If chained exceptions in Python 3 should be shown. |
| 642 | |
| 643 | .. versionchanged:: 3.9 |
| 644 | |
| 645 | Added the ``chain`` parameter. |
| 646 | """ |
| 647 | if style == "native": |
| 648 | return ReprExceptionInfo( |
| 649 | ReprTracebackNative( |
| 650 | traceback.format_exception( |
| 651 | self.type, self.value, self.traceback[0]._rawentry |
| 652 | ) |
| 653 | ), |
| 654 | self._getreprcrash(), |
| 655 | ) |
| 656 | |
| 657 | fmt = FormattedExcinfo( |
| 658 | showlocals=showlocals, |
| 659 | style=style, |
| 660 | abspath=abspath, |
| 661 | tbfilter=tbfilter, |
| 662 | funcargs=funcargs, |
| 663 | truncate_locals=truncate_locals, |
| 664 | chain=chain, |
| 665 | ) |