From e5b469733ba9a6b5979ec6a6bbfdbcd46f64e259 Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 16 Oct 2019 12:50:02 -0500 Subject: [PATCH] Properly handle and close file in setup.py --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3cf3589..226988a 100644 --- a/setup.py +++ b/setup.py @@ -5,9 +5,9 @@ import re from setuptools import find_packages, setup VERSIONFILE = "tweepy/__init__.py" -ver_file = open(VERSIONFILE, "rt").read() VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" -mo = re.search(VSRE, ver_file, re.M) +with open(VERSIONFILE, "rt") as ver_file: + mo = re.search(VSRE, ver_file.read(), re.M) if mo: version = mo.group(1) -- 2.25.1