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