Skip to content

sqlite3.Row() crashes when given a Cursor whose __init__ was not called #156555

Description

@aisk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtopic-sqlite3type-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions