From ddf3fec6d3fcce7ac5e1ac06e9340952274d44ee Mon Sep 17 00:00:00 2001 From: "Terence S.-C. Tsang" Date: Sun, 23 Jun 2024 03:07:18 +0200 Subject: [PATCH] Closes issue #279 --- line_profiler/autoprofile/util_static.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/line_profiler/autoprofile/util_static.py b/line_profiler/autoprofile/util_static.py index 9400fbe5..843e1014 100644 --- a/line_profiler/autoprofile/util_static.py +++ b/line_profiler/autoprofile/util_static.py @@ -181,6 +181,10 @@ def visit_Assign(self, node): if getattr(target, "id", None) == varname: self.static_value = _parse_static_node_value(node.value) + def visit_AnnAssign(self, node): + if getattr(node.target, "id", None) == varname: + self.static_value = _parse_static_node_value(node.value) + visitor = StaticVisitor() visitor.visit(pt) try: