Skip to content

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

@ItsCubeTime

Description

@ItsCubeTime
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions