提交 0594b7f5 authored 作者: Gabe Schwartz's avatar Gabe Schwartz

Python 3 removed file() in favor of open().

上级 5ee86171
...@@ -8,7 +8,7 @@ class CallCache(object): ...@@ -8,7 +8,7 @@ class CallCache(object):
try: try:
if filename is None: if filename is None:
raise IOError('bad filename') #just goes to except raise IOError('bad filename') #just goes to except
f = file(filename, 'r') f = open(filename, 'r')
self.cache = cPickle.load(f) self.cache = cPickle.load(f)
f.close() f.close()
except IOError: except IOError:
...@@ -20,7 +20,7 @@ class CallCache(object): ...@@ -20,7 +20,7 @@ class CallCache(object):
#backport #backport
#filename = self.filename if filename is None else filename #filename = self.filename if filename is None else filename
f = file(filename, 'w') f = open(filename, 'w')
cPickle.dump(self.cache, f) cPickle.dump(self.cache, f)
f.close() f.close()
......
...@@ -247,7 +247,7 @@ class NVCC_compiler(object): ...@@ -247,7 +247,7 @@ class NVCC_compiler(object):
lib_dirs.append(python_lib) lib_dirs.append(python_lib)
cppfilename = os.path.join(location, 'mod.cu') cppfilename = os.path.join(location, 'mod.cu')
cppfile = file(cppfilename, 'w') cppfile = open(cppfilename, 'w')
_logger.debug('Writing module C++ code to %s', cppfilename) _logger.debug('Writing module C++ code to %s', cppfilename)
...@@ -401,7 +401,7 @@ class NVCC_compiler(object): ...@@ -401,7 +401,7 @@ class NVCC_compiler(object):
if py_module: if py_module:
#touch the __init__ file #touch the __init__ file
file(os.path.join(location, "__init__.py"), 'w').close() open(os.path.join(location, "__init__.py"), 'w').close()
return dlimport(lib_filename) return dlimport(lib_filename)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论