Commit 9be8728
committed
gh-145856: Fix plistlib.dumps() skipkeys behavior with mixed key types
When both skipkeys=True and sort_keys=True were passed to
plistlib.dump()/dumps(), the sort ran before the non-string keys were
filtered out, raising TypeError on dictionaries with mixed key types.
Filter non-string keys before sorting in all three write_dict sites
(XML, binary pass 1, binary pass 2).1 parent ec9ce3e commit 9be8728
3 files changed
Lines changed: 40 additions & 23 deletions
File tree
- Lib
- test
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
391 | 394 | | |
392 | | - | |
393 | | - | |
394 | | - | |
| 395 | + | |
395 | 396 | | |
396 | 397 | | |
397 | 398 | | |
398 | | - | |
399 | | - | |
400 | 399 | | |
401 | 400 | | |
402 | 401 | | |
| |||
719 | 718 | | |
720 | 719 | | |
721 | 720 | | |
| 721 | + | |
| 722 | + | |
722 | 723 | | |
723 | 724 | | |
724 | 725 | | |
725 | 726 | | |
726 | 727 | | |
727 | | - | |
728 | | - | |
729 | 728 | | |
730 | 729 | | |
731 | 730 | | |
| |||
839 | 838 | | |
840 | 839 | | |
841 | 840 | | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
842 | 845 | | |
843 | | - | |
844 | | - | |
845 | | - | |
| 846 | + | |
846 | 847 | | |
847 | 848 | | |
848 | 849 | | |
849 | | - | |
850 | | - | |
851 | 850 | | |
852 | 851 | | |
853 | 852 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
722 | 722 | | |
723 | 723 | | |
724 | 724 | | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
725 | 746 | | |
726 | 747 | | |
727 | 748 | | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
739 | 753 | | |
740 | 754 | | |
741 | 755 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments