mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
bpo-22831: Use "with" to avoid possible fd leaks in tools (part 2). (GH-10927)
This commit is contained in:
parent
afbb7a371f
commit
172bb39452
27 changed files with 249 additions and 259 deletions
|
@ -42,7 +42,8 @@ NM = 'nm -p -g %s' # For Linux, use "nm -g %s"
|
|||
|
||||
def symbols(lib=PYTHONLIB,types=('T','C','D')):
|
||||
|
||||
lines = os.popen(NM % lib).readlines()
|
||||
with os.popen(NM % lib) as pipe:
|
||||
lines = pipe.readlines()
|
||||
lines = [s.strip() for s in lines]
|
||||
symbols = {}
|
||||
for line in lines:
|
||||
|
@ -97,7 +98,7 @@ def main():
|
|||
exports = export_list(s)
|
||||
f = sys.stdout # open('PC/python_nt.def','w')
|
||||
f.write(DEF_TEMPLATE % (exports))
|
||||
f.close()
|
||||
# f.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue