This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author fabioz
Recipients fabioz
Date 2019-06-26.18:04:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1561572282.64.0.920915319776.issue37416@roundup.psfhosted.org>
In-reply-to
Content
I'm attaching a snippet which shows the issue (i.e.: threading.main_thread() and threading.current_thread() should be the same and they aren't).

What I'd see as a possible solution is that the initial thread ident would be stored when the interpreter is initialized and then when threading is imported the first time it would get that indent to initialize the main thread instead of calling `threading._MainThread._set_ident` in the wrong thread.

I'm not sure if this is possible if CPython is embedded in some other C++ program, but it seems to be the correct approach when Python is called from the command line.

As a note, I found this when doing an attach to pid for the `pydevd` debugger where a thread is created to initialize the debugger (the issue on the debugger is reported at: https://github.com/microsoft/ptvsd/issues/1542).
History
Date User Action Args
2019-06-26 18:04:42fabiozsetrecipients: + fabioz
2019-06-26 18:04:42fabiozsetmessageid: <1561572282.64.0.920915319776.issue37416@roundup.psfhosted.org>
2019-06-26 18:04:42fabiozlinkissue37416 messages
2019-06-26 18:04:42fabiozcreate