`sqlite3.Row()` crashes when given a `Cursor` whose `__init__` was not called
Open
Nobody has claimed this yet.
extension-modules
topic-sqlite3
type-crash
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Crash report
What happened?
sqlite3.Row() reads cursor->description without checking that the cursor was initialized, so a NULL slot segfaults the interpreter:
❯ python3
Python 3.14.6 (main, Jun 10 2026, 18:54:31) [GCC 15.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
... sqlite3.Row(sqlite3.Cursor.__new__(sqlite3.Cursor), ())
...
Segmentation fault (core dumped) python3
A PR is on the way.
CPython versions tested on:
3.14, CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
No response
Linked PRs
- gh-156556
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the command using sqlite3.Row(sqlite3.Cursor.new(sqlite3.Cursor), ()), then inspect the sqlite3.Row handling for an uninitialized Cursor. Done means the same input no longer segfaults the interpreter and regression coverage demonstrates the safe behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlite
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100