Skip to content

Commit 50ca1d0

Browse files
Berthin TorresBerthin Torres
authored andcommitted
refactor tests and double check logic for security
1 parent 4c3c39a commit 50ca1d0

2 files changed

Lines changed: 192 additions & 148 deletions

File tree

Lib/netrc.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ def push_token(self, token):
6565

6666
class netrc:
6767
def __init__(self, file=None):
68-
default_netrc = file is None
68+
netrc_envvar = os.environ.get("NETRC", "")
69+
default_netrc = file is None and not bool(netrc_envvar)
6970
if file is None:
70-
file = os.environ.get("NETRC", "") or os.path.join(os.path.expanduser("~"), ".netrc")
71+
file = netrc_envvar or os.path.join(os.path.expanduser("~"), ".netrc")
7172
self.hosts = {}
7273
self.macros = {}
7374
try:

0 commit comments

Comments
 (0)