`dis.dis` on empty classes does nothing
未关闭
还没有人认领这个 Issue。
stdlib
type-feature
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Expected behavior
dis.dis on an empty class should output a message along the lines of "Nothing to disassemble", or possibly raise an exception in that regard
Actual behavior
dis.dis produces no output when passed a class with no __dict__ members.
Repro case
Test code pasteable in interactive session:
if 1:
import sys
from dis import dis
class Empty: pass
print('Python', sys.version)
dis(Empty)
Output:
My local machine:
Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
Tutorialspoint:
Python 3.8.6 (default, Jan 29 2021, 17:38:16)
[GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]
JDoodle:
Python 3.9.9 (main, Nov 20 2021, 21:30:06)
[GCC 11.1.0]
Pyodide:
Python 3.10.2 (main, Aug 9 2022, 13:42:49) [Clang 15.0.0 (https://github.com/llvm/llvm-project 7effcbda49ba32991b8955821b8f
Your environment
- CPython versions tested on: See output above
- Operating system and architecture: See output above
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先通过提供的 Empty 类示例,从 dis.dis 入口点复现所报告的行为。跟踪 dis.dis 如何处理一个没有 dict 成员的类,然后针对该情况添加一条用户可见的消息或异常,并验证空类示例不再出现无输出的情况。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100