From 2b19c761ec866f44ee84a2103e91ece47ea9815f Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Mar 2021 17:11:37 +0100 Subject: [PATCH] Fix build (#5086) Run the mypy test suite using Ubuntu 18.04. Ubuntu 20.04 doesn't have a package for virtualenv on Python 2. Also, curses.color_pair() now has a named argument. --- .github/workflows/tests.yml | 3 ++- stdlib/_curses.pyi | 9 ++++++++- tests/stubtest_whitelists/py38.txt | 4 ++++ tests/stubtest_whitelists/py39.txt | 4 ++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ff94b54ab..0d82ba341 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -79,7 +79,8 @@ jobs: mypy-test-suite: name: Run the mypy test suite - runs-on: ubuntu-latest + # Ubuntu 20.04 doesn't have the Python 2 venv module. + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 diff --git a/stdlib/_curses.pyi b/stdlib/_curses.pyi index 5e447a249..abc7a3432 100644 --- a/stdlib/_curses.pyi +++ b/stdlib/_curses.pyi @@ -223,7 +223,14 @@ def beep() -> None: ... def can_change_color() -> bool: ... def cbreak(__flag: bool = ...) -> None: ... def color_content(__color_number: int) -> Tuple[int, int, int]: ... -def color_pair(__color_number: int) -> int: ... + +# Changed in Python 3.8.8 and 3.9.2 +if sys.version_info >= (3, 8): + def color_pair(pair_number: int) -> int: ... + +else: + def color_pair(__color_number: int) -> int: ... + def curs_set(__visibility: int) -> int: ... def def_prog_mode() -> None: ... def def_shell_mode() -> None: ... diff --git a/tests/stubtest_whitelists/py38.txt b/tests/stubtest_whitelists/py38.txt index 8f3423dc8..d47b44350 100644 --- a/tests/stubtest_whitelists/py38.txt +++ b/tests/stubtest_whitelists/py38.txt @@ -5,6 +5,8 @@ _collections_abc.AsyncGenerator.ag_running _collections_abc.ItemsView.__reversed__ _collections_abc.KeysView.__reversed__ _collections_abc.ValuesView.__reversed__ +# This was changed in Python 3.8.8. +_curses.color_pair _thread.ExceptHookArgs _thread._ExceptHookArgs ast.Bytes.__new__ @@ -42,6 +44,8 @@ concurrent.futures.ProcessPoolExecutor.map contextvars.Context.__init__ contextvars.Context.get copy.PyStringMap +# This was changed in Python 3.8.8. +curses.color_pair dataclasses.field email.message.MIMEPart.as_string enum.Enum._generate_next_value_ diff --git a/tests/stubtest_whitelists/py39.txt b/tests/stubtest_whitelists/py39.txt index 9e57bb608..3de34fa1e 100644 --- a/tests/stubtest_whitelists/py39.txt +++ b/tests/stubtest_whitelists/py39.txt @@ -13,6 +13,8 @@ _collections_abc.Generator.throw _collections_abc.ItemsView.__reversed__ _collections_abc.KeysView.__reversed__ _collections_abc.ValuesView.__reversed__ +# This was changed in Python 3.9.2. +_curses.color_pair _dummy_thread ast.Bytes.__new__ ast.Ellipsis.__new__ @@ -48,6 +50,8 @@ collections.abc.ValuesView.__reversed__ contextvars.Context.__init__ contextvars.Context.get copy.PyStringMap +# This was changed in Python 3.9.2. +curses.color_pair dataclasses.field dataclasses.InitVar.__class_getitem__ # stubtest bug. doesn't do the right thing with overload + implicit classmethod __class_getitem__ dummy_threading