Commit 235fa72
Hold strong references to borrowed items unconditionally (not only in
free-threading builds) in _encoder_iterate_mapping_lock_held and
_encoder_iterate_fast_seq_lock_held. User callbacks invoked during
encoding can mutate or clear the underlying container, invalidating
borrowed references.
The dict iteration path was already fixed by gh-145244.
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
1 parent d761f53 commit 235fa72
File tree
3 files changed
+69
-22
lines changed- Lib/test/test_json
- Misc/NEWS.d/next/Library
- Modules
3 files changed
+69
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1745 | 1745 | | |
1746 | 1746 | | |
1747 | 1747 | | |
1748 | | - | |
1749 | | - | |
| 1748 | + | |
| 1749 | + | |
1750 | 1750 | | |
1751 | | - | |
1752 | 1751 | | |
1753 | 1752 | | |
1754 | | - | |
1755 | 1753 | | |
1756 | | - | |
1757 | 1754 | | |
1758 | 1755 | | |
1759 | 1756 | | |
| |||
1762 | 1759 | | |
1763 | 1760 | | |
1764 | 1761 | | |
1765 | | - | |
1766 | 1762 | | |
1767 | | - | |
1768 | 1763 | | |
1769 | 1764 | | |
1770 | | - | |
1771 | 1765 | | |
1772 | | - | |
1773 | 1766 | | |
1774 | 1767 | | |
1775 | 1768 | | |
| |||
1784 | 1777 | | |
1785 | 1778 | | |
1786 | 1779 | | |
1787 | | - | |
1788 | | - | |
1789 | | - | |
1790 | | - | |
| 1780 | + | |
| 1781 | + | |
1791 | 1782 | | |
1792 | 1783 | | |
1793 | 1784 | | |
| |||
1902 | 1893 | | |
1903 | 1894 | | |
1904 | 1895 | | |
1905 | | - | |
1906 | | - | |
| 1896 | + | |
| 1897 | + | |
1907 | 1898 | | |
1908 | | - | |
1909 | 1899 | | |
1910 | 1900 | | |
1911 | | - | |
1912 | 1901 | | |
1913 | | - | |
1914 | 1902 | | |
1915 | 1903 | | |
1916 | 1904 | | |
1917 | 1905 | | |
1918 | 1906 | | |
1919 | | - | |
1920 | 1907 | | |
1921 | | - | |
1922 | 1908 | | |
1923 | 1909 | | |
1924 | | - | |
1925 | 1910 | | |
1926 | | - | |
1927 | 1911 | | |
1928 | 1912 | | |
1929 | 1913 | | |
| |||
0 commit comments