Skip to content

Unable to call iterdump method for Sqlite3 connections #118221

@kesry

Description

@kesry

Bug report

Bug description:

import sqlite3


def dict_factory(cursor, row):
    d = {}
    for idx, col in enumerate(cursor.description):
        d[col[0]] = row[idx]
    return d


def main():
    conn = sqlite3.connect(":memory:")
    cur = conn.cursor()
    # conn.row_factory = sqlite3.Row # is ok
    conn.row_factory = dict_factory # is fail
    cur.executescript("""    
        create table if not exists test(
            id integer primary key AUTOINCREMENT
        );
    """)
    cur.close()
    for line in conn.iterdump():
        print(line)


main()

CPython versions tested on:

3.12

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixestopic-sqlite3type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      close