Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
27f62bf3
提交
27f62bf3
authored
7月 03, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
When loading cutils_ext module, put the path at the start of sys.path to prevent conflict.
close gh-728
上级
1ada610b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
24 行增加
和
23 行删除
+24
-23
cutils.py
theano/gof/cutils.py
+24
-23
没有找到文件。
theano/gof/cutils.py
浏览文件 @
27f62bf3
...
@@ -56,32 +56,33 @@ def compile_cutils():
...
@@ -56,32 +56,33 @@ def compile_cutils():
cmodule
.
GCC_compiler
.
compile_str
(
'cutils_ext'
,
code
,
location
=
loc
,
cmodule
.
GCC_compiler
.
compile_str
(
'cutils_ext'
,
code
,
location
=
loc
,
preargs
=
args
)
preargs
=
args
)
try
:
try
:
# If we load a previously-compiled version, config.compiledir should
try
:
# be in sys.path.
# Must be at the beginning to ensure no conflict with other project
if
config
.
compiledir
not
in
sys
.
path
:
# that would use the same module name.
sys
.
path
.
insert
(
0
,
config
.
compiledir
)
sys
.
path
.
insert
(
0
,
config
.
compiledir
)
from
cutils_ext.cutils_ext
import
*
from
cutils_ext.cutils_ext
import
*
except
ImportError
:
except
ImportError
:
import
cmodule
import
cmodule
get_lock
()
get_lock
()
# Ensure no-one else is currently modifying the content of the compilation
# Ensure no-one else is currently modifying the content of the compilation
# directory. This is important to prevent multiple processes from trying to
# directory. This is important to prevent multiple processes from trying to
# compile the cutils_ext module simultaneously.
# compile the cutils_ext module simultaneously.
try
:
try
:
try
:
# We must retry to import it as some other processs could
try
:
# have been compiling it between the first failed import
# We must retry to import it as some other processs could
# and when we receive the lock
# have been compiling it between the first failed import
from
cutils_ext.cutils_ext
import
*
# and when we receive the lock
except
ImportError
:
from
cutils_ext.cutils_ext
import
*
import
cmodule
except
ImportError
:
import
cmodule
compile_cutils
()
compile_cutils
()
from
cutils_ext.cutils_ext
import
*
from
cutils_ext.cutils_ext
import
*
finally
:
finally
:
# Release lock on compilation directory.
# Release lock on compilation directory.
release_lock
()
release_lock
()
finally
:
del
sys
.
path
[
0
]
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论