Thriftpy / thriftpy2

Pure python approach of Apache Thrift.
MIT License
562 stars 89 forks source link

AttributeError: '_thread._local' obiect has no attribute 'thrift_stack' #266

Closed truebit closed 2 months ago

truebit commented 2 months ago

The #264 PR would change the behaviour of the parser module, it would invoke error AttributeError: '_thread._local' obiect has no attribute 'thrift_stack' when using it with example code:

>>> from thriftpy2.parser.parser import parse
>>> note_thrift = parse("path/to/note. thrift",module_name='abc_thrift', enable_cache=False)
aisk commented 2 months ago

I found that executing only the codes you provided in a sub-thread will cause the exception, because we didn't initialize the thread local in sub-threads. This should be fixed by #267, and we have released an RC version 0.5.1rc1. Can you try to install this version and see if the error is resolved?

truebit commented 2 months ago

We had downgraded to 0.4.20 to fix this issue. I will try the 0.5.1rc1 to reproduce it. Thanks for the quick responding.

truebit commented 2 months ago

version 0.5.1rc1 fixed my issue