# HG changeset patch # User John Rouillard # Date 1771557312 18000 # Node ID 82fc69e6d9d77e4708d75f8eeb80589f6f43ef38 # Parent 24e867f846dd84f57dfc58c0b6ea1ae5820e48e2 refactor/bug: handle case where netrc returns None. pyrefly flagged this. Python 3.14 (and 2.7) says authenticators() returns None if there is no matching host. Also the original exceptions IOError and TypeError appear to not be valid in this context. Rewrite to scope FileNotFoundError if .netrc is missing to just the one method call. Handle rest of flow with if/else not exception jump. diff -r 24e867f846dd -r 82fc69e6d9d7 roundup/scripts/roundup_mailgw.py --- a/roundup/scripts/roundup_mailgw.py Thu Feb 19 21:48:55 2026 -0500 +++ b/roundup/scripts/roundup_mailgw.py Thu Feb 19 22:15:12 2026 -0500 @@ -215,15 +215,20 @@ # the source will be a network server, so obtain the credentials to # use in connecting to the server + authenticator = None try: # attempt to obtain credentials from a ~/.netrc file + # returns None if host not found authenticator = netrc.netrc().authenticators(specification) + except FileNotFoundError: + # FileNotFoundError if no ~/.netrc file + pass + + if authenticator: username = authenticator[0] password = authenticator[2] server = specification - # IOError if no ~/.netrc file, TypeError if the hostname - # not found in the ~/.netrc file: - except (IOError, TypeError): + else: match = re.match(r'((?P[^:]+)(:(?P.+))?@)?(?P.+)', specification) if match: