[Git][ghc/ghc][wip/python-files] Fix unclosed files in Python testdriver

Krzysztof Gogolewski (@monoidal) gitlab at gitlab.haskell.org
Wed Jan 11 19:39:23 UTC 2023



Krzysztof Gogolewski pushed to branch wip/python-files at Glasgow Haskell Compiler / GHC


Commits:
c4d62217 by Krzysztof Gogolewski at 2023-01-11T20:39:13+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
=====================================
@@ -349,8 +349,6 @@ except Exception as e:
     print('Failed to detect CPU features: ', e)
 
 sys.stdout.flush()
-# we output text, which cannot be unbuffered
-sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w")
 
 if config.local:
     tempdir = ''



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c4d62217db123ad16e58d21a3368fc00c6ba2355

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c4d62217db123ad16e58d21a3368fc00c6ba2355
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/0f4a4aea/attachment-0001.html>


More information about the ghc-commits mailing list