python / python/cpython

Exception stacktrace generated from passing an invalid `target` to `Thread(...).start()` does not include the line calling the `start()` method

Open
#145,242 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with threading.py, especially Thread.start(), _bootstrap_inner(), and run(), and inspect the linked work in gh-145243 before making changes. Reproduce the invalid-target example and trace how the worker exception is formatted; done means the traceback includes the caller's myThread.start() line without regressing normal thread exception reporting.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.