| 353 | return '#' |
| 354 | |
| 355 | def _strip_exception_details(msg): |
| 356 | # Support for IGNORE_EXCEPTION_DETAIL. |
| 357 | # Get rid of everything except the exception name; in particular, drop |
| 358 | # the possibly dotted module path (if any) and the exception message (if |
| 359 | # any). We assume that a colon is never part of a dotted name, or of an |
| 360 | # exception name. |
| 361 | # E.g., given |
| 362 | # "foo.bar.MyError: la di da" |
| 363 | # return "MyError" |
| 364 | # Or for "abc.def" or "abc.def:\n" return "def". |
| 365 | |
| 366 | start, end = 0, len(msg) |
| 367 | # The exception name must appear on the first line. |
| 368 | i = msg.find("\n") |
| 369 | if i >= 0: |
| 370 | end = i |
| 371 | # retain up to the first colon (if any) |
| 372 | i = msg.find(':', 0, end) |
| 373 | if i >= 0: |
| 374 | end = i |
| 375 | # retain just the exception name |
| 376 | i = msg.rfind('.', 0, end) |
| 377 | if i >= 0: |
| 378 | start = i+1 |
| 379 | return msg[start: end] |
| 380 | |
| 381 | class _OutputRedirectingPdb(pdb.Pdb): |
| 382 | """ |