[med-svn] [Git][python-team/packages/mypy][master] 5 commits: Revert "d/rules: re-enable 2 more tests"
Michael R. Crusoe (@crusoe)
gitlab at salsa.debian.org
Thu Oct 15 12:12:13 BST 2026
Michael R. Crusoe pushed to branch master at Debian Python Team / packages / mypy
Commits:
30e3b740 by Michael R. Crusoe at 2026-10-15T12:53:54+02:00
Revert "d/rules: re-enable 2 more tests"
This reverts commit d2045476a54edf69c727222ce9dfe3c88bd7d158.
- - - - -
93d4c8c6 by Michael R. Crusoe at 2026-10-15T12:55:43+02:00
Nope, those flaky tests are still flaky.
- - - - -
330f05ca by Michael R. Crusoe at 2026-10-15T13:06:03+02:00
0001-mypyc-Fix-recursive-setup-for-frame-private-helpers.patch: Refreshed from upstream with follow-on changes.
- - - - -
85a6c08f by Michael R. Crusoe at 2026-10-15T13:06:30+02:00
Changes made by cme
- - - - -
3c4cab88 by Michael R. Crusoe at 2026-10-15T13:06:39+02:00
routine-update: Ready to upload to unstable
- - - - -
4 changed files:
- debian/changelog
- debian/control
- debian/patches/0001-mypyc-Fix-recursive-setup-for-frame-private-helpers.patch
- debian/rules
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+mypy (2.4.0-3) unstable; urgency=medium
+
+ * Nope, those flaky tests are still flaky.
+ * 0001-mypyc-Fix-recursive-setup-for-frame-private-helpers.patch:
+ Refreshed from upstream with follow-on changes.
+
+ -- Michael R. Crusoe <crusoe at debian.org> Thu, 15 Oct 2026 13:06:39 +0200
+
mypy (2.4.0-2) unstable; urgency=medium
* Cherry-pick patch from upstream to fix FTBFS of black using mypy
=====================================
debian/control
=====================================
@@ -15,8 +15,8 @@ Build-Depends:
flake8 <!nocheck>,
help2man,
python3-all,
- python3-ast-serialize (>= 0.11.2),
- python3-librt (>= 0.16.0),
+ python3-ast-serialize,
+ python3-librt,
python3-lxml,
python3-attr <!nocheck>,
python3-pathspec (>= 1),
=====================================
debian/patches/0001-mypyc-Fix-recursive-setup-for-frame-private-helpers.patch
=====================================
@@ -1,20 +1,36 @@
From: Piotr Sawicki <sawickipiotr at outlook.com>
-Date: Mon, 12 Oct 2026 14:53:12 +0200
-Subject: [mypyc] Fix recursive setup for frame-private helpers
+Date: Tue, 13 Oct 2026 13:45:14 +0200
+Subject: [mypyc] Skip recursive setup for frame-private nested functions
+ (#22187)
Origin: upstream, https://github.com/python/mypy/pull/22187/
Forwared: not-needed
+
+
+The recursive setup could cause `AttributeError` at runtime when a
+function contains both a frame-private as well as a captured nested
+function. The setup would add the frame-private function object as an
+attribute to the env class and access it even though it was never
+initialized.
+
+Fix by omitting the recursive setup since it's not needed - a
+frame-private nested function can't call itself.
+
+Also fix possibly inconsistent storage for a redefined nested function
+that is captured in one branch and not captured in another by using
+`original_def` in capture/free variable checks.
---
- mypyc/irbuild/env_class.py | 35 +++++++++++++++++---------
+ mypyc/irbuild/env_class.py | 36 +++++++++++++++++---------
mypyc/irbuild/function.py | 8 +++---
mypyc/irbuild/generator.py | 4 +--
mypyc/irbuild/util.py | 8 ++++++
+ mypyc/test-data/run-functions.test | 27 ++++++++++++++++++++
mypyc/test-data/run-generators.test | 32 ++++++++++++++++++++++++
mypyc/test/test_generator_spills.py | 50 +++++++++++++++++++++++++++++++++++++
- 6 files changed, 118 insertions(+), 19 deletions(-)
+ 7 files changed, 146 insertions(+), 19 deletions(-)
diff --git a/mypyc/irbuild/env_class.py b/mypyc/irbuild/env_class.py
-index 4e5c581..55d842a 100644
+index 4e5c581..42d2fac 100644
--- a/mypyc/irbuild/env_class.py
+++ b/mypyc/irbuild/env_class.py
@@ -31,6 +31,7 @@ from mypyc.ir.rtypes import RInstance, bitmap_rprimitive, object_rprimitive
@@ -82,7 +98,7 @@ index 4e5c581..55d842a 100644
"""Enable calling a nested function (with a callable class) recursively.
Adds the instance of the callable class representing the given
-@@ -338,10 +342,17 @@ def setup_func_for_recursive_call(
+@@ -338,10 +342,18 @@ def setup_func_for_recursive_call(
be called recursively. Note that this needs to be done only for
nested functions.
"""
@@ -93,7 +109,8 @@ index 4e5c581..55d842a 100644
+ target_symbol = get_func_target_symbol(fdef)
+ target = builder.symtables[-2].get(target_symbol)
+ if (
-+ not isinstance(target, AssignmentTargetAttr)
++ not isinstance(target_symbol, FuncDef)
++ or not isinstance(target, AssignmentTargetAttr)
+ or not isinstance(target.obj.type, RInstance)
+ or target.obj.type.class_ir is not prev_env
+ ):
@@ -103,7 +120,7 @@ index 4e5c581..55d842a 100644
line = fdef.line
if isinstance(base, GeneratorClass):
-@@ -355,7 +366,7 @@ def setup_func_for_recursive_call(
+@@ -355,7 +367,7 @@ def setup_func_for_recursive_call(
# Obtain the instance of the callable class representing the FuncDef, and add it to the
# current environment.
val = builder.add(GetAttr(prev_env_reg, attr_name, line))
@@ -173,6 +190,44 @@ index a2378fa..5c53391 100644
def concrete_arg_kind(kind: ArgKind) -> ArgKind:
"""Find the concrete version of an arg kind that is being passed."""
if kind == ARG_OPT:
+diff --git a/mypyc/test-data/run-functions.test b/mypyc/test-data/run-functions.test
+index b0f184c..bb52eeb 100644
+--- a/mypyc/test-data/run-functions.test
++++ b/mypyc/test-data/run-functions.test
+@@ -1399,6 +1399,33 @@ print(f(1))
+ [out]
+ 2
+
++[case testReassignedNestedFunction]
++from typing import Callable, Generator
++
++def outer(flag: bool) -> list[int]:
++ out: list[int] = []
++ f: Callable[[int], None] = lambda n: out.append(-1)
++
++ def swap() -> None:
++ nonlocal f
++ f = lambda n: out.append(100 + n)
++
++ if flag:
++ def f(n: int) -> None:
++ def k(m: int) -> int:
++ return k(m - 1) if m else 0
++
++ out.append(n + k(2))
++ if n == 0:
++ swap()
++ f(1) # should call the lambda installed by swap()
++ f(0)
++ return out
++
++def test_reassigned_nested_function() -> None:
++ assert outer(False) == [-1]
++ assert outer(True) == [0, 101]
++
+ [case testStarArgFastPaths]
+ from typing import Any, Mapping
+ def fn(x: str, y: int) -> str:
diff --git a/mypyc/test-data/run-generators.test b/mypyc/test-data/run-generators.test
index b881079..70f3e80 100644
--- a/mypyc/test-data/run-generators.test
=====================================
debian/rules
=====================================
@@ -30,12 +30,14 @@ export MYPY_TEST_PREFIX=$(CURDIR)
export PYBUILD_TEST_ARGS=$(DEB_BUILD_OPTION_PARALLEL:%=-n%) \
-o python_files=test*.py \
-o python_classes= -o python_functions= --pyargs mypy.test mypyc.test \
- -k 'not (PEP561Suite or testIgnoreImportIfNoPython3StubAvailable or testNoPython3StubAvailable or testCustomTypeshedDirWithRelativePathDoesNotCrash or testDaemonStatusKillRestartRecheck)'
+ -k 'not (PEP561Suite or testIgnoreImportIfNoPython3StubAvailable or testNoPython3StubAvailable or testCustomTypeshedDirWithRelativePathDoesNotCrash or testDaemonStatusKillRestartRecheck or testOutputJsonParallel or testOutputJsonSyntaxErrorParallel)'
# PEP561Suite: needs internet access to pypi.org
# testIgnoreImportIfNoPython3StubAvailable: needs scribe installed (it isn't packaged for Debian)
# testNoPython3StubAvailable: no longer works because python3-typeshed includes docutils types, which it isn't expecting
# testCustomTypeshedDirWithRelativePathDoesNotCrash: fails as the mypy_extensions package is installed, so a different error appears
# testDaemonStatusKillRestartRecheck: fails for sbuild/unshare
+# testOutputJsonParallel: flaky https://github.com/python/mypy/issues/21905
+# testOutputJsonSyntaxErrorParallel: flaky https://github.com/python/mypy/issues/21905
%:
dh $@ --buildsystem=pybuild
View it on GitLab: https://salsa.debian.org/python-team/packages/mypy/-/compare/d2045476a54edf69c727222ce9dfe3c88bd7d158...3c4cab88091f0ffe772be21d5bc030d360b6bc8a
--
View it on GitLab: https://salsa.debian.org/python-team/packages/mypy/-/compare/d2045476a54edf69c727222ce9dfe3c88bd7d158...3c4cab88091f0ffe772be21d5bc030d360b6bc8a
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20261015/77229ec1/attachment-0001.htm>
More information about the debian-med-commit
mailing list