Skip to content

Commit 76614f7

Browse files
committed
Clean up ResourceWarning in setup.py
Always explicitly close files. Use a context manager to make this easier. Fixes ResourceWarning when Python has warnings enabled.
1 parent 53e7a36 commit 76614f7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

setup.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,17 @@
2828
sys.exit()
2929

3030

31+
def readall(path):
32+
with open(path) as fp:
33+
return fp.read()
34+
35+
3136
setup(
3237
name=APP_NAME,
3338
version=VERSION,
3439
description='OAuthlib authentication support for Requests.',
35-
long_description=open('README.rst').read() + '\n\n' +
36-
open('HISTORY.rst').read(),
40+
long_description=readall('README.rst') + '\n\n' +
41+
readall('HISTORY.rst'),
3742
author='Kenneth Reitz',
3843
author_email='[email protected]',
3944
url='https://github.com/requests/requests-oauthlib',

0 commit comments

Comments
 (0)