From d7778d5c108b58c169f2c199eba14971d10c85e3 Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Mon, 15 Sep 2025 21:53:12 -0400 Subject: [PATCH 1/2] fix: something Shantanu found to be honest I have no idea what this code does, but I know we need to fix it --- mypy/strconv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mypy/strconv.py b/mypy/strconv.py index 3e9d37586f72..d1595139572a 100644 --- a/mypy/strconv.py +++ b/mypy/strconv.py @@ -388,7 +388,9 @@ def visit_name_expr(self, o: mypy.nodes.NameExpr) -> str: o.name, o.kind, o.fullname, o.is_inferred_def or o.is_special_form, o.node ) if isinstance(o.node, mypy.nodes.Var) and o.node.is_final: - pretty += f" = {o.node.final_value}" + final_value = o.node.final_value + if final_value is not None: + pretty += f" = {o.node.final_value}" return short_type(o) + "(" + pretty + ")" def pretty_name( From dd97ad8c7ada4838cfc1c0ae542af304e543be9e Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Thu, 25 Sep 2025 13:22:43 -0400 Subject: [PATCH 2/2] fix test data --- test-data/unit/semanal-basic.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-data/unit/semanal-basic.test b/test-data/unit/semanal-basic.test index 1f03ed22648d..773092cab623 100644 --- a/test-data/unit/semanal-basic.test +++ b/test-data/unit/semanal-basic.test @@ -521,7 +521,7 @@ MypyFile:1( NameExpr(True [builtins.True]) Literal[True]?) AssignmentStmt:8( - NameExpr(n* [__main__.n] = None) + NameExpr(n* [__main__.n]) CallExpr:8( NameExpr(func [__main__.func]) Args())))