Commit 1d623e5
committed
Fix sqlite3 Cursor initialization check
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 3b48dcc commit 1d623e5
File tree
2 files changed
+40
-6
lines changed- Lib/test/test_sqlite3
- stdlib/src
2 files changed
+40
-6
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 | |
|---|---|---|---|
| |||
1488 | 1488 | | |
1489 | 1489 | | |
1490 | 1490 | | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
1491 | 1517 | | |
1492 | 1518 | | |
1493 | 1519 | | |
| |||
1497 | 1523 | | |
1498 | 1524 | | |
1499 | 1525 | | |
1500 | | - | |
| 1526 | + | |
1501 | 1527 | | |
1502 | 1528 | | |
1503 | 1529 | | |
| |||
1717 | 1743 | | |
1718 | 1744 | | |
1719 | 1745 | | |
1720 | | - | |
1721 | | - | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
1722 | 1757 | | |
1723 | 1758 | | |
1724 | 1759 | | |
1725 | 1760 | | |
| 1761 | + | |
1726 | 1762 | | |
1727 | 1763 | | |
1728 | 1764 | | |
| |||
1809 | 1845 | | |
1810 | 1846 | | |
1811 | 1847 | | |
1812 | | - | |
| 1848 | + | |
1813 | 1849 | | |
1814 | 1850 | | |
1815 | 1851 | | |
| |||
0 commit comments