Skip to content

Commit 8e7f236

Browse files
committed
use "with"
1 parent a7376c0 commit 8e7f236

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424

2525
def get_authors():
2626
try:
27-
f = file(os.path.join(PACKAGE_ROOT, "AUTHORS"), "r")
28-
authors = [l.strip(" *\r\n") for l in f if l.strip().startswith("*")]
29-
f.close()
27+
with open(os.path.join(PACKAGE_ROOT, "AUTHORS"), "r") as f:
28+
authors = [l.strip(" *\r\n") for l in f if l.strip().startswith("*")]
3029
except Exception:
3130
evalue = sys.exc_info()[1]
3231
authors = "[Error: %s]" % evalue

0 commit comments

Comments
 (0)