◐ Shell
clean mode source ↗

Fix sqlite Cursor initialization check by ever0de · Pull Request #6198 · RustPython/RustPython

@ever0de ever0de changed the title Fix sqlite3 Cursor initialization check Fix sqlite Cursor initialization check

Oct 20, 2025
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.

@ever0de ever0de marked this pull request as ready for review

October 20, 2025 16:58

youknowone

This was referenced

Dec 7, 2025