flatbuffers
flatbuffers copied to clipboard
[Python][23.5.26] Type annotation for string fields incorrect
When a field in a schema is declared as string, the Python code generator outputs a function declaration like:
def MyField(self) -> Optional[str]:
However, the underlying implementation has always returned a bytes object for such getters. This means that the annotation is incorrect, and should be changed to say Optional[bytes].
This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.
not-stale
I think the code that needs to be fixed is here: https://github.com/google/flatbuffers/blob/5ba80c24e09ab4a34c14a8dae225eb222b58ebe7/src/idl_gen_python.cpp#L1081 and here: https://github.com/google/flatbuffers/blob/5ba80c24e09ab4a34c14a8dae225eb222b58ebe7/src/idl_gen_python.cpp#L1128
This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.
not-stale