Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
29757d4f
提交
29757d4f
authored
4月 22, 2025
作者:
Ben Mares
提交者:
Michael Osthege
4月 25, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Define get_lines outside of the if statement
That's the only possible definition, and the type checker is freaking out.
上级
e602c239
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
37 行增加
和
37 行删除
+37
-37
cmodule.py
pytensor/link/c/cmodule.py
+37
-37
没有找到文件。
pytensor/link/c/cmodule.py
浏览文件 @
29757d4f
...
...
@@ -2104,45 +2104,45 @@ class GCC_compiler(Compiler):
)
detect_march
=
False
if
detect_march
:
GCC_compiler
.
march_flags
=
[]
def
get_lines
(
cmd
,
parse
=
True
):
p
=
subprocess_Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
shell
=
True
,
)
# For mingw64 with GCC >= 4.7, passing os.devnull
# as stdin (which is the default) results in the process
# waiting forever without returning. For that reason,
# we use a pipe, and use the empty string as input.
(
stdout
,
stderr
)
=
p
.
communicate
(
input
=
b
""
)
if
p
.
returncode
!=
0
:
return
None
def
get_lines
(
cmd
,
parse
=
True
):
p
=
subprocess_Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
shell
=
True
,
)
# For mingw64 with GCC >= 4.7, passing os.devnull
# as stdin (which is the default) results in the process
# waiting forever without returning. For that reason,
# we use a pipe, and use the empty string as input.
(
stdout
,
stderr
)
=
p
.
communicate
(
input
=
b
""
)
if
p
.
returncode
!=
0
:
return
None
lines
=
BytesIO
(
stdout
+
stderr
)
.
readlines
()
lines
=
(
l
.
decode
()
for
l
in
lines
)
if
parse
:
selected_lines
=
[]
for
line
in
lines
:
if
(
"COLLECT_GCC_OPTIONS="
in
line
or
"CFLAGS="
in
line
or
"CXXFLAGS="
in
line
or
"-march=native"
in
line
):
continue
selected_lines
.
extend
(
line
.
strip
()
for
reg
in
(
"-march="
,
"-mtune="
,
"-target-cpu"
,
"-mabi="
)
if
reg
in
line
)
lines
=
list
(
set
(
selected_lines
))
# to remove duplicate
lines
=
BytesIO
(
stdout
+
stderr
)
.
readlines
()
lines
=
(
l
.
decode
()
for
l
in
lines
)
if
parse
:
selected_lines
=
[]
for
line
in
lines
:
if
(
"COLLECT_GCC_OPTIONS="
in
line
or
"CFLAGS="
in
line
or
"CXXFLAGS="
in
line
or
"-march=native"
in
line
):
continue
selected_lines
.
extend
(
line
.
strip
()
for
reg
in
(
"-march="
,
"-mtune="
,
"-target-cpu"
,
"-mabi="
)
if
reg
in
line
)
lines
=
list
(
set
(
selected_lines
))
# to remove duplicate
return
lines
return
lines
if
detect_march
:
GCC_compiler
.
march_flags
=
[]
# The '-' at the end is needed. Otherwise, g++ do not output
# enough information.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论