Commit f47d48d
committed
[lldb] Support the Python stable C API in PythonString::AsUTF8
This conditionally reimplements PythonString::AsUTF8 using
PyUnicode_AsUTF8String instead of PyUnicode_AsUTF8AndSize. The latter is
slightly more efficient because it caches the result, which also means
we can return a StringRef instead of having to allocate a std::string.
We pick the most efficient one depending on whether or not we're
targeting the Python 3.10 stable API, however we now always return the
result as a std::string.1 parent dbaa82b commit f47d48d
File tree
4 files changed
+38
-26
lines changed- lldb
- bindings/python
- source/Plugins/ScriptInterpreter/Python
4 files changed
+38
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
| 607 | + | |
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
| |||
807 | 807 | | |
808 | 808 | | |
809 | 809 | | |
810 | | - | |
| 810 | + | |
811 | 811 | | |
812 | 812 | | |
813 | 813 | | |
| |||
831 | 831 | | |
832 | 832 | | |
833 | 833 | | |
834 | | - | |
| 834 | + | |
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
| |||
854 | 854 | | |
855 | 855 | | |
856 | 856 | | |
857 | | - | |
| 857 | + | |
858 | 858 | | |
859 | 859 | | |
860 | 860 | | |
| |||
878 | 878 | | |
879 | 879 | | |
880 | 880 | | |
881 | | - | |
| 881 | + | |
882 | 882 | | |
883 | 883 | | |
884 | 884 | | |
| |||
901 | 901 | | |
902 | 902 | | |
903 | 903 | | |
904 | | - | |
| 904 | + | |
905 | 905 | | |
906 | 906 | | |
907 | 907 | | |
| |||
Lines changed: 25 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
| 408 | + | |
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
412 | | - | |
| 412 | + | |
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
417 | | - | |
| 417 | + | |
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | | - | |
422 | | - | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
423 | 427 | | |
424 | | - | |
| 428 | + | |
| 429 | + | |
425 | 430 | | |
426 | | - | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
427 | 439 | | |
428 | 440 | | |
429 | | - | |
| 441 | + | |
430 | 442 | | |
431 | 443 | | |
432 | 444 | | |
| |||
1248 | 1260 | | |
1249 | 1261 | | |
1250 | 1262 | | |
1251 | | - | |
1252 | | - | |
| 1263 | + | |
| 1264 | + | |
1253 | 1265 | | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
1257 | 1269 | | |
1258 | 1270 | | |
1259 | 1271 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
463 | | - | |
| 463 | + | |
464 | 464 | | |
465 | | - | |
| 465 | + | |
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2715 | 2715 | | |
2716 | 2716 | | |
2717 | 2717 | | |
2718 | | - | |
2719 | | - | |
| 2718 | + | |
| 2719 | + | |
2720 | 2720 | | |
2721 | 2721 | | |
2722 | 2722 | | |
| |||
2996 | 2996 | | |
2997 | 2997 | | |
2998 | 2998 | | |
2999 | | - | |
3000 | | - | |
| 2999 | + | |
| 3000 | + | |
3001 | 3001 | | |
3002 | 3002 | | |
3003 | 3003 | | |
| |||
0 commit comments