public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Karolina Surma <ksurma@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/python-typing-extensions] rawhide: Fix compatibility with Python 3.15
Date: Wed, 03 Jun 2026 09:43:03 GMT	[thread overview]
Message-ID: <178047978366.1.17814939612643593688.rpms-python-typing-extensions-f1c28d545edf@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/python-typing-extensions
Branch : rawhide
Commit : f1c28d545edfca2500ab6b7c8719025edad42c56
Author : Karolina Surma <ksurma@redhat.com>
Date   : 2026-05-14T12:25:14+02:00
Stats  : +368/-0 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/python-typing-extensions/c/f1c28d545edfca2500ab6b7c8719025edad42c56?branch=rawhide

Log:
Fix compatibility with Python 3.15

---
diff --git a/2f064147ff8.patch b/2f064147ff8.patch
new file mode 100644
index 0000000..8aa9971
--- /dev/null
+++ b/2f064147ff8.patch
@@ -0,0 +1,85 @@
+From 0fc4bf1e985bf7a2f769b4105dcf20f8d3ce1315 Mon Sep 17 00:00:00 2001
+From: Eric Mark Martin <eric@emm.dev>
+Date: Sun, 3 May 2026 18:18:16 -0400
+Subject: [PATCH] Make TypeAliasType __module__ writable (#744)
+
+---
+ src/test_typing_extensions.py | 13 +++++++------
+ src/typing_extensions.py      | 12 ++++++------
+ 2 files changed, 13 insertions(+), 12 deletions(-)
+
+diff --git a/src/test_typing_extensions.py b/src/test_typing_extensions.py
+index eb28630..a6d5227 100644
+--- a/src/test_typing_extensions.py
++++ b/src/test_typing_extensions.py
+@@ -6876,7 +6876,7 @@ class AllTests(BaseTestCase):
+                 'AsyncGenerator', 'ContextManager', 'AsyncContextManager',
+                 'ParamSpec', 'TypeVar', 'TypeVarTuple', 'get_type_hints',
+             }
+-        if sys.version_info < (3, 14):
++        if sys.version_info < (3, 15):
+             exclude |= {
+                 'TypeAliasType'
+             }
+@@ -8029,11 +8029,12 @@ class TypeAliasTypeTests(BaseTestCase):
+             "attribute '__parameters__' of 'typing.TypeAliasType' objects is not writable",
+         ):
+             Simple.__parameters__ = (T,)
+-        with self.assertRaisesRegex(
+-            AttributeError,
+-            "attribute '__module__' of 'typing.TypeAliasType' objects is not writable",
+-        ):
+-            Simple.__module__ = 42
++
++        # __module__ is the exception---it's assignable
++        module_sentinel = object()
++        Simple.__module__ = module_sentinel
++        self.assertIs(Simple.__module__, module_sentinel)
++
+         with self.assertRaisesRegex(
+             AttributeError,
+             "'typing.TypeAliasType' object has no attribute 'some_attribute'",
+diff --git a/src/typing_extensions.py b/src/typing_extensions.py
+index 1042aee..83beedc 100644
+--- a/src/typing_extensions.py
++++ b/src/typing_extensions.py
+@@ -3578,14 +3578,14 @@ else:
+                 return typing.Union[other, self]
+ 
+ 
+-# Breakpoint: https://github.com/python/cpython/pull/124795
+-if sys.version_info >= (3, 14):
++# Breakpoint: https://github.com/python/cpython/pull/149172
++if sys.version_info >= (3, 15):
+     TypeAliasType = typing.TypeAliasType
+-# <=3.13
++# <=3.14
+ else:
+     # Breakpoint: https://github.com/python/cpython/pull/103764
+     if sys.version_info >= (3, 12):
+-        # 3.12-3.13
++        # 3.12-3.14
+         def _is_unionable(obj):
+             """Corresponds to is_unionable() in unionobject.c in CPython."""
+             return obj is None or isinstance(obj, (
+@@ -3698,7 +3698,7 @@ else:
+             self.__name__ = name
+ 
+         def __setattr__(self, name: str, value: object, /) -> None:
+-            if hasattr(self, "__name__"):
++            if hasattr(self, "__name__") and name != "__module__":
+                 self._raise_attribute_error(name)
+             super().__setattr__(name, value)
+ 
+@@ -3709,7 +3709,7 @@ else:
+             # Match the Python 3.12 error messages exactly
+             if name == "__name__":
+                 raise AttributeError("readonly attribute")
+-            elif name in {"__value__", "__type_params__", "__parameters__", "__module__"}:
++            elif name in {"__value__", "__type_params__", "__parameters__"}:
+                 raise AttributeError(
+                     f"attribute '{name}' of 'typing.TypeAliasType' objects "
+                     "is not writable"
+-- 
+2.54.0
+

diff --git a/741.patch b/741.patch
new file mode 100644
index 0000000..817c434
--- /dev/null
+++ b/741.patch
@@ -0,0 +1,279 @@
+From 7c1913f0344d5e551a8ecec173ca21f74a3b486c Mon Sep 17 00:00:00 2001
+From: KotlinIsland <65446343+kotlinisland@users.noreply.github.com>
+Date: Thu, 23 Apr 2026 14:04:06 +1000
+Subject: [PATCH 1/3] add bound/variance parameters to `TypeVarTuple`
+
+---
+ src/typing_extensions.py | 42 +++++++++++++++++++++++++++++++++-------
+ 1 file changed, 35 insertions(+), 7 deletions(-)
+
+diff --git a/src/typing_extensions.py b/src/typing_extensions.py
+index 83beedc..0c05e8a 100644
+--- a/src/typing_extensions.py
++++ b/src/typing_extensions.py
+@@ -2536,20 +2536,32 @@ def _unpack_args(*args):
+     return newargs
+ 
+ 
+-if _PEP_696_IMPLEMENTED:
++if sys.version_info >= (3, 15):
+     from typing import TypeVarTuple
+ 
+ elif hasattr(typing, "TypeVarTuple"):  # 3.11+
+ 
+-    # Add default parameter - PEP 696
++    # Add default parameter - PEP 696 and bound/variance parameters
+     class TypeVarTuple(metaclass=_TypeVarLikeMeta):
+         """Type variable tuple."""
+ 
+         _backported_typevarlike = typing.TypeVarTuple
+ 
+-        def __new__(cls, name, *, default=NoDefault):
+-            tvt = typing.TypeVarTuple(name)
+-            _set_default(tvt, default)
++        def __new__(cls, name, *, bound=None,
++                    covariant=False, contravariant=False,
++                    infer_variance=False, default=NoDefault):
++
++            if _PEP_696_IMPLEMENTED:
++                # can pass default argument
++                tvt = typing.TypeVarTuple(name, default=default)
++            else:
++                tvt = typing.TypeVarTuple(name)
++                _set_default(tvt, default)
++
++            tvt.__covariant__ = covariant
++            tvt.__contravariant__ = contravariant
++            tvt.__infer_variance__ = infer_variance
++
+             _set_module(tvt)
+ 
+             def _typevartuple_prepare_subst(alias, args):
+@@ -2654,8 +2666,16 @@ else:  # <=3.10
+         def __iter__(self):
+             yield self.__unpacked__
+ 
+-        def __init__(self, name, *, default=NoDefault):
++        def __init__(self, name, *, bound=None, covariant=False, contravariant=False,
++                     infer_variance=False, default=NoDefault):
+             self.__name__ = name
++            self.__covariant__ = bool(covariant)
++            self.__contravariant__ = bool(contravariant)
++            self.__infer_variance__ = bool(infer_variance)
++            if bound:
++                self.__bound__ = typing._type_check(bound, 'Bound must be a type.')
++            else:
++                self.__bound__ = None
+             _DefaultMixin.__init__(self, default)
+ 
+             # for pickling:
+@@ -2666,7 +2686,15 @@ else:  # <=3.10
+             self.__unpacked__ = Unpack[self]
+ 
+         def __repr__(self):
+-            return self.__name__
++            if self.__infer_variance__:
++                prefix = ''
++            elif self.__covariant__:
++                prefix = '+'
++            elif self.__contravariant__:
++                prefix = '-'
++            else:
++                prefix = '~'
++            return prefix + self.__name__
+ 
+         def __hash__(self):
+             return object.__hash__(self)
+-- 
+2.54.0
+
+
+From b34943fef2d962345aeb3918090a1d2348c25b8f Mon Sep 17 00:00:00 2001
+From: KotlinIsland <65446343+kotlinisland@users.noreply.github.com>
+Date: Thu, 23 Apr 2026 14:46:09 +1000
+Subject: [PATCH 2/3] fixup! add bound/variance parameters to `TypeVarTuple`
+
+---
+ src/test_typing_extensions.py | 43 +++++++++++++++++++++++++++++++++--
+ src/typing_extensions.py      |  1 +
+ 2 files changed, 42 insertions(+), 2 deletions(-)
+
+diff --git a/src/test_typing_extensions.py b/src/test_typing_extensions.py
+index a6d5227..fd04aeb 100644
+--- a/src/test_typing_extensions.py
++++ b/src/test_typing_extensions.py
+@@ -6396,7 +6396,10 @@ class UnpackTests(BaseTestCase):
+ 
+     def test_repr(self):
+         Ts = TypeVarTuple('Ts')
+-        self.assertEqual(repr(Unpack[Ts]), f'{Unpack.__module__}.Unpack[Ts]')
++        if not hasattr(typing, 'TypeVarTuple') or sys.version_info >= (3, 15):
++            self.assertEqual(repr(Unpack[Ts]), f'{Unpack.__module__}.Unpack[~Ts]')
++        else:
++            self.assertEqual(repr(Unpack[Ts]), f'{Unpack.__module__}.Unpack[Ts]')
+ 
+     def test_cannot_subclass_vars(self):
+         with self.assertRaises(TypeError):
+@@ -6554,7 +6557,43 @@ class TypeVarTupleTests(BaseTestCase):
+ 
+     def test_repr(self):
+         Ts = TypeVarTuple('Ts')
+-        self.assertEqual(repr(Ts), 'Ts')
++        Ts_co = TypeVarTuple('Ts_co', covariant=True)
++        Ts_contra = TypeVarTuple('Ts_contra', contravariant=True)
++        Ts_infer = TypeVarTuple('Ts_infer', infer_variance=True)
++        Ts_2 = TypeVarTuple('Ts_2')
++        if not hasattr(typing, 'TypeVarTuple') or sys.version_info >= (3, 15):
++            self.assertEqual(repr(Ts), '~Ts')
++            self.assertEqual(repr(Ts_2), '~Ts_2')
++
++            self.assertEqual(repr(Ts_co), '+Ts_co')
++            self.assertEqual(repr(Ts_contra), '-Ts_contra')
++            self.assertEqual(repr(Ts_infer), 'Ts_infer')
++        else:
++            # Not worth creating our own version of TypeVarTuple
++            # to backport the repr
++            self.assertEqual(repr(Ts), 'Ts')
++            self.assertEqual(repr(Ts_2), 'Ts_2')
++
++            self.assertEqual(repr(Ts_co), 'Ts_co')
++            self.assertEqual(repr(Ts_contra), 'Ts_contra')
++            self.assertEqual(repr(Ts_infer), 'Ts_infer')
++
++    def test_variance(self):
++        Ts_co = TypeVarTuple('Ts_co', covariant=True)
++        Ts_contra = TypeVarTuple('Ts_contra', contravariant=True)
++        Ts_infer = TypeVarTuple('Ts_infer', infer_variance=True)
++
++        self.assertIs(Ts_co.__covariant__, True)
++        self.assertIs(Ts_co.__contravariant__, False)
++        self.assertIs(Ts_co.__infer_variance__, False)
++
++        self.assertIs(Ts_contra.__covariant__, False)
++        self.assertIs(Ts_contra.__contravariant__, True)
++        self.assertIs(Ts_contra.__infer_variance__, False)
++
++        self.assertIs(Ts_infer.__covariant__, False)
++        self.assertIs(Ts_infer.__contravariant__, False)
++        self.assertIs(Ts_infer.__infer_variance__, True)
+ 
+     def test_no_redefinition(self):
+         self.assertNotEqual(TypeVarTuple('Ts'), TypeVarTuple('Ts'))
+diff --git a/src/typing_extensions.py b/src/typing_extensions.py
+index 0c05e8a..12a2af5 100644
+--- a/src/typing_extensions.py
++++ b/src/typing_extensions.py
+@@ -2558,6 +2558,7 @@ elif hasattr(typing, "TypeVarTuple"):  # 3.11+
+                 tvt = typing.TypeVarTuple(name)
+                 _set_default(tvt, default)
+ 
++            tvt.__bound__ = bound
+             tvt.__covariant__ = covariant
+             tvt.__contravariant__ = contravariant
+             tvt.__infer_variance__ = infer_variance
+-- 
+2.54.0
+
+
+From 676bdee3c1de413448adb9954b99363ffa76e3db Mon Sep 17 00:00:00 2001
+From: KotlinIsland <65446343+kotlinisland@users.noreply.github.com>
+Date: Fri, 24 Apr 2026 12:21:47 +1000
+Subject: [PATCH 3/3] fixup! add bound/variance parameters to `TypeVarTuple`
+
+---
+ src/test_typing_extensions.py | 15 ++++++++++-----
+ src/typing_extensions.py      | 15 +++++++++------
+ 2 files changed, 19 insertions(+), 11 deletions(-)
+
+diff --git a/src/test_typing_extensions.py b/src/test_typing_extensions.py
+index fd04aeb..9f3c9c9 100644
+--- a/src/test_typing_extensions.py
++++ b/src/test_typing_extensions.py
+@@ -1729,11 +1729,9 @@ class GetTypeHintTests(BaseTestCase):
+             annotation              : annotation,
+             Optional[int]           : Optional[int],
+             Optional[List[str]]     : Optional[List[str]],
+-            Optional[annotation]     : Optional[annotation],
++            Optional[annotation]    : Optional[annotation],
+             Union[str, None, str]   : Optional[str],
+             Unpack[Tuple[int, None]]: Unpack[Tuple[int, None]],
+-            # Note: A starred *Ts will use typing.Unpack in 3.11+ see Issue #485
+-            Unpack[Ts]              : Unpack[Ts],
+         }
+         # contains a ForwardRef, TypeVar(~prefix) or no expression
+         do_not_stringify_cases = {
+@@ -1749,6 +1747,8 @@ class GetTypeHintTests(BaseTestCase):
+             Union[str, "Union[None, StrAlias]"]: Optional[str],
+             Union["annotation", T_default]     : Union[annotation, T_default],
+             Annotated["annotation", "nested"]  : Annotated[Union[int, None], "data", "nested"],
++            # Note: A starred *Ts will use typing.Unpack in 3.11+ see Issue #485
++            Unpack[Ts]                         : Unpack[Ts],
+         }
+         if TYPING_3_10_0:  # cannot construct UnionTypes before 3.10
+             do_not_stringify_cases["str | NoneAlias | StrAlias"] = str | None
+@@ -6569,8 +6569,9 @@ class TypeVarTupleTests(BaseTestCase):
+             self.assertEqual(repr(Ts_contra), '-Ts_contra')
+             self.assertEqual(repr(Ts_infer), 'Ts_infer')
+         else:
+-            # Not worth creating our own version of TypeVarTuple
+-            # to backport the repr
++            # On other versions we use typing.TypeVarTuple, but it is not aware of
++            # variance. Not worth creating our own version of TypeVarTuple
++            # for this.
+             self.assertEqual(repr(Ts), 'Ts')
+             self.assertEqual(repr(Ts_2), 'Ts_2')
+ 
+@@ -6919,6 +6920,10 @@ class AllTests(BaseTestCase):
+             exclude |= {
+                 'TypeAliasType'
+             }
++        if sys.version_info < (3, 15):
++            exclude |= {
++                'TypeVarTuple'
++            }
+         if not typing_extensions._PEP_728_IMPLEMENTED:
+             exclude |= {'TypedDict', 'is_typeddict'}
+         for item in typing_extensions.__all__:
+diff --git a/src/typing_extensions.py b/src/typing_extensions.py
+index 12a2af5..5aa6ea4 100644
+--- a/src/typing_extensions.py
++++ b/src/typing_extensions.py
+@@ -1644,7 +1644,10 @@ else:
+ 
+ def _set_default(type_param, default):
+     type_param.has_default = lambda: default is not NoDefault
+-    type_param.__default__ = default
++    if default is NoDefault:
++        type_param.__default__ = default
++    else:
++        type_param.__default__ = typing._type_check(default, "Default must be a type.")
+ 
+ 
+ def _set_module(typevarlike):
+@@ -1797,7 +1800,7 @@ elif hasattr(typing, 'ParamSpec'):
+                 paramspec = typing.ParamSpec(name, bound=bound,
+                                              covariant=covariant,
+                                              contravariant=contravariant)
+-                paramspec.__infer_variance__ = infer_variance
++                paramspec.__infer_variance__ = bool(infer_variance)
+ 
+             _set_default(paramspec, default)
+             _set_module(paramspec)
+@@ -2558,10 +2561,10 @@ elif hasattr(typing, "TypeVarTuple"):  # 3.11+
+                 tvt = typing.TypeVarTuple(name)
+                 _set_default(tvt, default)
+ 
+-            tvt.__bound__ = bound
+-            tvt.__covariant__ = covariant
+-            tvt.__contravariant__ = contravariant
+-            tvt.__infer_variance__ = infer_variance
++            tvt.__bound__ = typing._type_check(bound, "Bound must be a type.")
++            tvt.__covariant__ = bool(covariant)
++            tvt.__contravariant__ = bool(contravariant)
++            tvt.__infer_variance__ = bool(infer_variance)
+ 
+             _set_module(tvt)
+ 
+-- 
+2.54.0
+

diff --git a/python-typing-extensions.spec b/python-typing-extensions.spec
index cc2cb92..d40e695 100644
--- a/python-typing-extensions.spec
+++ b/python-typing-extensions.spec
@@ -18,6 +18,10 @@ Patch:          https://github.com/python/typing_extensions/commit/2638b86aad.pa
 # Remove no_type_check_decorator from _typing_names, followup of the above
 # https://github.com/python/typing_extensions/pull/723
 Patch:          https://github.com/python/typing_extensions/pull/723.patch
+# Make TypeAliasType __module__ writable - Python 3.15 fix
+Patch:          https://github.com/python/typing_extensions/commit/2f064147ff8.patch
+# Type variable tuple variance - Python 3.15 fix (open upstream)
+Patch:          https://github.com/python/typing_extensions/pull/741.patch
 
 BuildArch:      noarch
 

                 reply	other threads:[~2026-06-03  9:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178047978366.1.17814939612643593688.rpms-python-typing-extensions-f1c28d545edf@fedoraproject.org \
    --to=ksurma@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox