Repository navigation
Commit 40a7b64
committed
gh-162273: Acquire strong reference to fillvalue upfront in itertools.zip_longest
zip_longest_new() borrowed fillvalue from kwds via PyDict_GetItemWithError() and only promoted it with Py_NewRef() after calling PyObject_GetIter() on input iterables. Use PyDict_GetItemRef() upfront and decref fillvalue on error paths so clearing or mutating kwds during iterator initialization cannot free fillvalue before ownership is stored on the zip_longest object.1 parent 4b33a9d commit 40a7b64
3 files changed
Lines changed: 61 additions & 9 deletions
File tree
- Lib/test
- Misc/NEWS.d/next/Library
- Modules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
908 | 908 | | |
909 | 909 | | |
910 | 910 | | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
911 | 953 | | |
912 | 954 | | |
913 | 955 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3870 | 3870 | | |
3871 | 3871 | | |
3872 | 3872 | | |
3873 | | - | |
| 3873 | + | |
3874 | 3874 | | |
3875 | 3875 | | |
3876 | 3876 | | |
3877 | | - | |
3878 | 3877 | | |
3879 | | - | |
| 3878 | + | |
| 3879 | + | |
| 3880 | + | |
| 3881 | + | |
3880 | 3882 | | |
3881 | 3883 | | |
3882 | | - | |
3883 | | - | |
3884 | | - | |
3885 | | - | |
| 3884 | + | |
| 3885 | + | |
3886 | 3886 | | |
3887 | 3887 | | |
3888 | 3888 | | |
| 3889 | + | |
| 3890 | + | |
| 3891 | + | |
3889 | 3892 | | |
3890 | 3893 | | |
3891 | 3894 | | |
3892 | 3895 | | |
3893 | 3896 | | |
3894 | 3897 | | |
3895 | 3898 | | |
3896 | | - | |
| 3899 | + | |
| 3900 | + | |
3897 | 3901 | | |
| 3902 | + | |
3898 | 3903 | | |
3899 | 3904 | | |
3900 | 3905 | | |
3901 | 3906 | | |
3902 | 3907 | | |
| 3908 | + | |
3903 | 3909 | | |
3904 | 3910 | | |
3905 | 3911 | | |
| |||
3909 | 3915 | | |
3910 | 3916 | | |
3911 | 3917 | | |
| 3918 | + | |
3912 | 3919 | | |
3913 | 3920 | | |
3914 | 3921 | | |
| |||
3921 | 3928 | | |
3922 | 3929 | | |
3923 | 3930 | | |
| 3931 | + | |
3924 | 3932 | | |
3925 | 3933 | | |
3926 | 3934 | | |
3927 | 3935 | | |
3928 | 3936 | | |
3929 | 3937 | | |
3930 | | - | |
| 3938 | + | |
3931 | 3939 | | |
3932 | 3940 | | |
3933 | 3941 | | |
| |||
0 commit comments