sha2 module still referenced even if not built (3.12.11)

未关闭 适合新手
#17 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
python, zig
领域
build-system

调研方向

从 build.zig 开始,该文件中默认禁用了 .sha2 模块,然后检查 traceback 中显示的 Python 3.12 hashlib.py 和 random.py 引用。重新构建,并使用 REPL 的 modules check 验证已禁用的 sha2 支持不再导致异常或引用不可用的 _sha2 代码。

由索引模型根据 Issue 内容生成。

描述

The module .sha2 is explicitly disabled in build.zig by default. The build completes fine, but when checking for modules in the REPL, throws exceptions:

help> modules

Please wait a moment while I gather a list of all available modules...

ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/mnt/mimic/pkg/python/lib/python3.12/random.py", line 68, in <module>
    from _sha2 import sha512 as _sha512
ModuleNotFoundError: No module named '_sha2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/mimic/pkg/python/lib/python3.12/hashlib.py", line 245, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/mimic/pkg/python/lib/python3.12/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/mnt/mimic/pkg/python/lib/python3.12/random.py", line 68, in <module>
    from _sha2 import sha512 as _sha512
ModuleNotFoundError: No module named '_sha2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/mimic/pkg/python/lib/python3.12/hashlib.py", line 245, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/mimic/pkg/python/lib/python3.12/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/mnt/mimic/pkg/python/lib/python3.12/random.py", line 68, in <module>
    from _sha2 import sha512 as _sha512
ModuleNotFoundError: No module named '_sha2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/mimic/pkg/python/lib/python3.12/hashlib.py", line 245, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/mimic/pkg/python/lib/python3.12/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/mnt/mimic/pkg/python/lib/python3.12/random.py", line 68, in <module>
    from _sha2 import sha512 as _sha512
ModuleNotFoundError: No module named '_sha2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/mimic/pkg/python/lib/python3.12/hashlib.py", line 245, in <module>
    globals()[__func_name] = __get_hash(__func_name)
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/mimic/pkg/python/lib/python3.12/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
主要语言
Zig
星标
19
派生
7
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

allyourcodebase/cpython 的其他 Issue

查看 allyourcodebase/cpython 的全部 Issue

相似的 Issue

更多 Build System Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。