Skip to content

dbapi2 set_progress_handler callback return type #8105

@LefterisJP

Description

@LefterisJP

I have a question regarding the type in dbapi's sqlite set_progress_handler callback return type.

It seems to be defined here:

def set_progress_handler(self, progress_handler: Callable[[], bool | None] | None, n: int) -> None: ...

and to set the return type to an optional bool.

But from what I see in the docs and from the behaviour when trying to use it the callback should return an int and if that is a non-zero int the execution will be terminated.

Now, with boolean this will also work, but execution would be terminated if True is returned, and it would keep on going if False is returned.

I think it would make more sense to have the type definitions aligned with the docs and have it return an Optional int.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions