Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-typing_extensions for 
openSUSE:Factory checked in at 2024-04-07 22:04:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-typing_extensions (Old)
 and      /work/SRC/openSUSE:Factory/.python-typing_extensions.new.1905 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-typing_extensions"

Sun Apr  7 22:04:41 2024 rev:25 rq:1165856 version:4.11.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-typing_extensions/python-typing_extensions.changes
        2024-02-29 21:49:08.263315317 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-typing_extensions.new.1905/python-typing_extensions.changes
      2024-04-07 22:04:49.384003137 +0200
@@ -1,0 +2,11 @@
+Sat Apr  6 17:27:56 UTC 2024 - Dirk Müller <[email protected]>
+
+- update to 4.11.0:
+  * Fix tests on Python 3.13.0a5. Patch by Jelle Zijlstra.
+  * Fix the runtime behavior of type parameters with defaults
+  * Fix minor discrepancy between error messages produced by
+    `typing` and `typing_extensions` on Python 3.10.
+  * When `include_extra=False`, `get_type_hints()` now strips
+    `ReadOnly` from the annotation.
+
+-------------------------------------------------------------------

Old:
----
  typing_extensions-4.10.0.tar.gz

New:
----
  typing_extensions-4.11.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-typing_extensions.spec ++++++
--- /var/tmp/diff_new_pack.X25rfR/_old  2024-04-07 22:04:49.816018958 +0200
+++ /var/tmp/diff_new_pack.X25rfR/_new  2024-04-07 22:04:49.816018958 +0200
@@ -27,7 +27,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-typing_extensions%{psuffix}
-Version:        4.10.0
+Version:        4.11.0
 Release:        0
 Summary:        Backported and Experimental Type Hints for Python 3.8+
 License:        Python-2.0

