[Git][ghc/ghc][wip/python-files] Fix unclosed files in Python testdriver
Krzysztof Gogolewski (@monoidal)
gitlab at gitlab.haskell.org
Wed Jan 11 19:45:38 UTC 2023
Krzysztof Gogolewski pushed to branch wip/python-files at Glasgow Haskell Compiler / GHC
Commits:
73c07aa5 by Krzysztof Gogolewski at 2023-01-11T20:45:20+01:00
Fix unclosed files in Python testdriver
- - - - -
2 changed files:
- testsuite/driver/cpu_features.py
- testsuite/driver/runtests.py
Changes:
=====================================
testsuite/driver/cpu_features.py
=====================================
@@ -17,7 +17,8 @@ cpu_feature_cache = None
def get_cpu_features():
if config.os in ['mingw32', 'linux'] and os.path.exists('/proc/cpuinfo'):
- f = open('/proc/cpuinfo').read()
+ with open('/proc/cpuinfo') as x:
+ f = x.read()
flags = re.search(r'flags\s*:\s*.*$', f, re.M)
if flags is None:
print('get_cpu_features: failed to find cpu features')
=====================================
testsuite/driver/runtests.py
=====================================
@@ -99,7 +99,8 @@ if args.e:
if args.config_file:
for arg in args.config_file:
- exec(open(arg).read())
+ with open(arg) as f:
+ exec(f.read())
if args.config:
for arg in args.config:
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/73c07aa51924342067c5d4d1563aa1785b296f7f
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/73c07aa51924342067c5d4d1563aa1785b296f7f
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230111/22939fce/attachment-0001.html>
More information about the ghc-commits
mailing list