Skip to content

mypy type errors after upgrading tenacity to 9.1.3: logging.Logger rejected #554

@anpr

Description

@anpr

After upgrading Tenacity, mypy reports errors like:

error: Argument 1 to "before_sleep_log" has incompatible type "Logger"; expected "LoggerProtocol"  [arg-type]

I'm using the normal Python logging logger.
This should already reproduce the error:

  import logging
  from tenacity.before_sleep import before_sleep_log

  log = logging.getLogger(__name__)
  before_sleep_log(log, logging.INFO)  # mypy arg-type error

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