++++++ typing_extensions-4.10.0.tar.gz -> typing_extensions-4.11.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/typing_extensions-4.10.0/CHANGELOG.md 
new/typing_extensions-4.11.0/CHANGELOG.md
--- old/typing_extensions-4.10.0/CHANGELOG.md   2024-02-25 23:09:11.469692500 
+0100
+++ new/typing_extensions-4.11.0/CHANGELOG.md   2024-04-05 14:33:40.925330400 
+0200
@@ -1,3 +1,19 @@
+# Release 4.11.0 (April 5, 2024)
+
+This feature release provides improvements to various recently
+added features, most importantly type parameter defaults (PEP 696).
+
+There are no changes since 4.11.0rc1.
+
+# Release 4.11.0rc1 (March 24, 2024)
+
+- Fix tests on Python 3.13.0a5. Patch by Jelle Zijlstra.
+- Fix the runtime behavior of type parameters with defaults (PEP 696).
+  Patch by Nadir Chowdhury.
+- Fix minor discrepancy between error messages produced by `typing`
+  and `typing_extensions` on Python 3.10. Patch by Jelle Zijlstra.
+- When `include_extra=False`, `get_type_hints()` now strips `ReadOnly` from 
the annotation.
+
 # Release 4.10.0 (February 24, 2024)
 
 This feature release adds support for PEP 728 (TypedDict with extra
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/typing_extensions-4.10.0/PKG-INFO 
new/typing_extensions-4.11.0/PKG-INFO
--- old/typing_extensions-4.10.0/PKG-INFO       1970-01-01 01:00:00.000000000 
+0100
+++ new/typing_extensions-4.11.0/PKG-INFO       1970-01-01 01:00:00.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: typing_extensions
-Version: 4.10.0
+Version: 4.11.0
 Summary: Backported and Experimental Type Hints for Python 3.8+
 Keywords: 
annotations,backport,checker,checking,function,hinting,hints,type,typechecking,typehinting,typehints,typing
 Author-email: "Guido van Rossum, Jukka Lehtosalo, Łukasz Langa, Michael Lee" 
<[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/typing_extensions-4.10.0/pyproject.toml 
new/typing_extensions-4.11.0/pyproject.toml
--- old/typing_extensions-4.10.0/pyproject.toml 2024-02-25 23:09:11.470240000 
+0100
+++ new/typing_extensions-4.11.0/pyproject.toml 2024-04-05 14:33:40.925806500 
+0200
@@ -6,7 +6,7 @@
 # Project metadata
 [project]
 name = "typing_extensions"
-version = "4.10.0"
+version = "4.11.0"
 description = "Backported and Experimental Type Hints for Python 3.8+"
 readme = "README.md"
 requires-python = ">=3.8"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/typing_extensions-4.10.0/src/test_typing_extensions.py 
new/typing_extensions-4.11.0/src/test_typing_extensions.py
--- old/typing_extensions-4.10.0/src/test_typing_extensions.py  2024-02-18 
03:54:05.259137000 +0100
+++ new/typing_extensions-4.11.0/src/test_typing_extensions.py  2024-03-24 
14:43:49.456458300 +0100
@@ -3262,7 +3262,7 @@
         self.assertEqual(MemoizedFunc.__parameters__, (Ts, T, T2))
         self.assertTrue(MemoizedFunc._is_protocol)
 
-        things = "arguments" if sys.version_info >= (3, 11) else "parameters"
+        things = "arguments" if sys.version_info >= (3, 10) else "parameters"
 
         # A bug was fixed in 3.11.1
         # 
(https://github.com/python/cpython/commit/74920aa27d0c57443dd7f704d6272cca9c507ab3)
@@ -4199,6 +4199,20 @@
         self.assertEqual(AllTheThings.__readonly_keys__, frozenset({'a', 'b', 
'c'}))
         self.assertEqual(AllTheThings.__mutable_keys__, frozenset({'d'}))
 
+        self.assertEqual(
+            get_type_hints(AllTheThings, include_extras=False),
+            {'a': int, 'b': int, 'c': int, 'd': int},
+        )
+        self.assertEqual(
+            get_type_hints(AllTheThings, include_extras=True),
+            {
+                'a': Annotated[Required[ReadOnly[int]], 'why not'],
+                'b': Required[Annotated[ReadOnly[int], 'why not']],
+                'c': ReadOnly[NotRequired[Annotated[int, 'why not']]],
+                'd': NotRequired[Annotated[int, 'why not']],
+            },
+        )
+
     def test_extra_keys_non_readonly(self):
         class Base(TypedDict, closed=True):
             __extra_items__: str
@@ -5517,7 +5531,7 @@
             }
         if sys.version_info < (3, 13):
             exclude |= {'NamedTuple', 'Protocol', 'runtime_checkable'}
-        if not hasattr(typing, 'ReadOnly'):
+        if not typing_extensions._PEP_728_IMPLEMENTED:
             exclude |= {'TypedDict', 'is_typeddict'}
         for item in typing_extensions.__all__:
             if item not in exclude and hasattr(typing, item):
@@ -5697,8 +5711,7 @@
                 self.assertIsInstance(a, G)
                 self.assertEqual(a.x, 3)
 
-                things = "arguments" if sys.version_info >= (3, 11) else 
"parameters"
-
+                things = "arguments" if sys.version_info >= (3, 10) else 
"parameters"
                 with self.assertRaisesRegex(TypeError, f'Too many {things}'):
                     G[int, str]
 
@@ -6201,6 +6214,27 @@
         class A(Generic[Unpack[Ts]]): ...
         Alias = Optional[Unpack[Ts]]
 
+    def test_erroneous_generic(self):
+        DefaultStrT = typing_extensions.TypeVar('DefaultStrT', default=str)
+        T = TypeVar('T')
+
+        with self.assertRaises(TypeError):
+            Test = Generic[DefaultStrT, T]
+
+    def test_need_more_params(self):
+        DefaultStrT = typing_extensions.TypeVar('DefaultStrT', default=str)
+        T = typing_extensions.TypeVar('T')
+        U = typing_extensions.TypeVar('U')
+
+        class A(Generic[T, U, DefaultStrT]): ...
+        A[int, bool]
+        A[int, bool, str]
+
+        with self.assertRaises(
+            TypeError, msg="Too few arguments for .+; actual 1, expected at 
least 2"
+        ):
+            Test = A[int]
+
     def test_pickle(self):
         global U, U_co, U_contra, U_default  # pickle wants to reference the 
class by name
         U = typing_extensions.TypeVar('U')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/typing_extensions-4.10.0/src/typing_extensions.py 
new/typing_extensions-4.11.0/src/typing_extensions.py
--- old/typing_extensions-4.10.0/src/typing_extensions.py       2024-02-18 
03:54:05.260392400 +0100
+++ new/typing_extensions-4.11.0/src/typing_extensions.py       2024-03-24 
14:43:49.459707500 +0100
@@ -147,27 +147,6 @@
 _marker = _Sentinel()
 
 
-def _check_generic(cls, parameters, elen=_marker):
-    """Check correct count for parameters of a generic cls (internal helper).
-    This gives a nice error message in case of count mismatch.
-    """
-    if not elen:
-        raise TypeError(f"{cls} is not a generic class")
-    if elen is _marker:
-        if not hasattr(cls, "__parameters__") or not cls.__parameters__:
-            raise TypeError(f"{cls} is not a generic class")
-        elen = len(cls.__parameters__)
-    alen = len(parameters)
-    if alen != elen:
-        if hasattr(cls, "__parameters__"):
-            parameters = [p for p in cls.__parameters__ if not _is_unpack(p)]
-            num_tv_tuples = sum(isinstance(p, TypeVarTuple) for p in 
parameters)
-            if (num_tv_tuples > 0) and (alen >= elen - num_tv_tuples):
-                return
-        raise TypeError(f"Too {'many' if alen > elen else 'few'} parameters 
for {cls};"
-                        f" actual {alen}, expected {elen}")
-
-
 if sys.version_info >= (3, 10):
     def _should_collect_from_parameters(t):
         return isinstance(
@@ -181,27 +160,6 @@
         return isinstance(t, typing._GenericAlias) and not t._special
 
 
-def _collect_type_vars(types, typevar_types=None):
-    """Collect all type variable contained in types in order of
-    first appearance (lexicographic order). For example::
-
-        _collect_type_vars((T, List[S, T])) == (T, S)
-    """
-    if typevar_types is None:
-        typevar_types = typing.TypeVar
-    tvars = []
-    for t in types:
-        if (
-            isinstance(t, typevar_types) and
-            t not in tvars and
-            not _is_unpack(t)
-        ):
-            tvars.append(t)
-        if _should_collect_from_parameters(t):
-            tvars.extend([t for t in t.__parameters__ if t not in tvars])
-    return tuple(tvars)
-
-
 NoReturn = typing.NoReturn
 
 # Some unconstrained type variables.  These are used by the container types.
@@ -834,7 +792,11 @@
     return inner
 
 
-if hasattr(typing, "ReadOnly"):
+# Update this to something like >=3.13.0b1 if and when
+# PEP 728 is implemented in CPython
+_PEP_728_IMPLEMENTED = False
+
+if _PEP_728_IMPLEMENTED:
     # The standard library TypedDict in Python 3.8 does not store runtime 
information
     # about which (if any) keys are optional.  See 
https://bugs.python.org/issue38834
     # The standard library TypedDict in Python 3.9.0/1 does not honour the 
"total"
@@ -845,7 +807,8 @@
     # Aaaand on 3.12 we add __orig_bases__ to TypedDict
     # to enable better runtime introspection.
     # On 3.13 we deprecate some odd ways of creating TypedDicts.
-    # PEP 705 proposes adding the ReadOnly[] qualifier.
+    # Also on 3.13, PEP 705 adds the ReadOnly[] qualifier.
+    # PEP 728 (still pending) makes more changes.
     TypedDict = typing.TypedDict
     _TypedDictMeta = typing._TypedDictMeta
     is_typeddict = typing.is_typeddict
@@ -1122,15 +1085,15 @@
         return val
 
 
-if hasattr(typing, "Required"):  # 3.11+
+if hasattr(typing, "ReadOnly"):  # 3.13+
     get_type_hints = typing.get_type_hints
-else:  # <=3.10
+else:  # <=3.13
     # replaces _strip_annotations()
     def _strip_extras(t):
         """Strips Annotated, Required and NotRequired from a given type."""
         if isinstance(t, _AnnotatedAlias):
             return _strip_extras(t.__origin__)
-        if hasattr(t, "__origin__") and t.__origin__ in (Required, 
NotRequired):
+        if hasattr(t, "__origin__") and t.__origin__ in (Required, 
NotRequired, ReadOnly):
             return _strip_extras(t.__args__[0])
         if isinstance(t, typing._GenericAlias):
             stripped_args = tuple(_strip_extras(a) for a in t.__args__)
@@ -2689,9 +2652,151 @@
 #   counting generic parameters, so that when we subscript a generic,
 #   the runtime doesn't try to substitute the Unpack with the subscripted type.
 if not hasattr(typing, "TypeVarTuple"):
+    def _check_generic(cls, parameters, elen=_marker):
+        """Check correct count for parameters of a generic cls (internal 
helper).
+
+        This gives a nice error message in case of count mismatch.
+        """
+        if not elen:
+            raise TypeError(f"{cls} is not a generic class")
+        if elen is _marker:
+            if not hasattr(cls, "__parameters__") or not cls.__parameters__:
+                raise TypeError(f"{cls} is not a generic class")
+            elen = len(cls.__parameters__)
+        alen = len(parameters)
+        if alen != elen:
+            expect_val = elen
+            if hasattr(cls, "__parameters__"):
+                parameters = [p for p in cls.__parameters__ if not 
_is_unpack(p)]
+                num_tv_tuples = sum(isinstance(p, TypeVarTuple) for p in 
parameters)
+                if (num_tv_tuples > 0) and (alen >= elen - num_tv_tuples):
+                    return
+
+                # deal with TypeVarLike defaults
+                # required TypeVarLikes cannot appear after a defaulted one.
+                if alen < elen:
+                    # since we validate TypeVarLike default in 
_collect_type_vars
+                    # or _collect_parameters we can safely check 
parameters[alen]
+                    if getattr(parameters[alen], '__default__', None) is not 
None:
+                        return
+
+                    num_default_tv = sum(getattr(p, '__default__', None)
+                                         is not None for p in parameters)
+
+                    elen -= num_default_tv
+
+                    expect_val = f"at least {elen}"
+
+            things = "arguments" if sys.version_info >= (3, 10) else 
"parameters"
+            raise TypeError(f"Too {'many' if alen > elen else 'few'} {things}"
+                            f" for {cls}; actual {alen}, expected 
{expect_val}")
+else:
+    # Python 3.11+
+
+    def _check_generic(cls, parameters, elen):
+        """Check correct count for parameters of a generic cls (internal 
helper).
+
+        This gives a nice error message in case of count mismatch.
+        """
+        if not elen:
+            raise TypeError(f"{cls} is not a generic class")
+        alen = len(parameters)
+        if alen != elen:
+            expect_val = elen
+            if hasattr(cls, "__parameters__"):
+                parameters = [p for p in cls.__parameters__ if not 
_is_unpack(p)]
+
+                # deal with TypeVarLike defaults
+                # required TypeVarLikes cannot appear after a defaulted one.
+                if alen < elen:
+                    # since we validate TypeVarLike default in 
_collect_type_vars
+                    # or _collect_parameters we can safely check 
parameters[alen]
+                    if getattr(parameters[alen], '__default__', None) is not 
None:
+                        return
+
+                    num_default_tv = sum(getattr(p, '__default__', None)
+                                         is not None for p in parameters)
+
+                    elen -= num_default_tv
+
+                    expect_val = f"at least {elen}"
+
+            raise TypeError(f"Too {'many' if alen > elen else 'few'} arguments"
+                            f" for {cls}; actual {alen}, expected 
{expect_val}")
+
+typing._check_generic = _check_generic
+
+# Python 3.11+ _collect_type_vars was renamed to _collect_parameters
+if hasattr(typing, '_collect_type_vars'):
+    def _collect_type_vars(types, typevar_types=None):
+        """Collect all type variable contained in types in order of
+        first appearance (lexicographic order). For example::
+
+            _collect_type_vars((T, List[S, T])) == (T, S)
+        """
+        if typevar_types is None:
+            typevar_types = typing.TypeVar
+        tvars = []
+        # required TypeVarLike cannot appear after TypeVarLike with default
+        default_encountered = False
+        for t in types:
+            if (
+                isinstance(t, typevar_types) and
+                t not in tvars and
+                not _is_unpack(t)
+            ):
+                if getattr(t, '__default__', None) is not None:
+                    default_encountered = True
+                elif default_encountered:
+                    raise TypeError(f'Type parameter {t!r} without a default'
+                                    ' follows type parameter with a default')
+
+                tvars.append(t)
+            if _should_collect_from_parameters(t):
+                tvars.extend([t for t in t.__parameters__ if t not in tvars])
+        return tuple(tvars)
+
     typing._collect_type_vars = _collect_type_vars
-    typing._check_generic = _check_generic
+else:
+    def _collect_parameters(args):
+        """Collect all type variables and parameter specifications in args
+        in order of first appearance (lexicographic order).
+
+        For example::
+
+            assert _collect_parameters((T, Callable[P, T])) == (T, P)
+        """
+        parameters = []
+        # required TypeVarLike cannot appear after TypeVarLike with default
+        default_encountered = False
+        for t in args:
+            if isinstance(t, type):
+                # We don't want __parameters__ descriptor of a bare Python 
class.
+                pass
+            elif isinstance(t, tuple):
+                # `t` might be a tuple, when `ParamSpec` is substituted with
+                # `[T, int]`, or `[int, *Ts]`, etc.
+                for x in t:
+                    for collected in _collect_parameters([x]):
+                        if collected not in parameters:
+                            parameters.append(collected)
+            elif hasattr(t, '__typing_subst__'):
+                if t not in parameters:
+                    if getattr(t, '__default__', None) is not None:
+                        default_encountered = True
+                    elif default_encountered:
+                        raise TypeError(f'Type parameter {t!r} without a 
default'
+                                        ' follows type parameter with a 
default')
+
+                    parameters.append(t)
+            else:
+                for x in getattr(t, '__parameters__', ()):
+                    if x not in parameters:
+                        parameters.append(x)
+
+        return tuple(parameters)
 
+    typing._collect_parameters = _collect_parameters
 
 # Backport typing.NamedTuple as it exists in Python 3.13.
 # In 3.11, the ability to define generic `NamedTuple`s was supported.

Reply via email to