Skip to content

Update *func* parameter annotation for sqlite3's create_function(). #8727

Closed
@shawnbrown

Description

@shawnbrown

The func parameter type for sqlite3's create_function() is defined as callback | None (see docs) but the typeshed stub does not include None as a valid type. This is a long-undocumented feature that was only recently added to the docs (see related issue python/cpython#95235 and commit python/cpython@5012bed).

In stdlib/sqlite3/dbapi2.pyi, the annotation for this parameter currently reads func: Callable[..., _SqliteData] (link) but it should be changed to func: Callable[..., _SqliteData] | None:

if sys.version_info >= (3, 8):
    def create_function(
        self, name: str, narg: int, func: Callable[..., _SqliteData] | None, *, deterministic: bool = ...
    ) -> None: ...
else:
    def create_function(
        self, name: str, num_params: int, func: Callable[..., _SqliteData] | None
    ) -> None: ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions