Skip to content

Commit

Permalink
Type Command.sub_commands to avoid variance issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Dec 27, 2024
1 parent 22b61d9 commit 3337f9f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions distutils/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import os
import re
import sys
from typing import TypeVar, overload
from collections.abc import Callable
from typing import Any, ClassVar, TypeVar, overload

from . import _modified, archive_util, dir_util, file_util, util
from ._log import log
Expand Down Expand Up @@ -49,7 +50,9 @@ class Command:
# 'sub_commands' is usually defined at the *end* of a class, because
# predicates can be unbound methods, so they must already have been
# defined. The canonical example is the "install" command.
sub_commands = []
sub_commands: ClassVar[ # Any to work around variance issues
list[tuple[str, Callable[[Any], bool] | None]]
] = []

# -- Creation/initialization methods -------------------------------

Expand Down

0 comments on commit 3337f9f

Please sign in to comment.