Commit fd13c811 authored by Stefan Behnel's avatar Stefan Behnel

fix open file leak

--HG--
extra : transplant_source : 7%EC%04%1F%89%F6%AA%8C%7Fl%B5D%DA%D5%CAF%B7%A70%0D
parent 2e88bd48
......@@ -7,7 +7,7 @@ from __future__ import absolute_import
import os
import re
import sys
import codecs
import io
if sys.version_info[:2] < (2, 6) or (3, 0) <= sys.version_info[:2] < (3, 2):
sys.stderr.write("Sorry, Cython requires Python 2.6+ or 3.2+, found %d.%d\n" % tuple(sys.version_info[:2]))
......@@ -427,9 +427,10 @@ def run_pipeline(source, options, full_module_name=None, context=None):
# By default, decide based on whether an html file already exists.
html_filename = os.path.splitext(result.c_file)[0] + ".html"
if os.path.exists(html_filename):
line = codecs.open(html_filename, "r", encoding="UTF-8").readline()
if line.startswith(u'<!-- Generated by Cython'):
options.annotate = True
with io.open(html_filename, "r", encoding="UTF-8") as html_file:
line = html_file.readline()
if line.startswith(u'<!-- Generated by Cython'):
options.annotate = True
# Get pipeline
if source_ext.lower() == '.py' or not source_ext:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment