summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/pdeps.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-04-06 02:59:13 (GMT)
committerR David Murray <rdmurray@bitdance.com>2012-04-06 02:59:13 (GMT)
commitd3af6344ef43df20c91be8275a5e874dc0589830 (patch)
treeb79357fe24c74e978793b91af11ad73a26c6b905 /Tools/scripts/pdeps.py
parentfee3fc748e4c6e00cdd44c079e54cacef00690cf (diff)
downloadcpython-d3af6344ef43df20c91be8275a5e874dc0589830.zip
cpython-d3af6344ef43df20c91be8275a5e874dc0589830.tar.gz
cpython-d3af6344ef43df20c91be8275a5e874dc0589830.tar.bz2
#14492: fix some bugs in Tools/scripts/pdeps.py.
Initial patch by Popa Claudiu.
Diffstat (limited to 'Tools/scripts/pdeps.py')
-rwxr-xr-xTools/scripts/pdeps.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Tools/scripts/pdeps.py b/Tools/scripts/pdeps.py
index 938f31c..f8218ac 100755
--- a/Tools/scripts/pdeps.py
+++ b/Tools/scripts/pdeps.py
@@ -76,10 +76,9 @@ def process(filename, table):
nextline = fp.readline()
if not nextline: break
line = line[:-1] + nextline
- if m_import.match(line) >= 0:
- (a, b), (a1, b1) = m_import.regs[:2]
- elif m_from.match(line) >= 0:
- (a, b), (a1, b1) = m_from.regs[:2]
+ m_found = m_import.match(line) or m_from.match(line)
+ if m_found:
+ (a, b), (a1, b1) = m_found.regs[:2]
else: continue
words = line[a1:b1].split(',')
# print '#', line, words
@@ -87,6 +86,7 @@ def process(filename, table):
word = word.strip()
if word not in list:
list.append(word)
+ fp.close()
# Compute closure (this is in fact totally general)
@@ -123,7 +123,7 @@ def closure(table):
def inverse(table):
inv = {}
for key in table.keys():
- if not inv.has_key(key):
+ if key not in inv:
inv[key] = []
for item in table[key]:
store(inv, item, key)