Commit f203efd
gh-157429: Make test_detach_materialized_dict_no_memory deterministic
Add _testcapi.call_with_nomemory() which arms the allocation failure,
calls a function and removes the memory hooks without executing any
bytecode in between, so that pending work at the eval breaker (GC,
deferred frees on free-threading builds) cannot consume the failing
allocation.
The test now drops the last reference from C with this helper, accepts
only the unraisable exception reported while clearing the managed dict,
and no longer needs to run in a subprocess.
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>1 parent ad447fa commit f203efd
2 files changed
Lines changed: 54 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
1014 | 1014 | | |
1015 | 1015 | | |
1016 | 1016 | | |
1017 | | - | |
1018 | 1017 | | |
1019 | 1018 | | |
1020 | 1019 | | |
| |||
1026 | 1025 | | |
1027 | 1026 | | |
1028 | 1027 | | |
1029 | | - | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
1030 | 1031 | | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
1049 | 1045 | | |
1050 | 1046 | | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
| 1047 | + | |
| 1048 | + | |
1054 | 1049 | | |
1055 | 1050 | | |
1056 | 1051 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
213 | 246 | | |
214 | 247 | | |
215 | 248 | | |
| |||
964 | 997 | | |
965 | 998 | | |
966 | 999 | | |
| 1000 | + | |
| 1001 | + | |
967 | 1002 | | |
968 | 1003 | | |
969 | 1004 | | |
| |||
0 commit comments