mirror of
https://github.com/python/cpython.git
synced 2025-10-08 08:01:55 +00:00
modernize some modules' code by using with statement around open()
This commit is contained in:
parent
fd6e6cfa29
commit
2f50aaf2ff
14 changed files with 50 additions and 89 deletions
|
@ -235,7 +235,8 @@ class Symbol(object):
|
|||
|
||||
if __name__ == "__main__":
|
||||
import os, sys
|
||||
src = open(sys.argv[0]).read()
|
||||
with open(sys.argv[0]) as f:
|
||||
src = f.read()
|
||||
mod = symtable(src, os.path.split(sys.argv[0])[1], "exec")
|
||||
for ident in mod.get_identifiers():
|
||||
info = mod.lookup(ident)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue