Commit b7fdcd6
committed
encoding: drop public to_str, rename internal helper to path_to_str
Replace the C-boundary uses of to_str in options.py with decode_string,
which decodes the char pointer directly (no manual ffi.string call) and
handles NULL.
Remove pygit2.to_str from the public API; it was an undocumented
accidental public helper, like to_bytes. Rename the remaining internal
helper to path_to_str, which better describes its only remaining job:
normalizing a user-supplied path argument to str in init_repository.
Add a TODO noting the decode/encode asymmetry: decode_string uses
surrogateescape while encode_string defaults to strict, so a value read
from libgit2 with bad bytes cannot be written back without raising.
Update changelog.
Assisted-by: Kimi K31 parent 74de0db commit b7fdcd6
4 files changed
Lines changed: 15 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
370 | 369 | | |
371 | 370 | | |
372 | 371 | | |
| |||
456 | 455 | | |
457 | 456 | | |
458 | 457 | | |
459 | | - | |
| 458 | + | |
460 | 459 | | |
461 | 460 | | |
462 | 461 | | |
| |||
938 | 937 | | |
939 | 938 | | |
940 | 939 | | |
941 | | - | |
942 | 940 | | |
943 | 941 | | |
944 | 942 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
| 510 | + | |
514 | 511 | | |
515 | 512 | | |
516 | 513 | | |
| |||
643 | 640 | | |
644 | 641 | | |
645 | 642 | | |
646 | | - | |
647 | | - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
648 | 646 | | |
649 | 647 | | |
650 | 648 | | |
| |||
767 | 765 | | |
768 | 766 | | |
769 | 767 | | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
| 768 | + | |
774 | 769 | | |
775 | 770 | | |
776 | 771 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| |||
113 | 118 | | |
114 | 119 | | |
115 | 120 | | |
116 | | - | |
| 121 | + | |
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
| |||
0 commit comments