Commit 0f5d7221 authored by Stefan Behnel's avatar Stefan Behnel

timely close Cython source file when generating C source comments

parent d2fe7355
...@@ -759,16 +759,22 @@ class GlobalState(object): ...@@ -759,16 +759,22 @@ class GlobalState(object):
try: try:
return self.input_file_contents[source_desc] return self.input_file_contents[source_desc]
except KeyError: except KeyError:
pass
source_file = source_desc.get_lines(encoding='ASCII',
error_handling='ignore')
try:
F = [u' * ' + line.rstrip().replace( F = [u' * ' + line.rstrip().replace(
u'*/', u'*[inserted by cython to avoid comment closer]/' u'*/', u'*[inserted by cython to avoid comment closer]/'
).replace( ).replace(
u'/*', u'/[inserted by cython to avoid comment start]*' u'/*', u'/[inserted by cython to avoid comment start]*'
) )
for line in source_desc.get_lines(encoding='ASCII', for line in source_file]
error_handling='ignore')] finally:
if len(F) == 0: F.append(u'') if hasattr(source_file, 'close'):
self.input_file_contents[source_desc] = F source_file.close()
return F if not F: F.append(u'')
self.input_file_contents[source_desc] = F
return F
# #
# Utility code state # Utility code state
......
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