Commit 5373bcc
Fix pyobj_to_i64 GMP clamping for huge slice indices
__gmpz_get_si truncates big ints to low bits, returning 0 for 1<<333.
This caused del a[9::1<<333] to fail with "step cannot be zero".
Fix: check __gmpz_fits_slong_p before get_si. If value doesn't fit,
clamp to near-maxsize (positive) or near-minsize (negative) based on
__gmpz_cmp_si sign check.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent b1d8302 commit 5373bcc
1 file changed
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
169 | 176 | | |
170 | 177 | | |
171 | 178 | | |
172 | 179 | | |
173 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
174 | 197 | | |
175 | 198 | | |
176 | 199 | | |
| |||
0 commit comments