Page MenuHomeSoftware Heritage

Upgrade mypy to 0.942 to fix support of types-psycopg2 >= 2.9.12
ClosedPublic

Authored by vlorentz on Apr 25 2022, 1:26 PM.

Details

Summary

types-psycopg2 2.9.12 contains this commit:
https://github.com/python/typeshed/commit/506be4fb0adcf38af77325258af337772abcde77

which removes Any as the return type of the last variant, allowing
mypy to type-check the returned value.
However, mypy 0.920 only considers the last variant, even though we use
the first one; causing the return type to be badly inferred, and
erroring every time we use it as context manager.

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D7641 (id=27657)

Rebasing onto 96068fd53d...

Current branch diff-target is up to date.
Changes applied before test
commit 95709cffddc3586066a2760254e85b86d5d8997b
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Apr 25 13:23:00 2022 +0200

    Upgrade mypy to 0.942 to fix support of types-psycopg2 >= 2.9.12
    
    types-psycopg2 2.9.12 contains this commit:
    https://github.com/python/typeshed/commit/506be4fb0adcf38af77325258af337772abcde77
    
    which removes `Any` as the return type of the last variant, allowing
    mypy to type-check the returned value.
    However, mypy 0.920 only considers the last variant, even though we use
    the first one; causing the return type to be badly inferred, and
    erroring every time we use it as context manager.

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/403/ for more details.

ardumont added a subscriber: ardumont.

Thanks and thanks for the targetted commit, that's clearer with it ;)

This revision is now accepted and ready to land.Apr 25 2022, 1:28 PM