-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: '_thread._local' object has no attribute 'seen_classes' #190
Comments
Here's an example: import asyncio
from dataclasses import dataclass
from marshmallow_dataclass import class_schema
@dataclass
class Foo:
bar: int
baz: float
async def main():
loop = asyncio.get_running_loop()
loop.run_in_executor(None, lambda: class_schema(Foo)())
if __name__ == "__main__":
asyncio.run(main()) And the full traceback:
Asyncio is probably not needed to reproduce but just multiple threads. I used it here since my application that is crashing is using |
This is specifically a problem with thread pool executors. Following this post if I bootstrap |
Pretty certain I broke it when I was working on it and put the initialization at the top level instead of in WRT asyncio, I initially thought about using |
I think using |
Thread-local variables must be initialized at runtime (i.e. in their own thread), not globally at import time. Fixes lovasoa#190
I also encounter this issue. I hope this is solved soon. |
Thread-local variables must be initialized at runtime (i.e. in their own thread), not globally at import time. Fixes #190
It looks like the fix in #191 didn't actually do the trick. I still get the same issue with the 8.5.7 release. I think whatever solution is found to work for this problem should probably get a unit test added to avoid a regression. |
Ok, someone please step in, and I'll add you as a collaborator to the repo. I have just been merging PRs recently, which have each introduced new bugs, and I don't really have the time to maintain this currently. |
In the meantime could you please reopen this issue until it has been resolved? |
I've just tried to reproduce this, without success. If it's still an issue, can someone let me know what python version and requirements.txt demonstrate the problem? I have noticed #229, but, while related, that seems to be different than what's going on here. #229 is only excercised when |
In my case, the error no longer occurred. |
Looks resolved to me as well. |
Great! Closing (until next time 😉). |
The latest release is raising the above error on invocation of
class_schema
. I'm working on putting together a minimal example to demonstrate this but in the meantime it's breaking CI for me.The text was updated successfully, but these errors were encountered: