| 326 | return '#' |
| 327 | |
| 328 | def _strip_exception_details(msg): |
| 329 | # Support for IGNORE_EXCEPTION_DETAIL. |
| 330 | # Get rid of everything except the exception name; in particular, drop |
| 331 | # the possibly dotted module path (if any) and the exception message (if |
| 332 | # any). We assume that a colon is never part of a dotted name, or of an |
| 333 | # exception name. |
| 334 | # E.g., given |
| 335 | # "foo.bar.MyError: la di da" |
| 336 | # return "MyError" |
| 337 | # Or for "abc.def" or "abc.def:\n" return "def". |
| 338 | |
| 339 | start, end = 0, len(msg) |
| 340 | # The exception name must appear on the first line. |
| 341 | i = msg.find("\n") |
| 342 | if i >= 0: |
| 343 | end = i |
| 344 | # retain up to the first colon (if any) |
| 345 | i = msg.find(':', 0, end) |
| 346 | if i >= 0: |
| 347 | end = i |
| 348 | # retain just the exception name |
| 349 | i = msg.rfind('.', 0, end) |
| 350 | if i >= 0: |
| 351 | start = i+1 |
| 352 | return msg[start: end] |
| 353 | |
| 354 | class _OutputRedirectingPdb(pdb.Pdb): |
| 355 | """ |