[Numpy-svn] r8712 - branches/1.5.x/numpy/distutils/fcompiler

numpy-svn@scip... numpy-svn@scip...
Sat Sep 11 16:36:23 CDT 2010


Author: ptvirtan
Date: 2010-09-11 16:36:23 -0500 (Sat, 11 Sep 2010)
New Revision: 8712

Modified:
   branches/1.5.x/numpy/distutils/fcompiler/__init__.py
Log:
BUG: (backport r8711) distutils: make is_free_format et al. not choke on non-ascii Fortran files

Modified: branches/1.5.x/numpy/distutils/fcompiler/__init__.py
===================================================================
--- branches/1.5.x/numpy/distutils/fcompiler/__init__.py	2010-09-11 21:34:37 UTC (rev 8711)
+++ branches/1.5.x/numpy/distutils/fcompiler/__init__.py	2010-09-11 21:36:23 UTC (rev 8712)
@@ -25,6 +25,8 @@
 except NameError:
     from sets import Set as set
 
+from numpy.compat import open_latin1
+
 from distutils.sysconfig import get_config_var, get_python_lib
 from distutils.fancy_getopt import FancyGetopt
 from distutils.errors import DistutilsModuleError, \
@@ -911,7 +913,7 @@
     # f90 allows both fixed and free format, assuming fixed unless
     # signs of free format are detected.
     result = 0
-    f = open(file,'r')
+    f = open_latin1(file,'r')
     line = f.readline()
     n = 10000 # the number of non-comment lines to scan for hints
     if _has_f_header(line):
@@ -931,7 +933,7 @@
     return result
 
 def has_f90_header(src):
-    f = open(src,'r')
+    f = open_latin1(src,'r')
     line = f.readline()
     f.close()
     return _has_f90_header(line) or _has_fix_header(line)
@@ -944,7 +946,7 @@
     Return a dictionary {<fcompiler type>:<f77 flags>}.
     """
     flags = {}
-    f = open(src,'r')
+    f = open_latin1(src,'r')
     i = 0
     for line in f.readlines():
         i += 1



More information about the Numpy-svn mailing list