提交 99bd74eb authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Some fixes for Python 2.4 and Windows

Windows requires pickled files to be opened in binary mode. Also rewrote file operations to be safer.
上级 a54781c3
...@@ -10,8 +10,9 @@ from numpy.testing import dec ...@@ -10,8 +10,9 @@ from numpy.testing import dec
import theano import theano
import theano.sandbox.rng_mrg import theano.sandbox.rng_mrg
from theano import tensor from theano import tensor
from theano.tests import unittest_tools as utt
from theano.compile.pfunc import rebuild_collect_shared from theano.compile.pfunc import rebuild_collect_shared
from theano.gof.python25 import any
from theano.tests import unittest_tools as utt
from numpy.testing.noseclasses import KnownFailureTest from numpy.testing.noseclasses import KnownFailureTest
...@@ -215,8 +216,16 @@ class T_Scan(unittest.TestCase): ...@@ -215,8 +216,16 @@ class T_Scan(unittest.TestCase):
tmpdir = mkdtemp() tmpdir = mkdtemp()
os.chdir(tmpdir) os.chdir(tmpdir)
cPickle.dump(_my_f, open('tmp_scan_test_pickle.pkl','wb'),-1) f_out = open('tmp_scan_test_pickle.pkl', 'wb')
my_f = cPickle.load(open('tmp_scan_test_pickle.pkl')) try:
cPickle.dump(_my_f, f_out, protocol=-1)
finally:
f_out.close()
f_in = open('tmp_scan_test_pickle.pkl', 'rb')
try:
my_f = cPickle.load(f_in)
finally:
f_in.close()
finally: finally:
# Get back to the orinal dir, and delete temporary one. # Get back to the orinal dir, and delete temporary one.
os.chdir(origdir) os.chdir(origdir)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论