Commit a12edba
committed
gh-129701: Fix a data race in
* Use a mutex to avoid potentially returning a non-immortalized string,
because immortalization happens after the insertion into the interned
dict.
* Use `Py_DECREF()` calls instead of `Py_SET_REFCNT(s, Py_REFCNT(s) - 2)`
for thread-safety. This code path isn't performance sensistive, so
just use `Py_DECREF()` unconditionally for simplicity.intern_common in the free threaded build1 parent 0559339 commit a12edba
File tree
3 files changed
+18
-6
lines changed- Include/internal
- Lib/test
- Objects
3 files changed
+18
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1484 | 1484 | | |
1485 | 1485 | | |
1486 | 1486 | | |
| 1487 | + | |
1487 | 1488 | | |
1488 | 1489 | | |
1489 | 1490 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
115 | 123 | | |
116 | 124 | | |
117 | 125 | | |
| |||
15815 | 15823 | | |
15816 | 15824 | | |
15817 | 15825 | | |
| 15826 | + | |
15818 | 15827 | | |
15819 | 15828 | | |
15820 | 15829 | | |
15821 | 15830 | | |
15822 | 15831 | | |
| 15832 | + | |
15823 | 15833 | | |
15824 | 15834 | | |
15825 | 15835 | | |
| |||
15829 | 15839 | | |
15830 | 15840 | | |
15831 | 15841 | | |
| 15842 | + | |
15832 | 15843 | | |
15833 | 15844 | | |
15834 | 15845 | | |
| |||
15845 | 15856 | | |
15846 | 15857 | | |
15847 | 15858 | | |
15848 | | - | |
15849 | | - | |
15850 | | - | |
15851 | | - | |
15852 | | - | |
15853 | | - | |
| 15859 | + | |
| 15860 | + | |
15854 | 15861 | | |
15855 | 15862 | | |
15856 | 15863 | | |
| |||
15865 | 15872 | | |
15866 | 15873 | | |
15867 | 15874 | | |
| 15875 | + | |
15868 | 15876 | | |
15869 | 15877 | | |
15870 | 15878 | | |
| |||
0 commit comments