Commit 25a464e
authored
Fix sqlite3 Cursor initialization check (#6198)
Add proper __init__ validation for sqlite3.Cursor to ensure base class
__init__ is called before using cursor methods. This fixes the
test_cursor_constructor_call_check test case.
Changes:
- Modified Cursor to initialize with inner=None in py_new
- Added explicit __init__ method that sets up CursorInner
- Updated close() method to check for uninitialized state
- Changed error message to match CPython: 'Base Cursor.__init__ not called.'
This ensures CPython compatibility where attempting to use a Cursor
instance without calling the base __init__ raises ProgrammingError.1 parent 13329f0 commit 25a464e
File tree
2 files changed
+57
-12
lines changed- Lib/test/test_sqlite3
- stdlib/src
2 files changed
+57
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
199 | | - | |
200 | 198 | | |
201 | 199 | | |
202 | 200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1459 | 1459 | | |
1460 | 1460 | | |
1461 | 1461 | | |
| 1462 | + | |
| 1463 | + | |
1462 | 1464 | | |
1463 | 1465 | | |
1464 | 1466 | | |
| |||
1484 | 1486 | | |
1485 | 1487 | | |
1486 | 1488 | | |
| 1489 | + | |
1487 | 1490 | | |
1488 | 1491 | | |
1489 | 1492 | | |
1490 | 1493 | | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
1491 | 1521 | | |
1492 | 1522 | | |
1493 | 1523 | | |
1494 | | - | |
1495 | | - | |
1496 | | - | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
1497 | 1533 | | |
1498 | 1534 | | |
1499 | 1535 | | |
1500 | | - | |
| 1536 | + | |
1501 | 1537 | | |
1502 | 1538 | | |
1503 | 1539 | | |
| |||
1717 | 1753 | | |
1718 | 1754 | | |
1719 | 1755 | | |
1720 | | - | |
1721 | | - | |
1722 | | - | |
1723 | | - | |
1724 | | - | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
1725 | 1764 | | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
1726 | 1773 | | |
1727 | 1774 | | |
1728 | 1775 | | |
| |||
1809 | 1856 | | |
1810 | 1857 | | |
1811 | 1858 | | |
1812 | | - | |
| 1859 | + | |
1813 | 1860 | | |
1814 | 1861 | | |
1815 | 1862 | | |
| |||
0 commit comments