Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e126020a
提交
e126020a
authored
10月 15, 2025
作者:
Virgile Andreani
提交者:
Ricardo Vieira
12月 03, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix pickling errors with python 3.14
上级
1a9fc1ed
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
16 行增加
和
13 行删除
+16
-13
test_cmodule.py
tests/link/c/test_cmodule.py
+11
-11
test_config.py
tests/test_config.py
+5
-2
没有找到文件。
tests/link/c/test_cmodule.py
浏览文件 @
e126020a
...
...
@@ -395,18 +395,18 @@ def test_linking_patch(listdir_mock, platform):
]
def
test_cache_race_condition
():
with
tempfile
.
TemporaryDirectory
()
as
dir_name
:
@config.change_flags
(
on_opt_error
=
"raise"
,
on_shape_error
=
"raise"
)
def
_f_build_cache_race_condition
(
factor
):
# Some of the caching issues arise during constant folding within the
# optimization passes, so we need these config changes to prevent the
# exceptions from being caught
a
=
pt
.
vector
()
f
=
pytensor
.
function
([
a
],
factor
*
a
)
return
f
(
np
.
array
([
1
],
dtype
=
config
.
floatX
))
@config.change_flags
(
on_opt_error
=
"raise"
,
on_shape_error
=
"raise"
)
def
f_build
(
factor
):
# Some of the caching issues arise during constant folding within the
# optimization passes, so we need these config changes to prevent the
# exceptions from being caught
a
=
pt
.
vector
()
f
=
pytensor
.
function
([
a
],
factor
*
a
)
return
f
(
np
.
array
([
1
],
dtype
=
config
.
floatX
))
def
test_cache_race_condition
():
with
tempfile
.
TemporaryDirectory
()
as
dir_name
:
ctx
=
multiprocessing
.
get_context
()
compiledir_prop
=
pytensor
.
config
.
_config_var_dict
[
"compiledir"
]
...
...
@@ -425,7 +425,7 @@ def test_cache_race_condition():
# A random, constant input to prevent caching between runs
factor
=
rng
.
random
()
procs
=
[
ctx
.
Process
(
target
=
f_build
,
args
=
(
factor
,))
ctx
.
Process
(
target
=
_f_build_cache_race_condition
,
args
=
(
factor
,))
for
i
in
range
(
num_procs
)
]
for
proc
in
procs
:
...
...
tests/test_config.py
浏览文件 @
e126020a
...
...
@@ -247,9 +247,12 @@ def test_config_pickling():
configparser
.
IntParam
(
5
,
lambda
i
:
i
>
0
),
in_c_key
=
False
,
)
# Python 3.14 emits a pickle.PicklingError
# previous versions used to emit an AttributeError
# the error string changed a little bit too
with
pytest
.
raises
(
AttributeError
,
match
=
r"Can't (pickle|get) local object
'test_config_pickling\.<locals>\.<lambda>'
"
,
(
AttributeError
,
pickle
.
PicklingError
)
,
match
=
r"Can't (pickle|get) local object
.*test_config_pickling\.<locals>\.<lambda>
"
,
):
pickle
.
dump
(
root
,
io
.
BytesIO
())
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论