Skip to content

Commit 0d6c333

Browse files
committed
Always deterministically close files in setup.py
When running Python with warnings enabled, fixes warning: setup.py:12: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.rst' mode='r' encoding='utf-8'> long_description=open("README.rst", encoding="utf-8").read(),
1 parent 3f4ba54 commit 0d6c333

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

setup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@
44

55
from setuptools import find_packages, setup
66

7+
8+
def readall(path):
9+
with open(path, encoding="utf-8") as fp:
10+
return fp.read()
11+
12+
713
setup(
814
name="django-debug-toolbar",
915
version="1.10.1",
1016
description="A configurable set of panels that display various debug "
1117
"information about the current request/response.",
12-
long_description=open("README.rst", encoding="utf-8").read(),
18+
long_description=readall("README.rst"),
1319
author="Rob Hudson",
1420
author_email="rob@cogit8.org",
1521
url="https://github.com/jazzband/django-debug-toolbar",

0 commit comments

Comments
 (0)