-
Notifications
You must be signed in to change notification settings - Fork 92
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
thriftpy2.load fail #279
Comments
|
If I put the test structure before Template, will it succeed again? struct Test { struct Template { } ` Is there any way to solve this problem without changing the field name? |
We can load the thrift file in the second case, but the loaded types are still incomplete, it wouldn't work as you expected. We should raise an error in this case. For your specified scenario, you can change the field name |
Got it, thanks. |
Are there any other python keywords that cannot be generated? |
Any keyword should not be used here. |
我的thrift 文件如下:
`namespace go test.test.test
namespace py cg
struct Template {
1: optional string async
2: optional Test test
}
struct Test {
1: required string name
}
`
main函数如下:
`import os
import sys
import thriftpy2
if name == "main":
thriftpy2.parser.lexer.thrift_reserved_keywords = []
IDL_PATH="./test.thrift"
res = thriftpy2.load(IDL_PATH, module_name="cg_thrift")`
失败信息如下:
thriftpy2.parser.exc.ThriftParserError: No type found: 'Test', at line 6
如果把thrift 里面的 async 字段去掉就成功了
The text was updated successfully, but these errors were encountered: