Commit e44e507
committed
PyObject_SetAttr() and PyObject_GetAttr() now also accept Unicode
objects for the attribute name. Unicode objects are converted to
a string using the default encoding before trying the lookup.
Note that previously it was allowed to pass arbitrary objects as
attribute name in case the tp_getattro/setattro slots were defined.
This patch fixes this by applying an explicit string check first:
all uses of these slots expect string objects and do not check
for the type resulting in a core dump. The tp_getattro/setattro
are still useful as optimization for lookups using interned
string objects though.
This patch fixes bug #113829.1 parent 1de8098 commit e44e507
1 file changed
Lines changed: 37 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
706 | 711 | | |
707 | 712 | | |
708 | 713 | | |
709 | | - | |
710 | | - | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
711 | 722 | | |
712 | 723 | | |
713 | 724 | | |
714 | 725 | | |
715 | 726 | | |
716 | 727 | | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
717 | 731 | | |
718 | 732 | | |
719 | 733 | | |
| |||
733 | 747 | | |
734 | 748 | | |
735 | 749 | | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
744 | 758 | | |
745 | | - | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
746 | 763 | | |
747 | 764 | | |
748 | 765 | | |
749 | 766 | | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
750 | 776 | | |
751 | 777 | | |
752 | 778 | | |
| |||
0 commit comments