Commit fff2faf
Stop cursor methods from over-clearing Connection.messages per PEP 249
PEP 249 §6.1.1 says ``Connection.messages`` is cleared by *connection*
methods (cursor() / commit() / rollback() / close()); §6.1.2 says
``Cursor.messages`` is cleared by *cursor* methods. The two surfaces
are independent. Every secondary cursor method (``fetchone`` /
``fetchmany`` / ``fetchall`` / ``setinputsizes`` / ``setoutputsize``
/ ``callproc`` / ``nextset`` / ``scroll``) on both the sync ``Cursor``
and async ``AsyncCursor`` was clearing ``Connection.messages`` in
addition to its own ``Cursor.messages`` — defeating the
independent-surface contract. A sibling-cursor or direct-connection
inspection of ``connection.messages`` after a cursor call always saw
``[]`` regardless of the connection's actual diagnostic state.
Remove the 15 over-clear blocks (9 sync, 6 async) and the misciting
"PEP 249 §6.1.1 — Connection.messages is cleared by the cursor fetch
methods" comments that misread the spec. Update the existing tests
that pinned the wrong behaviour to pin the corrected independence
contract instead. Add a dedicated independence pin module covering
the full surface (fetch* / setinputsizes / setoutputsize / callproc
/ nextset / scroll, plus the existing §6.1.2 ``Cursor.messages``
clear-on-cursor-methods contract).
Behaviour is invisible today (both lists are populated nowhere — see
cycle-28-dropped/MS1) but the cross-surface read contract is fixed
for any future code path that begins populating either list, and the
comments now accurately cite the spec.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5442223 commit fff2faf
8 files changed
Lines changed: 158 additions & 105 deletions
File tree
- src/dqlitedbapi
- aio
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | 476 | | |
482 | 477 | | |
483 | 478 | | |
| |||
497 | 492 | | |
498 | 493 | | |
499 | 494 | | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | 495 | | |
506 | 496 | | |
507 | 497 | | |
| |||
542 | 532 | | |
543 | 533 | | |
544 | 534 | | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | 535 | | |
551 | 536 | | |
552 | 537 | | |
| |||
596 | 581 | | |
597 | 582 | | |
598 | 583 | | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | 584 | | |
603 | 585 | | |
604 | 586 | | |
| |||
614 | 596 | | |
615 | 597 | | |
616 | 598 | | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | 599 | | |
621 | 600 | | |
622 | 601 | | |
| |||
635 | 614 | | |
636 | 615 | | |
637 | 616 | | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | 617 | | |
642 | 618 | | |
643 | 619 | | |
| |||
653 | 629 | | |
654 | 630 | | |
655 | 631 | | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | 632 | | |
660 | 633 | | |
661 | 634 | | |
| |||
675 | 648 | | |
676 | 649 | | |
677 | 650 | | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | 651 | | |
682 | 652 | | |
683 | 653 | | |
| |||
705 | 675 | | |
706 | 676 | | |
707 | 677 | | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | 678 | | |
712 | 679 | | |
713 | 680 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1202 | 1202 | | |
1203 | 1203 | | |
1204 | 1204 | | |
1205 | | - | |
1206 | | - | |
1207 | | - | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
1211 | | - | |
1212 | | - | |
1213 | 1205 | | |
1214 | 1206 | | |
1215 | 1207 | | |
| |||
1228 | 1220 | | |
1229 | 1221 | | |
1230 | 1222 | | |
1231 | | - | |
1232 | | - | |
1233 | | - | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
1237 | 1223 | | |
1238 | 1224 | | |
1239 | 1225 | | |
| |||
1271 | 1257 | | |
1272 | 1258 | | |
1273 | 1259 | | |
1274 | | - | |
1275 | | - | |
1276 | | - | |
1277 | | - | |
1278 | | - | |
1279 | | - | |
1280 | 1260 | | |
1281 | 1261 | | |
1282 | 1262 | | |
| |||
1359 | 1339 | | |
1360 | 1340 | | |
1361 | 1341 | | |
1362 | | - | |
1363 | | - | |
1364 | | - | |
1365 | 1342 | | |
1366 | 1343 | | |
1367 | 1344 | | |
| |||
1371 | 1348 | | |
1372 | 1349 | | |
1373 | 1350 | | |
1374 | | - | |
1375 | | - | |
1376 | | - | |
1377 | 1351 | | |
1378 | 1352 | | |
1379 | 1353 | | |
| |||
1397 | 1371 | | |
1398 | 1372 | | |
1399 | 1373 | | |
1400 | | - | |
1401 | | - | |
1402 | | - | |
1403 | 1374 | | |
1404 | 1375 | | |
1405 | 1376 | | |
| |||
1417 | 1388 | | |
1418 | 1389 | | |
1419 | 1390 | | |
1420 | | - | |
1421 | | - | |
1422 | | - | |
1423 | 1391 | | |
1424 | 1392 | | |
1425 | 1393 | | |
| |||
1438 | 1406 | | |
1439 | 1407 | | |
1440 | 1408 | | |
1441 | | - | |
1442 | | - | |
1443 | | - | |
1444 | 1409 | | |
1445 | 1410 | | |
1446 | 1411 | | |
| |||
1460 | 1425 | | |
1461 | 1426 | | |
1462 | 1427 | | |
1463 | | - | |
1464 | | - | |
1465 | | - | |
1466 | 1428 | | |
1467 | 1429 | | |
1468 | 1430 | | |
| |||
Lines changed: 13 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
| |||
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
98 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
99 | 104 | | |
100 | 105 | | |
101 | 106 | | |
| |||
137 | 142 | | |
138 | 143 | | |
139 | 144 | | |
140 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
33 | 34 | | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
57 | | - | |
| 61 | + | |
| 62 | + | |
58 | 63 | | |
| 64 | + | |
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
| |||
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
71 | | - | |
| 77 | + | |
| 78 | + | |
72 | 79 | | |
| 80 | + | |
Lines changed: 30 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
3 | 14 | | |
4 | 15 | | |
5 | 16 | | |
| |||
23 | 34 | | |
24 | 35 | | |
25 | 36 | | |
26 | | - | |
27 | | - | |
| 37 | + | |
| 38 | + | |
28 | 39 | | |
29 | | - | |
| 40 | + | |
| 41 | + | |
30 | 42 | | |
31 | | - | |
| 43 | + | |
32 | 44 | | |
33 | | - | |
| 45 | + | |
34 | 46 | | |
35 | | - | |
| 47 | + | |
| 48 | + | |
36 | 49 | | |
37 | | - | |
| 50 | + | |
38 | 51 | | |
39 | | - | |
| 52 | + | |
40 | 53 | | |
41 | | - | |
| 54 | + | |
| 55 | + | |
42 | 56 | | |
43 | | - | |
| 57 | + | |
44 | 58 | | |
45 | | - | |
| 59 | + | |
46 | 60 | | |
47 | | - | |
| 61 | + | |
| 62 | + | |
48 | 63 | | |
49 | 64 | | |
50 | | - | |
| 65 | + | |
0 commit comments