Commit 97ce996
fix: reject bare str/bytes as params with clear TypeError
params was typed as Sequence[Any], which includes str/bytes; calling
execute("SELECT ?", "alice") type-checked, iterated "alice" character
by character, and sent 5 parameters to the server. The user saw a
confusing "wrong parameter count" server error instead of a clean
client-side type mismatch.
Add a _validate_params guard at every client entry point (execute,
query_raw, fetch, fetchall, fetchval) that raises TypeError with a
helpful hint when params is str or bytes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 9dcca52 commit 97ce996
2 files changed
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
241 | 251 | | |
242 | 252 | | |
243 | 253 | | |
| |||
270 | 280 | | |
271 | 281 | | |
272 | 282 | | |
| 283 | + | |
273 | 284 | | |
274 | 285 | | |
275 | 286 | | |
| |||
281 | 292 | | |
282 | 293 | | |
283 | 294 | | |
| 295 | + | |
284 | 296 | | |
285 | 297 | | |
286 | 298 | | |
| |||
296 | 308 | | |
297 | 309 | | |
298 | 310 | | |
| 311 | + | |
299 | 312 | | |
300 | 313 | | |
301 | 314 | | |
302 | 315 | | |
303 | 316 | | |
| 317 | + | |
304 | 318 | | |
305 | 319 | | |
306 | 320 | | |
| |||
318 | 332 | | |
319 | 333 | | |
320 | 334 | | |
| 335 | + | |
321 | 336 | | |
322 | 337 | | |
323 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
841 | 841 | | |
842 | 842 | | |
843 | 843 | | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
844 | 853 | | |
845 | 854 | | |
846 | 855 | | |
| |||
0 commit comments