Message346653
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). |
|
Date |
User |
Action |
Args |
2019-06-26 18:04:42 | fabioz | set | recipients:
+ fabioz |
2019-06-26 18:04:42 | fabioz | set | messageid: <1561572282.64.0.920915319776.issue37416@roundup.psfhosted.org> |
2019-06-26 18:04:42 | fabioz | link | issue37416 messages |
2019-06-26 18:04:42 | fabioz | create | |
|