#1624 closed defect (fixed)
[patch] argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper PLUS a crash-causing typo
| Reported by: | Antti Kaihola | Owned by: | Adrian Holovaty |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Triage Stage: | Design decision needed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I use an in-memory SQLite db for unit testing. I noticed that in SQLiteCursorWrapper the params argument has an empty list as the default value, but in MysqlDebugWrapper and CursorDebugWrapper there's no default value.
Attachments (2)
Change History (6)
by , 20 years ago
| Attachment: | executemany_arguments.diff added |
|---|
comment:1 by , 20 years ago
| Summary: | argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper → [patch] argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper |
|---|
comment:2 by , 20 years ago
| priority: | lowest → normal |
|---|---|
| Severity: | trivial → normal |
| Summary: | [patch] argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper → [patch] argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper PLUS a crash-causing typo |
Found an obvious bug as well. I suppose that in executemany, params=[] has been *params at some point, since SqliteCursorWrapper tries to do len(params[0]). I'll include a fix for that in the patch as well.
by , 20 years ago
| Attachment: | executemany_arguments.2.diff added |
|---|
unifies executemany arguments and fixes a crash-causing bug in sqlite's executemany
comment:3 by , 20 years ago
The SQLiteCursorWrapper is incorrect in this case; it shouldn't have a default argument. Also, the bug you found isn't really a bug, because params is a *list* of parameter tuples, so len(params[0]) is indeed the length of the parameters.
comment:4 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
adds default value for the params argument in debug and mysql cursor wrappers