Commit fb9cb76
committed
gh-156321: Don't eagerly log exceptions from a cancelled asyncio.shield()
When the outer future returned by shield() was cancelled, a callback was
added to the inner future that reported its exception through the loop
exception handler as soon as it completed, even if the exception was
retrieved afterwards by awaiting the inner future or calling
`exception()`. Remove the callback; an exception nobody retrieves is
still reported by the inner future itself when it is garbage collected,
like any other future.1 parent 763b6ed commit fb9cb76
3 files changed
Lines changed: 35 additions & 26 deletions
File tree
- Lib
- asyncio
- test/test_asyncio
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
938 | 938 | | |
939 | 939 | | |
940 | 940 | | |
941 | | - | |
942 | | - | |
943 | | - | |
944 | | - | |
945 | | - | |
946 | | - | |
947 | | - | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | | - | |
952 | | - | |
953 | | - | |
954 | | - | |
955 | | - | |
956 | | - | |
957 | | - | |
958 | | - | |
959 | | - | |
960 | 941 | | |
961 | 942 | | |
962 | 943 | | |
| |||
1021 | 1002 | | |
1022 | 1003 | | |
1023 | 1004 | | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | 1005 | | |
1028 | 1006 | | |
1029 | 1007 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2153 | 2153 | | |
2154 | 2154 | | |
2155 | 2155 | | |
2156 | | - | |
| 2156 | + | |
2157 | 2157 | | |
2158 | 2158 | | |
2159 | 2159 | | |
| |||
2168 | 2168 | | |
2169 | 2169 | | |
2170 | 2170 | | |
| 2171 | + | |
| 2172 | + | |
2171 | 2173 | | |
2172 | 2174 | | |
2173 | 2175 | | |
| |||
2177 | 2179 | | |
2178 | 2180 | | |
2179 | 2181 | | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
2180 | 2201 | | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
2181 | 2205 | | |
2182 | 2206 | | |
2183 | 2207 | | |
| |||
2192 | 2216 | | |
2193 | 2217 | | |
2194 | 2218 | | |
2195 | | - | |
| 2219 | + | |
2196 | 2220 | | |
2197 | | - | |
| 2221 | + | |
2198 | 2222 | | |
2199 | 2223 | | |
2200 | 2224 | | |
| |||
2206 | 2230 | | |
2207 | 2231 | | |
2208 | 2232 | | |
| 2233 | + | |
2209 | 2234 | | |
2210 | 2235 | | |
2211 | | - | |
| 2236 | + | |
| 2237 | + | |
2212 | 2238 | | |
2213 | 2239 | | |
2214 | 2240 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments