gh-137706: make typing._is_unpacked_typevartuple check for True instead of truthy (#137712)

This commit is contained in:
David Ellis 2025-09-06 08:39:49 +01:00 committed by GitHub
parent bde1291952
commit 7e652f402f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 1 deletions

View file

@ -1027,8 +1027,10 @@ def evaluate_forward_ref(
def _is_unpacked_typevartuple(x: Any) -> bool:
# Need to check 'is True' here
# See: https://github.com/python/cpython/issues/137706
return ((not isinstance(x, type)) and
getattr(x, '__typing_is_unpacked_typevartuple__', False))
getattr(x, '__typing_is_unpacked_typevartuple__', False) is True)
def _is_typevar_like(x: Any) -> bool: