Thriftpy / thriftpy2

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

Calling `parse_fp()` in v0.5.1 results in "AttributeError: '_thread._local' object has no attribute 'thrift_cache'" #281

Open rlratzel opened 1 month ago

rlratzel commented 1 month ago

After installing thriftpy2 0.5.1, the following traceback was encountered when calling parse_fp():

...
 /opt/conda/envs/test/lib/python3.9/site-packages/cugraph_service_client/cugraph_service_thrift.py:262: in <module>
    spec = thriftpy2.load_fp(io.StringIO(cugraph_thrift_spec), module_name="cugraph_thrift")
/opt/conda/envs/test/lib/python3.9/site-packages/thriftpy2/parser/__init__.py:171: in load_fp
    thrift = parse_fp(source, module_name)
/opt/conda/envs/test/lib/python3.9/site-packages/thriftpy2/parser/parser.py:628: in parse_fp
    if enable_cache and module_name in threadlocal.thrift_cache:
E   AttributeError: '_thread._local' object has no attribute 'thrift_cache'

Perhaps the change to parse() done in this PR should also be applied to parse_fp()?

aisk commented 4 weeks ago

Yes, it's my fault, I thought parse is using parse_fp under the hood, but it's not.

aisk commented 3 weeks ago

Released a beta version v0.5.2b1 which contains the fix.

tyong920 commented 3 weeks ago

Bitten by the same bug, Pls yank version v0.5.0 and v0.5.1.

Appreciated!

aisk commented 3 weeks ago

I released v0.5.2b2 which also contains a bugfix that some user needs in a hurry. I will release v0.5.2 tomorrow if no one report bug about it. I notified some users to test the v0.5.2b2.

Yank v0.5.0 and v0.5.1 is not a good choice because I see some user are already using it and pined the version to 0.5.

aisk commented 2 weeks ago

v0.5.2 just released.