Commit 0588ae6
gh-69370: Fix "python -m inspect --details" for unencodable paths
It failed with UnicodeEncodeError if the path of the module contains
characters unencodable in the encoding of sys.stdout, e.g. undecodable
bytes of a file name. Such characters are now escaped with backslashes,
unless stdout uses an error handler which can handle them.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 1d90627 commit 0588ae6
3 files changed
Lines changed: 26 additions & 1 deletion
File tree
- Lib
- test/test_inspect
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3461 | 3461 | | |
3462 | 3462 | | |
3463 | 3463 | | |
| 3464 | + | |
| 3465 | + | |
| 3466 | + | |
| 3467 | + | |
| 3468 | + | |
3464 | 3469 | | |
3465 | 3470 | | |
3466 | 3471 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
6584 | 6584 | | |
6585 | 6585 | | |
6586 | 6586 | | |
| 6587 | + | |
| 6588 | + | |
| 6589 | + | |
| 6590 | + | |
| 6591 | + | |
| 6592 | + | |
| 6593 | + | |
| 6594 | + | |
| 6595 | + | |
| 6596 | + | |
| 6597 | + | |
| 6598 | + | |
| 6599 | + | |
| 6600 | + | |
| 6601 | + | |
| 6602 | + | |
6587 | 6603 | | |
6588 | 6604 | | |
6589 | 6605 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments