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