Skip to content

sqlite: Raise ProgrammingError when operating on a blob with a closed connection #6285

@ever0de

Description

@ever0de

Currently, the sqlite3 module does not correctly handle cases where a Blob object is accessed after its parent database connection has been closed.

Expected Behavior
To match CPython's behavior, attempting to read (or perform other operations) on a blob after calling connection.close() should raise a sqlite3.ProgrammingError with the message "Cannot operate on a closed database".

Context
This issue prevents the standard library test test_blob_closed_db_read from passing. We need to add a check to ensure the connection is still open before processing blob operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions