[med-svn] [Git][python-team/packages/mypy][master] 6 commits: routine-update: New upstream version

Michael R. Crusoe (@crusoe) gitlab at salsa.debian.org
Sun Feb 26 08:25:22 GMT 2023



Michael R. Crusoe pushed to branch master at Debian Python Team / packages / mypy


Commits:
d1095907 by Michael R. Crusoe at 2023-02-24T09:07:32+01:00
routine-update: New upstream version

- - - - -
4a6df570 by Michael R. Crusoe at 2023-02-24T09:07:33+01:00
New upstream version 1.0.1
- - - - -
39c6ddf7 by Michael R. Crusoe at 2023-02-24T09:07:45+01:00
Update upstream source from tag 'upstream/1.0.1'

Update to upstream version '1.0.1'
with Debian dir bacf59ca88d172a06a80ad658a352e121185f59e
- - - - -
7eaa3ee6 by Michael R. Crusoe at 2023-02-24T09:07:50+01:00
routine-update: Remove trailing whitespace in debian/changelog

- - - - -
4895760f by Michael R. Crusoe at 2023-02-24T12:56:09+01:00
Drop the cherry-picked 32-bits.patch, it is part of the new release.

- - - - -
f7f4cedd by Michael R. Crusoe at 2023-02-24T12:56:47+01:00
routine-update: Ready to upload to unstable

- - - - -


16 changed files:

- PKG-INFO
- debian/changelog
- − debian/patches/32-bits.patch
- debian/patches/series
- mypy.egg-info/PKG-INFO
- mypy/fixup.py
- mypy/nodes.py
- mypy/partially_defined.py
- mypy/traverser.py
- mypy/types.py
- mypy/version.py
- mypyc/test-data/irbuild-i64.test
- test-data/unit/check-incremental.test
- test-data/unit/check-python310.test
- test-data/unit/check-python38.test
- test-data/unit/check-typevar-values.test


Changes:

=====================================
PKG-INFO
=====================================
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: mypy
-Version: 1.0.0
+Version: 1.0.1
 Summary: Optional static typing for Python
 Home-page: http://www.mypy-lang.org/
 Author: Jukka Lehtosalo


=====================================
debian/changelog
=====================================
@@ -1,6 +1,14 @@
+mypy (1.0.1-1) unstable; urgency=medium
+
+  * New upstream version
+  * Remove trailing whitespace in debian/changelog (routine-update)
+  * Drop the cherry-picked 32-bits.patch, it is part of the new release.
+
+ -- Michael R. Crusoe <crusoe at debian.org>  Fri, 24 Feb 2023 12:56:47 +0100
+
 mypy (1.0.0-1) unstable; urgency=medium
 
-  * Add patch to fix test for 32-bit systems, cherry-picked from upstream. 
+  * Add patch to fix test for 32-bit systems, cherry-picked from upstream.
 
  -- Michael R. Crusoe <crusoe at debian.org>  Tue, 14 Feb 2023 00:24:00 +0100
 


=====================================
debian/patches/32-bits.patch deleted
=====================================
@@ -1,64 +0,0 @@
-From 552d28f1b0529018c47afdf733ea2bc8bf8d90eb Mon Sep 17 00:00:00 2001
-From: Jukka Lehtosalo <jukka.lehtosalo at iki.fi>
-Date: Mon, 13 Feb 2023 17:18:41 +0000
-Subject: [mypyc] Fix test case testI64Cast on 32-bit architectures
-Origin: upstream,https://github.com/python/mypy/pull/14691
-
-Add 64-bit and 32-bit variants of the test.
-
-Fixes #14633.
----
- mypyc/test-data/irbuild-i64.test | 35 +++++++++++++++++++++++++++++++-
- 1 file changed, 34 insertions(+), 1 deletion(-)
-
---- mypy.orig/mypyc/test-data/irbuild-i64.test
-+++ mypy/mypyc/test-data/irbuild-i64.test
-@@ -1731,7 +1731,7 @@
- L0:
-     return 4
- 
--[case testI64Cast]
-+[case testI64Cast_64bit]
- from typing import cast
- from mypy_extensions import i64
- 
-@@ -1772,6 +1772,39 @@
- L3:
-     return r3
- 
-+[case testI64Cast_32bit]
-+from typing import cast
-+from mypy_extensions import i64
-+
-+def cast_int(x: int) -> i64:
-+    return cast(i64, x)
-+[out]
-+def cast_int(x):
-+    x :: int
-+    r0 :: native_int
-+    r1 :: bit
-+    r2, r3, r4 :: int64
-+    r5 :: ptr
-+    r6 :: c_ptr
-+    r7 :: int64
-+L0:
-+    r0 = x & 1
-+    r1 = r0 == 0
-+    if r1 goto L1 else goto L2 :: bool
-+L1:
-+    r2 = extend signed x: builtins.int to int64
-+    r3 = r2 >> 1
-+    r4 = r3
-+    goto L3
-+L2:
-+    r5 = x ^ 1
-+    r6 = r5
-+    r7 = CPyLong_AsInt64(r6)
-+    r4 = r7
-+    keep_alive x
-+L3:
-+    return r4
-+
- [case testI64ExplicitConversionFromVariousTypes]
- from mypy_extensions import i64
- 


=====================================
debian/patches/series
=====================================
@@ -1,4 +1,3 @@
-32-bits.patch
 verbose
 intersphinx
 python3.10.3


=====================================
mypy.egg-info/PKG-INFO
=====================================
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: mypy
-Version: 1.0.0
+Version: 1.0.1
 Summary: Optional static typing for Python
 Home-page: http://www.mypy-lang.org/
 Author: Jukka Lehtosalo


=====================================
mypy/fixup.py
=====================================
@@ -80,9 +80,13 @@ class NodeFixer(NodeVisitor[None]):
             if info.tuple_type:
                 info.tuple_type.accept(self.type_fixer)
                 info.update_tuple_type(info.tuple_type)
+                if info.special_alias:
+                    info.special_alias.alias_tvars = list(info.defn.type_vars)
             if info.typeddict_type:
                 info.typeddict_type.accept(self.type_fixer)
                 info.update_typeddict_type(info.typeddict_type)
+                if info.special_alias:
+                    info.special_alias.alias_tvars = list(info.defn.type_vars)
             if info.declared_metaclass:
                 info.declared_metaclass.accept(self.type_fixer)
             if info.metaclass_type:


=====================================
mypy/nodes.py
=====================================
@@ -3473,8 +3473,13 @@ class TypeAlias(SymbolNode):
 
     @classmethod
     def from_tuple_type(cls, info: TypeInfo) -> TypeAlias:
-        """Generate an alias to the tuple type described by a given TypeInfo."""
+        """Generate an alias to the tuple type described by a given TypeInfo.
+
+        NOTE: this doesn't set type alias type variables (for generic tuple types),
+        they must be set by the caller (when fully analyzed).
+        """
         assert info.tuple_type
+        # TODO: is it possible to refactor this to set the correct type vars here?
         return TypeAlias(
             info.tuple_type.copy_modified(fallback=mypy.types.Instance(info, info.defn.type_vars)),
             info.fullname,
@@ -3484,8 +3489,13 @@ class TypeAlias(SymbolNode):
 
     @classmethod
     def from_typeddict_type(cls, info: TypeInfo) -> TypeAlias:
-        """Generate an alias to the TypedDict type described by a given TypeInfo."""
+        """Generate an alias to the TypedDict type described by a given TypeInfo.
+
+        NOTE: this doesn't set type alias type variables (for generic TypedDicts),
+        they must be set by the caller (when fully analyzed).
+        """
         assert info.typeddict_type
+        # TODO: is it possible to refactor this to set the correct type vars here?
         return TypeAlias(
             info.typeddict_type.copy_modified(
                 fallback=mypy.types.Instance(info, info.defn.type_vars)


=====================================
mypy/partially_defined.py
=====================================
@@ -396,8 +396,8 @@ class PossiblyUndefinedVariableVisitor(ExtendedTraverserVisitor):
         self.tracker.end_branch_statement()
 
     def visit_match_stmt(self, o: MatchStmt) -> None:
-        self.tracker.start_branch_statement()
         o.subject.accept(self)
+        self.tracker.start_branch_statement()
         for i in range(len(o.patterns)):
             pattern = o.patterns[i]
             pattern.accept(self)


=====================================
mypy/traverser.py
=====================================
@@ -253,9 +253,9 @@ class TraverserVisitor(NodeVisitor[None]):
             o.expr.accept(self)
 
     def visit_call_expr(self, o: CallExpr) -> None:
+        o.callee.accept(self)
         for a in o.args:
             a.accept(self)
-        o.callee.accept(self)
         if o.analyzed:
             o.analyzed.accept(self)
 


=====================================
mypy/types.py
=====================================
@@ -587,12 +587,16 @@ class TypeVarType(TypeVarLikeType):
         return visitor.visit_type_var(self)
 
     def __hash__(self) -> int:
-        return hash((self.id, self.upper_bound))
+        return hash((self.id, self.upper_bound, tuple(self.values)))
 
     def __eq__(self, other: object) -> bool:
         if not isinstance(other, TypeVarType):
             return NotImplemented
-        return self.id == other.id and self.upper_bound == other.upper_bound
+        return (
+            self.id == other.id
+            and self.upper_bound == other.upper_bound
+            and self.values == other.values
+        )
 
     def serialize(self) -> JsonDict:
         assert not self.id.is_meta_var()


=====================================
mypy/version.py
=====================================
@@ -8,7 +8,7 @@ from mypy import git
 # - Release versions have the form "1.2.3".
 # - Dev versions have the form "1.2.3+dev" (PLUS sign to conform to PEP 440).
 # - Before 1.0 we had the form "0.NNN".
-__version__ = "1.0.0"
+__version__ = "1.0.1"
 base_version = __version__
 
 mypy_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))


=====================================
mypyc/test-data/irbuild-i64.test
=====================================
@@ -1731,7 +1731,7 @@ def f5():
 L0:
     return 4
 
-[case testI64Cast]
+[case testI64Cast_64bit]
 from typing import cast
 from mypy_extensions import i64
 
@@ -1772,6 +1772,39 @@ L2:
 L3:
     return r3
 
+[case testI64Cast_32bit]
+from typing import cast
+from mypy_extensions import i64
+
+def cast_int(x: int) -> i64:
+    return cast(i64, x)
+[out]
+def cast_int(x):
+    x :: int
+    r0 :: native_int
+    r1 :: bit
+    r2, r3, r4 :: int64
+    r5 :: ptr
+    r6 :: c_ptr
+    r7 :: int64
+L0:
+    r0 = x & 1
+    r1 = r0 == 0
+    if r1 goto L1 else goto L2 :: bool
+L1:
+    r2 = extend signed x: builtins.int to int64
+    r3 = r2 >> 1
+    r4 = r3
+    goto L3
+L2:
+    r5 = x ^ 1
+    r6 = r5
+    r7 = CPyLong_AsInt64(r6)
+    r4 = r7
+    keep_alive x
+L3:
+    return r4
+
 [case testI64ExplicitConversionFromVariousTypes]
 from mypy_extensions import i64
 


=====================================
test-data/unit/check-incremental.test
=====================================
@@ -6359,3 +6359,34 @@ from m import Foo
 [file m.py]
 from missing_module import Meta  # type: ignore[import]
 class Foo(metaclass=Meta): ...
+
+[case testGenericTypedDictWithError]
+import b
+[file a.py]
+from typing import Generic, TypeVar
+from typing_extensions import TypedDict
+
+TValue = TypeVar("TValue")
+class Dict(TypedDict, Generic[TValue]):
+    value: TValue
+
+[file b.py]
+from a import Dict, TValue
+
+def f(d: Dict[TValue]) -> TValue:
+    return d["value"]
+def g(d: Dict[TValue]) -> TValue:
+    return d["x"]
+
+[file b.py.2]
+from a import Dict, TValue
+
+def f(d: Dict[TValue]) -> TValue:
+    return d["value"]
+def g(d: Dict[TValue]) -> TValue:
+    return d["y"]
+[builtins fixtures/dict.pyi]
+[out]
+tmp/b.py:6: error: TypedDict "a.Dict[TValue]" has no key "x"
+[out2]
+tmp/b.py:6: error: TypedDict "a.Dict[TValue]" has no key "y"


=====================================
test-data/unit/check-python310.test
=====================================
@@ -1813,6 +1813,19 @@ def f1(x: int) -> int:
 
 [typing fixtures/typing-medium.pyi]
 
+[case testUsedBeforeDefMatchWalrus]
+# flags: --enable-error-code used-before-def
+import typing
+
+def f0(x: int) -> None:
+    a = y  # E: Cannot determine type of "y"  # E: Name "y" is used before definition
+    match y := x:
+        case 1:
+            b = y
+        case 2:
+            c = y
+    d = y
+
 [case testTypeAliasWithNewUnionSyntaxAndNoneLeftOperand]
 from typing import overload
 class C:


=====================================
test-data/unit/check-python38.test
=====================================
@@ -573,6 +573,14 @@ def foo() -> None:
     [x := x + y for y in [1, 2, 3]]
 [builtins fixtures/dict.pyi]
 
+[case testWalrusUsedBeforeDef]
+# flags: --python-version 3.8
+class C:
+    def f(self, c: 'C') -> None: pass
+
+(x := C()).f(y)  # E: Cannot determine type of "y"  # E: Name "y" is used before definition
+(y := C()).f(y)
+
 [case testOverloadWithPositionalOnlySelf]
 # flags: --python-version 3.8
 from typing import overload, Optional


=====================================
test-data/unit/check-typevar-values.test
=====================================
@@ -702,3 +702,12 @@ class Indexable:
 
 [builtins fixtures/tuple.pyi]
 [builtins fixtures/classmethod.pyi]
+
+[case testTypeVarWithValueDeferral]
+from typing import TypeVar, Callable
+
+T = TypeVar("T", "A", "B")
+Func = Callable[[], T]
+
+class A: ...
+class B: ...



View it on GitLab: https://salsa.debian.org/python-team/packages/mypy/-/compare/345e6e5e6cb72dcc8cbe34b8b19788d57cc130a9...f7f4cedd24a25b4d065d7d4130a9cc59346f6601

-- 
View it on GitLab: https://salsa.debian.org/python-team/packages/mypy/-/compare/345e6e5e6cb72dcc8cbe34b8b19788d57cc130a9...f7f4cedd24a25b4d065d7d4130a9cc59346f6601
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20230226/1f20628a/attachment-0001.htm>


More information about the debian-med-commit mailing list