From 105115981ca107c53fbc8e8a70412461813d45a1 Mon Sep 17 00:00:00 2001 From: Capirca Team Date: Wed, 29 Nov 2023 07:11:27 -0800 Subject: [PATCH] Resolve unsoundness caught by pytype --strict-none-binding. PiperOrigin-RevId: 586331922 --- capirca/lib/windows.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/capirca/lib/windows.py b/capirca/lib/windows.py index da823418..159b3d37 100644 --- a/capirca/lib/windows.py +++ b/capirca/lib/windows.py @@ -127,8 +127,11 @@ def __str__(self): # if a srcport or dstport is specified. Fail if src or dst ports are # specified and of the protocols are not exactly one or both of 'tcp' # or 'udp'. - if ((not set(protocols).issubset(set(['tcp', 'udp']))) and - (len(src_ports) > 1 or len(dst_ports) > 1)): + if ( + (not set(protocols).issubset(set(['tcp', 'udp']))) and + (src_ports is not None and dst_ports is not None) and + (len(src_ports) > 1 or len(dst_ports) > 1) + ): raise aclgenerator.UnsupportedFilterError('%s %s %s' % ( '\n', self.term.name, 'src or dst ports may only be specified with "tcp" and/or "udp".'))