From a70f5718a6199919e5bddf4a7daa032ae80c6779 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sat, 11 Sep 2010 21:34:37 +0000 Subject: BUG: distutils: make is_free_format et al. not choke on non-ascii Fortran files --- numpy/distutils/fcompiler/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'numpy') diff --git a/numpy/distutils/fcompiler/__init__.py b/numpy/distutils/fcompiler/__init__.py index 26ea73895..3fd3f22dc 100644 --- a/numpy/distutils/fcompiler/__init__.py +++ b/numpy/distutils/fcompiler/__init__.py @@ -25,6 +25,8 @@ try: 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 @@ def is_free_format(file): # 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 @@ def is_free_format(file): 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 @@ def get_f77flags(src): Return a dictionary {:}. """ flags = {} - f = open(src,'r') + f = open_latin1(src,'r') i = 0 for line in f.readlines(): i += 1 -- cgit v1.2.1