Skip to content

Commit 04b788f

Browse files
committed
reuse os.path calls
1 parent e85c181 commit 04b788f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Lib/pdb.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,18 @@ def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None,
391391
# Read ~/.pdbrc and ./.pdbrc
392392
self.rcLines = []
393393
if readrc:
394+
home_rcfile = os.path.expanduser("~/.pdbrc")
395+
local_rcfile = os.path.abspath(".pdbrc")
396+
394397
try:
395-
with open(os.path.expanduser('~/.pdbrc'), encoding='utf-8') as rcFile:
398+
with open(home_rcfile, encoding='utf-8') as rcFile:
396399
self.rcLines.extend(rcFile)
397400
except OSError:
398401
pass
399-
if os.path.abspath(".pdbrc") != os.path.expanduser("~/.pdbrc"):
402+
403+
if local_rcfile != home_rcfile:
400404
try:
401-
with open(".pdbrc", encoding='utf-8') as rcFile:
405+
with open(local_rcfile, encoding='utf-8') as rcFile:
402406
self.rcLines.extend(rcFile)
403407
except OSError:
404408
pass

0 commit comments

Comments
 (0)