Message399659
So first, don't import from threads. It's non-deterministic as you have seen. You should do all imports **before** you start running multi-threaded code if multiple threads are going to access the
Second, tossing in pickle is just asking for more trouble. 😉
The key thing to know is the master copy of a module is kept in `sys.modules`. But classes keep a reference to the module they were loaded from, not what `sys.modules` happens to have at that moment. So due to threading indeterminism it's quite possible to end up unpickling in such a way that the module that eventually ends up in `sys.modules` is not what your unpickled class is referencing.
As such, I'm closing as "wont fix". |
|
Date |
User |
Action |
Args |
2021-08-16 16:35:41 | brett.cannon | set | recipients:
+ brett.cannon, ncoghlan, steven.daprano, eric.snow, George3d6 |
2021-08-16 16:35:41 | brett.cannon | set | messageid: <1629131741.18.0.710306407231.issue44916@roundup.psfhosted.org> |
2021-08-16 16:35:41 | brett.cannon | link | issue44916 messages |
2021-08-16 16:35:41 | brett.cannon | create | |
|