E3F9 psycopg2: RealDictCursor cursor is type checking as untyped · Issue #14417 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

psycopg2: RealDictCursor cursor is type checking as untyped #14417

@Don-Burns

Description

@Don-Burns

Problem

cursors using the RealDictCursor cursor factory are being caught as untyped in mypy strict mode.

Versions

mypy==1.17.0
psycopg2==2.9.10
types-psycopg2==2.9.21.20250516

Issue not present in types-psycopg2==2.9.21.20250318 and still "reveals" as Any

Image

Replication

Save the below script

import psycopg2
from psycopg2.extras import RealDictCursor


def main(conn: psycopg2.extensions.connection) -> None:
    with conn.cursor(cursor_factory=RealDictCursor) as cursor:
        reveal_type(cursor.execute("SELECT * FROM users"))

run mypy --strict

↳ mypy --strict .
main.py:7: error: Call to untyped function "execute" in typed context  [no-untyped-call]
main.py:7: note: Revealed type is "Any"
Found 1 error in 1 file (checked 1 source file)

Metadata

Metadata

Assignees

No one assigned

    Labels

    stubs: incompleteAnnotations or sub-modules missing from an existing package or module

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0