Skip to content

Commit

Permalink
Use the with statement to open files in setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed Apr 3, 2014
1 parent 2bfee8e commit 8421831
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@


def read(*rnames):
text = open(os.path.join(os.path.dirname(__file__), *rnames)).read()
with open(os.path.join(os.path.dirname(__file__), *rnames)) as f:
text = f.read()
if isinstance(text, bytes):
text = text.decode('utf-8')
return text.encode('ascii', 'xmlcharrefreplace').decode()
Expand Down

0 comments on commit 8421831

Please sign in to comment.