Exception stacktrace generated from passing an invalid `target` to `Thread(...).start()` does not include the line calling the `start()` method
未关闭
还没有人认领这个 Issue。
stdlib
type-feature
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
import threading,sys
print(sys.version)
def ThreadMain():
print("howdy cowboy")
ThreadMaiin=True
myThread=threading.Thread(target=ThreadMaiin)
myThread.start() # @note Ideally, the Stacktrace generated by the exception raised as a result of this line would include the line itself
Prints the following to console:
3.14.3 (tags/v3.14.3:323c59a, Feb 3 2026, 16:04:56) [MSC v.1944 64 bit (AMD64)]
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\olliv\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1082, in _bootstrap_inner
self._context.run(self.run)
~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\Users\olliv\AppData\Local\Programs\Python\Python314\Lib\threading.py", line 1024, in run
self._target(*self._args, **self._kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'bool' object is not callable
Linked PRs
- gh-145243
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 threading.py 开始,重点查看 Thread.start()、_bootstrap_inner() 和 run(),并在进行更改之前检查 gh-145243 中的相关工作。重现无效目标示例,并跟踪 worker 异常的格式化方式;完成的标准是 traceback 包含调用者的 myThread.start() 行,同时不影响正常的线程异常报告。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100