diff --git a/third-party/thrift/src/thrift/compiler/generate/templates/py3/py3_types.pxd.mustache b/third-party/thrift/src/thrift/compiler/generate/templates/py3/py3_types.pxd.mustache index 02a04512b17c63..7af49bbe16211d 100644 --- a/third-party/thrift/src/thrift/compiler/generate/templates/py3/py3_types.pxd.mustache +++ b/third-party/thrift/src/thrift/compiler/generate/templates/py3/py3_types.pxd.mustache @@ -27,6 +27,7 @@ thrift-py3 cython users. {{> types/cimport_thrift }} cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, @@ -85,7 +86,8 @@ cdef class {{struct:name}}({{> types/python_struct_class}}): {{/type:iobufRef?}}{{/field:type}} {{/struct:py3_fields}}{{/struct:union?}} {{#struct:union?}} - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache({{struct:name}} self) {{/struct:union?}} diff --git a/third-party/thrift/src/thrift/compiler/generate/templates/py3/types.pyx.mustache b/third-party/thrift/src/thrift/compiler/generate/templates/py3/types.pyx.mustache index 3fe15bac1be7d7..2d8d8c8e496a05 100644 --- a/third-party/thrift/src/thrift/compiler/generate/templates/py3/types.pyx.mustache +++ b/third-party/thrift/src/thrift/compiler/generate/templates/py3/types.pyx.mustache @@ -363,8 +363,8 @@ cdef class {{struct:name}}(thrift.py3.types.Union): {{#struct:py3_fields}} @property - def {{field:py_name}}(self): - if self.type.value != {{field:key}}: + def {{field:py_name}}({{struct:name}} self not None): + if self.type_int != {{field:key}}: {{! TODO: python 3.10 adds some more fields to AttributeError, those should be added here at some point }} raise AttributeError(f'Union contains a value of type {self.type.name}, not {{field:py_name}}') return self.value @@ -374,13 +374,19 @@ cdef class {{struct:name}}(thrift.py3.types.Union): def __hash__({{struct:name}} self): return super().__hash__() + @property + def type({{struct:name}} self not None): + if self.py_type is None: + self.py_type = {{struct:name}}.Type(self.type_int) + return self.py_type + cdef _load_cache({{struct:name}} self): - self.type = {{struct:name}}.Type((deref(self.{{> types/cpp_obj}}).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self.{{> types/cpp_obj}}).getType() + if self.type_int == 0: # Empty self.value = None {{#struct:py3_fields}} - elif type == {{field:key}}: + elif self.type_int == {{field:key}}: {{#field:type}} {{> types/cython_union_getter}} {{/field:type}} diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/py3/gen-py3/module/types.pxd index ba581bcb729fdb..53542c09042c01 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-enum/out/py3/gen-py3/test/fixtures/enumstrict/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-enum/out/py3/gen-py3/test/fixtures/enumstrict/module/types.pxd index 36833f1609b983..a33fb8d5ee3706 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-enum/out/py3/gen-py3/test/fixtures/enumstrict/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-enum/out/py3/gen-py3/test/fixtures/enumstrict/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-stack-arguments/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-stack-arguments/out/py3/gen-py3/module/types.pxd index 4513ef19ddafed..7f867fbb5a166f 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-stack-arguments/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-stack-arguments/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/types.pxd index f1c84f06e899bf..b1a66bdb18d3be 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, @@ -98,7 +99,8 @@ cdef class MyDataItem(thrift.py3.types.Struct): cdef class MyUnion(thrift.py3.types.Union): cdef shared_ptr[_test_fixtures_basic_module_cbindings.cMyUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(MyUnion self) @@ -158,7 +160,8 @@ cdef class ReservedKeyword(thrift.py3.types.Struct): cdef class UnionToBeRenamed(thrift.py3.types.Union): cdef shared_ptr[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(UnionToBeRenamed self) diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/types.pyx b/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/types.pyx index ea7a1517eebd96..adfa0d386c2725 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/types.pyx +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/types.pyx @@ -574,26 +574,26 @@ cdef class MyUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def myEnum(self): - if self.type.value != 1: + def myEnum(MyUnion self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not myEnum') return self.value @property - def myStruct(self): - if self.type.value != 2: + def myStruct(MyUnion self not None): + if self.type_int != 2: raise AttributeError(f'Union contains a value of type {self.type.name}, not myStruct') return self.value @property - def myDataItem(self): - if self.type.value != 3: + def myDataItem(MyUnion self not None): + if self.type_int != 3: raise AttributeError(f'Union contains a value of type {self.type.name}, not myDataItem') return self.value @property - def floatSet(self): - if self.type.value != 4: + def floatSet(MyUnion self not None): + if self.type_int != 4: raise AttributeError(f'Union contains a value of type {self.type.name}, not floatSet') return self.value @@ -601,18 +601,24 @@ cdef class MyUnion(thrift.py3.types.Union): def __hash__(MyUnion self): return super().__hash__() + @property + def type(MyUnion self not None): + if self.py_type is None: + self.py_type = MyUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(MyUnion self): - self.type = MyUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: self.value = translate_cpp_enum_to_python(MyEnum, deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_myEnum()) - elif type == 2: + elif self.type_int == 2: self.value = MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_test_fixtures_basic_module_cbindings.cMyStruct](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_myStruct())) - elif type == 3: + elif self.type_int == 3: self.value = MyDataItem._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_test_fixtures_basic_module_cbindings.cMyDataItem](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_myDataItem())) - elif type == 4: + elif self.type_int == 4: self.value = Set__float__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_floatSet()) def __copy__(MyUnion self): @@ -1126,8 +1132,8 @@ cdef class UnionToBeRenamed(thrift.py3.types.Union): return __fbthrift_inst @property - def reserved_field(self): - if self.type.value != 1: + def reserved_field(UnionToBeRenamed self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not reserved_field') return self.value @@ -1135,12 +1141,18 @@ cdef class UnionToBeRenamed(thrift.py3.types.Union): def __hash__(UnionToBeRenamed self): return super().__hash__() + @property + def type(UnionToBeRenamed self not None): + if self.py_type is None: + self.py_type = UnionToBeRenamed.Type(self.type_int) + return self.py_type + cdef _load_cache(UnionToBeRenamed self): - self.type = UnionToBeRenamed.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_reserved_field() def __copy__(UnionToBeRenamed self): diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/types.pxd index e346bc85b6adfb..c9b9e18202a4e6 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, @@ -53,7 +54,8 @@ cdef extern from "thrift/compiler/test/fixtures/complex-union/gen-py3/module/typ cdef class ComplexUnion(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cComplexUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(ComplexUnion self) @@ -75,7 +77,8 @@ cdef class ComplexUnion(thrift.py3.types.Union): cdef class ListUnion(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cListUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(ListUnion self) @@ -93,7 +96,8 @@ cdef class ListUnion(thrift.py3.types.Union): cdef class DataUnion(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cDataUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(DataUnion self) @@ -124,7 +128,8 @@ cdef class Val(thrift.py3.types.Struct): cdef class ValUnion(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cValUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(ValUnion self) @@ -142,7 +147,8 @@ cdef class ValUnion(thrift.py3.types.Union): cdef class VirtualComplexUnion(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cVirtualComplexUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(VirtualComplexUnion self) @@ -170,7 +176,8 @@ cdef class NonCopyableStruct(thrift.py3.types.Struct): cdef class NonCopyableUnion(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cNonCopyableUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(NonCopyableUnion self) diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/types.pyx b/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/types.pyx index 0a04ced57cadbd..3113164d9c088c 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/types.pyx +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/types.pyx @@ -182,38 +182,38 @@ cdef class ComplexUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def intValue(self): - if self.type.value != 1: + def intValue(ComplexUnion self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not intValue') return self.value @property - def stringValue(self): - if self.type.value != 5: + def stringValue(ComplexUnion self not None): + if self.type_int != 5: raise AttributeError(f'Union contains a value of type {self.type.name}, not stringValue') return self.value @property - def intListValue(self): - if self.type.value != 2: + def intListValue(ComplexUnion self not None): + if self.type_int != 2: raise AttributeError(f'Union contains a value of type {self.type.name}, not intListValue') return self.value @property - def stringListValue(self): - if self.type.value != 3: + def stringListValue(ComplexUnion self not None): + if self.type_int != 3: raise AttributeError(f'Union contains a value of type {self.type.name}, not stringListValue') return self.value @property - def typedefValue(self): - if self.type.value != 9: + def typedefValue(ComplexUnion self not None): + if self.type_int != 9: raise AttributeError(f'Union contains a value of type {self.type.name}, not typedefValue') return self.value @property - def stringRef(self): - if self.type.value != 14: + def stringRef(ComplexUnion self not None): + if self.type_int != 14: raise AttributeError(f'Union contains a value of type {self.type.name}, not stringRef') return self.value @@ -221,22 +221,28 @@ cdef class ComplexUnion(thrift.py3.types.Union): def __hash__(ComplexUnion self): return super().__hash__() + @property + def type(ComplexUnion self not None): + if self.py_type is None: + self.py_type = ComplexUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(ComplexUnion self): - self.type = ComplexUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_intValue() - elif type == 5: + elif self.type_int == 5: self.value = bytes(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_stringValue()).decode('UTF-8') - elif type == 2: + elif self.type_int == 2: self.value = List__i64__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_intListValue()) - elif type == 3: + elif self.type_int == 3: self.value = List__string__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_stringListValue()) - elif type == 9: + elif self.type_int == 9: self.value = Map__i16_string__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_typedefValue()) - elif type == 14: + elif self.type_int == 14: if not deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_stringRef(): self.value = None else: @@ -368,14 +374,14 @@ cdef class ListUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def intListValue(self): - if self.type.value != 2: + def intListValue(ListUnion self not None): + if self.type_int != 2: raise AttributeError(f'Union contains a value of type {self.type.name}, not intListValue') return self.value @property - def stringListValue(self): - if self.type.value != 3: + def stringListValue(ListUnion self not None): + if self.type_int != 3: raise AttributeError(f'Union contains a value of type {self.type.name}, not stringListValue') return self.value @@ -383,14 +389,20 @@ cdef class ListUnion(thrift.py3.types.Union): def __hash__(ListUnion self): return super().__hash__() + @property + def type(ListUnion self not None): + if self.py_type is None: + self.py_type = ListUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(ListUnion self): - self.type = ListUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 2: + elif self.type_int == 2: self.value = List__i64__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_intListValue()) - elif type == 3: + elif self.type_int == 3: self.value = List__string__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_stringListValue()) def __copy__(ListUnion self): @@ -518,14 +530,14 @@ cdef class DataUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def binaryData(self): - if self.type.value != 1: + def binaryData(DataUnion self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not binaryData') return self.value @property - def stringData(self): - if self.type.value != 2: + def stringData(DataUnion self not None): + if self.type_int != 2: raise AttributeError(f'Union contains a value of type {self.type.name}, not stringData') return self.value @@ -533,14 +545,20 @@ cdef class DataUnion(thrift.py3.types.Union): def __hash__(DataUnion self): return super().__hash__() + @property + def type(DataUnion self not None): + if self.py_type is None: + self.py_type = DataUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(DataUnion self): - self.type = DataUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_binaryData() - elif type == 2: + elif self.type_int == 2: self.value = bytes(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_stringData()).decode('UTF-8') def __copy__(DataUnion self): @@ -801,14 +819,14 @@ cdef class ValUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def v1(self): - if self.type.value != 1: + def v1(ValUnion self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not v1') return self.value @property - def v2(self): - if self.type.value != 2: + def v2(ValUnion self not None): + if self.type_int != 2: raise AttributeError(f'Union contains a value of type {self.type.name}, not v2') return self.value @@ -816,14 +834,20 @@ cdef class ValUnion(thrift.py3.types.Union): def __hash__(ValUnion self): return super().__hash__() + @property + def type(ValUnion self not None): + if self.py_type is None: + self.py_type = ValUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(ValUnion self): - self.type = ValUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: self.value = Val._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_module_cbindings.cVal](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_v1())) - elif type == 2: + elif self.type_int == 2: self.value = Val._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_module_cbindings.cVal](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_v2())) def __copy__(ValUnion self): @@ -951,14 +975,14 @@ cdef class VirtualComplexUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def thingOne(self): - if self.type.value != 1: + def thingOne(VirtualComplexUnion self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not thingOne') return self.value @property - def thingTwo(self): - if self.type.value != 2: + def thingTwo(VirtualComplexUnion self not None): + if self.type_int != 2: raise AttributeError(f'Union contains a value of type {self.type.name}, not thingTwo') return self.value @@ -966,14 +990,20 @@ cdef class VirtualComplexUnion(thrift.py3.types.Union): def __hash__(VirtualComplexUnion self): return super().__hash__() + @property + def type(VirtualComplexUnion self not None): + if self.py_type is None: + self.py_type = VirtualComplexUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(VirtualComplexUnion self): - self.type = VirtualComplexUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: self.value = bytes(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_thingOne()).decode('UTF-8') - elif type == 2: + elif self.type_int == 2: self.value = bytes(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_thingTwo()).decode('UTF-8') def __copy__(VirtualComplexUnion self): @@ -1193,8 +1223,8 @@ cdef class NonCopyableUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def s(self): - if self.type.value != 1: + def s(NonCopyableUnion self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not s') return self.value @@ -1202,12 +1232,18 @@ cdef class NonCopyableUnion(thrift.py3.types.Union): def __hash__(NonCopyableUnion self): return super().__hash__() + @property + def type(NonCopyableUnion self not None): + if self.py_type is None: + self.py_type = NonCopyableUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(NonCopyableUnion self): - self.type = NonCopyableUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: self.value = NonCopyableStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_module_cbindings.cNonCopyableStruct](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_s())) def __copy__(NonCopyableUnion self): diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/types.pxd index ff75b290088468..3572b15a272e6a 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, @@ -130,7 +131,8 @@ cdef class struct4(thrift.py3.types.Struct): cdef class union1(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cunion1] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(union1 self) @@ -148,7 +150,8 @@ cdef class union1(thrift.py3.types.Union): cdef class union2(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cunion2] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(union2 self) diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/types.pyx b/third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/types.pyx index 5998be922b8afb..5f773860b02a75 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/types.pyx +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/types.pyx @@ -977,14 +977,14 @@ cdef class union1(thrift.py3.types.Union): return __fbthrift_inst @property - def i(self): - if self.type.value != 1: + def i(union1 self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not i') return self.value @property - def d(self): - if self.type.value != 2: + def d(union1 self not None): + if self.type_int != 2: raise AttributeError(f'Union contains a value of type {self.type.name}, not d') return self.value @@ -992,14 +992,20 @@ cdef class union1(thrift.py3.types.Union): def __hash__(union1 self): return super().__hash__() + @property + def type(union1 self not None): + if self.py_type is None: + self.py_type = union1.Type(self.type_int) + return self.py_type + cdef _load_cache(union1 self): - self.type = union1.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_i() - elif type == 2: + elif self.type_int == 2: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_d() def __copy__(union1 self): @@ -1171,26 +1177,26 @@ cdef class union2(thrift.py3.types.Union): return __fbthrift_inst @property - def i(self): - if self.type.value != 1: + def i(union2 self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not i') return self.value @property - def d(self): - if self.type.value != 2: + def d(union2 self not None): + if self.type_int != 2: raise AttributeError(f'Union contains a value of type {self.type.name}, not d') return self.value @property - def s(self): - if self.type.value != 3: + def s(union2 self not None): + if self.type_int != 3: raise AttributeError(f'Union contains a value of type {self.type.name}, not s') return self.value @property - def u(self): - if self.type.value != 4: + def u(union2 self not None): + if self.type_int != 4: raise AttributeError(f'Union contains a value of type {self.type.name}, not u') return self.value @@ -1198,18 +1204,24 @@ cdef class union2(thrift.py3.types.Union): def __hash__(union2 self): return super().__hash__() + @property + def type(union2 self not None): + if self.py_type is None: + self.py_type = union2.Type(self.type_int) + return self.py_type + cdef _load_cache(union2 self): - self.type = union2.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_i() - elif type == 2: + elif self.type_int == 2: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_d() - elif type == 3: + elif self.type_int == 3: self.value = struct1._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_module_cbindings.cstruct1](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_s())) - elif type == 4: + elif self.type_int == 4: self.value = union1._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_module_cbindings.cunion1](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_u())) def __copy__(union2 self): diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/types.pxd index abd6031fed5dab..81a3ba1bfb1f5e 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, @@ -62,7 +63,8 @@ cdef class Empty(thrift.py3.types.Struct): cdef class Nada(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cNada] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(Nada self) diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/types.pyx b/third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/types.pyx index fd103d09f07e8f..4baa766c84b138 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/types.pyx +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/types.pyx @@ -205,10 +205,16 @@ cdef class Nada(thrift.py3.types.Union): def __hash__(Nada self): return super().__hash__() + @property + def type(Nada self not None): + if self.py_type is None: + self.py_type = Nada.Type(self.type_int) + return self.py_type + cdef _load_cache(Nada self): - self.type = Nada.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None def __copy__(Nada self): diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/py3/gen-py3/test/fixtures/enums/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/py3/gen-py3/test/fixtures/enums/module/types.pxd index f01e0e32c0c80f..27e420dc5b762d 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/py3/gen-py3/test/fixtures/enums/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/py3/gen-py3/test/fixtures/enums/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/py3/gen-py3/module/types.pxd index 7b984f0cb716a0..53a51f88a81a49 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/includes/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/includes/types.pxd index 128daaf411a385..0573b812649ee2 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/includes/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/includes/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/matching_struct_names/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/matching_struct_names/types.pxd index 3efcf0662cae97..64308c01d2fd3e 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/matching_struct_names/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/matching_struct_names/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/module/types.pxd index a74c30cdf8c702..d7bfa371bd69ff 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/transitive/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/transitive/types.pxd index af3f3fc52a5a72..3f5b3d0ae2a793 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/transitive/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/transitive/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/includes/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/includes/types.pxd index 128daaf411a385..0573b812649ee2 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/includes/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/includes/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/module/types.pxd index a74c30cdf8c702..d7bfa371bd69ff 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/service/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/service/types.pxd index a6241df1b188a6..44020e23ecd42c 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/service/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/service/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/transitive/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/transitive/types.pxd index af3f3fc52a5a72..3f5b3d0ae2a793 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/transitive/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/transitive/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/inheritance/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/inheritance/out/py3/gen-py3/module/types.pxd index 20bf8dce7c39d1..09dd6a0a12b515 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/inheritance/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/inheritance/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/foo/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/foo/types.pxd index 810d75badf7169..ed4cf3ac678232 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/foo/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/foo/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/module/types.pxd index 5816f3a30f546b..9d217dae1fbb80 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/int_limits/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/int_limits/out/py3/gen-py3/module/types.pxd index a37f6cc5112d85..64eaf773991287 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/int_limits/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/int_limits/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/another_interactions/shared/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/another_interactions/shared/types.pxd index d8cb5889819d49..1ca9c987d11faf 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/another_interactions/shared/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/another_interactions/shared/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/interactions/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/interactions/module/types.pxd index 6b9c4f147d9f48..fb621de5c7d3cd 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/interactions/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/interactions/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/list/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/list/out/py3/gen-py3/module/types.pxd index b9d2a63905b3bf..a2b9daead433ad 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/list/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/list/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/includes/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/includes/types.pxd index 7cf93adf06a037..6751ae74b15aac 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/includes/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/includes/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/module/types.pxd index 71111decc5a9b7..484050dbbaa66d 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, @@ -108,7 +109,8 @@ cdef class MyStruct(thrift.py3.types.Struct): cdef class SimpleUnion(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cSimpleUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(SimpleUnion self) @@ -126,7 +128,8 @@ cdef class SimpleUnion(thrift.py3.types.Union): cdef class ComplexUnion(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cComplexUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(ComplexUnion self) @@ -439,7 +442,8 @@ cdef class FloatStruct(thrift.py3.types.Struct): cdef class FloatUnion(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cFloatUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(FloatUnion self) diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/module/types.pyx b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/module/types.pyx index 205e83c6de3e39..28e1138471aabc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/module/types.pyx +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/module/types.pyx @@ -737,14 +737,14 @@ cdef class SimpleUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def intValue(self): - if self.type.value != 7: + def intValue(SimpleUnion self not None): + if self.type_int != 7: raise AttributeError(f'Union contains a value of type {self.type.name}, not intValue') return self.value @property - def stringValue(self): - if self.type.value != 2: + def stringValue(SimpleUnion self not None): + if self.type_int != 2: raise AttributeError(f'Union contains a value of type {self.type.name}, not stringValue') return self.value @@ -752,14 +752,20 @@ cdef class SimpleUnion(thrift.py3.types.Union): def __hash__(SimpleUnion self): return super().__hash__() + @property + def type(SimpleUnion self not None): + if self.py_type is None: + self.py_type = SimpleUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(SimpleUnion self): - self.type = SimpleUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 7: + elif self.type_int == 7: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_intValue() - elif type == 2: + elif self.type_int == 2: self.value = bytes(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_stringValue()).decode('UTF-8') def __copy__(SimpleUnion self): @@ -1201,170 +1207,170 @@ cdef class ComplexUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def intValue(self): - if self.type.value != 1: + def intValue(ComplexUnion self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not intValue') return self.value @property - def opt_intValue(self): - if self.type.value != 201: + def opt_intValue(ComplexUnion self not None): + if self.type_int != 201: raise AttributeError(f'Union contains a value of type {self.type.name}, not opt_intValue') return self.value @property - def stringValue(self): - if self.type.value != 3: + def stringValue(ComplexUnion self not None): + if self.type_int != 3: raise AttributeError(f'Union contains a value of type {self.type.name}, not stringValue') return self.value @property - def opt_stringValue(self): - if self.type.value != 203: + def opt_stringValue(ComplexUnion self not None): + if self.type_int != 203: raise AttributeError(f'Union contains a value of type {self.type.name}, not opt_stringValue') return self.value @property - def intValue2(self): - if self.type.value != 4: + def intValue2(ComplexUnion self not None): + if self.type_int != 4: raise AttributeError(f'Union contains a value of type {self.type.name}, not intValue2') return self.value @property - def intValue3(self): - if self.type.value != 6: + def intValue3(ComplexUnion self not None): + if self.type_int != 6: raise AttributeError(f'Union contains a value of type {self.type.name}, not intValue3') return self.value @property - def doubelValue(self): - if self.type.value != 7: + def doubelValue(ComplexUnion self not None): + if self.type_int != 7: raise AttributeError(f'Union contains a value of type {self.type.name}, not doubelValue') return self.value @property - def boolValue(self): - if self.type.value != 8: + def boolValue(ComplexUnion self not None): + if self.type_int != 8: raise AttributeError(f'Union contains a value of type {self.type.name}, not boolValue') return self.value @property - def union_list(self): - if self.type.value != 9: + def union_list(ComplexUnion self not None): + if self.type_int != 9: raise AttributeError(f'Union contains a value of type {self.type.name}, not union_list') return self.value @property - def union_set(self): - if self.type.value != 10: + def union_set(ComplexUnion self not None): + if self.type_int != 10: raise AttributeError(f'Union contains a value of type {self.type.name}, not union_set') return self.value @property - def union_map(self): - if self.type.value != 11: + def union_map(ComplexUnion self not None): + if self.type_int != 11: raise AttributeError(f'Union contains a value of type {self.type.name}, not union_map') return self.value @property - def opt_union_map(self): - if self.type.value != 211: + def opt_union_map(ComplexUnion self not None): + if self.type_int != 211: raise AttributeError(f'Union contains a value of type {self.type.name}, not opt_union_map') return self.value @property - def enum_field(self): - if self.type.value != 12: + def enum_field(ComplexUnion self not None): + if self.type_int != 12: raise AttributeError(f'Union contains a value of type {self.type.name}, not enum_field') return self.value @property - def enum_container(self): - if self.type.value != 13: + def enum_container(ComplexUnion self not None): + if self.type_int != 13: raise AttributeError(f'Union contains a value of type {self.type.name}, not enum_container') return self.value @property - def a_struct(self): - if self.type.value != 14: + def a_struct(ComplexUnion self not None): + if self.type_int != 14: raise AttributeError(f'Union contains a value of type {self.type.name}, not a_struct') return self.value @property - def a_set_struct(self): - if self.type.value != 15: + def a_set_struct(ComplexUnion self not None): + if self.type_int != 15: raise AttributeError(f'Union contains a value of type {self.type.name}, not a_set_struct') return self.value @property - def a_union(self): - if self.type.value != 16: + def a_union(ComplexUnion self not None): + if self.type_int != 16: raise AttributeError(f'Union contains a value of type {self.type.name}, not a_union') return self.value @property - def opt_a_union(self): - if self.type.value != 216: + def opt_a_union(ComplexUnion self not None): + if self.type_int != 216: raise AttributeError(f'Union contains a value of type {self.type.name}, not opt_a_union') return self.value @property - def a_union_list(self): - if self.type.value != 17: + def a_union_list(ComplexUnion self not None): + if self.type_int != 17: raise AttributeError(f'Union contains a value of type {self.type.name}, not a_union_list') return self.value @property - def a_union_typedef(self): - if self.type.value != 18: + def a_union_typedef(ComplexUnion self not None): + if self.type_int != 18: raise AttributeError(f'Union contains a value of type {self.type.name}, not a_union_typedef') return self.value @property - def a_union_typedef_list(self): - if self.type.value != 19: + def a_union_typedef_list(ComplexUnion self not None): + if self.type_int != 19: raise AttributeError(f'Union contains a value of type {self.type.name}, not a_union_typedef_list') return self.value @property - def MyBinaryField(self): - if self.type.value != 20: + def MyBinaryField(ComplexUnion self not None): + if self.type_int != 20: raise AttributeError(f'Union contains a value of type {self.type.name}, not MyBinaryField') return self.value @property - def MyBinaryField2(self): - if self.type.value != 21: + def MyBinaryField2(ComplexUnion self not None): + if self.type_int != 21: raise AttributeError(f'Union contains a value of type {self.type.name}, not MyBinaryField2') return self.value @property - def MyBinaryListField4(self): - if self.type.value != 23: + def MyBinaryListField4(ComplexUnion self not None): + if self.type_int != 23: raise AttributeError(f'Union contains a value of type {self.type.name}, not MyBinaryListField4') return self.value @property - def ref_field(self): - if self.type.value != 24: + def ref_field(ComplexUnion self not None): + if self.type_int != 24: raise AttributeError(f'Union contains a value of type {self.type.name}, not ref_field') return self.value @property - def ref_field2(self): - if self.type.value != 25: + def ref_field2(ComplexUnion self not None): + if self.type_int != 25: raise AttributeError(f'Union contains a value of type {self.type.name}, not ref_field2') return self.value @property - def excp_field(self): - if self.type.value != 26: + def excp_field(ComplexUnion self not None): + if self.type_int != 26: raise AttributeError(f'Union contains a value of type {self.type.name}, not excp_field') return self.value @property - def MyCustomField(self): - if self.type.value != 27: + def MyCustomField(ComplexUnion self not None): + if self.type_int != 27: raise AttributeError(f'Union contains a value of type {self.type.name}, not MyCustomField') return self.value @@ -1372,74 +1378,80 @@ cdef class ComplexUnion(thrift.py3.types.Union): def __hash__(ComplexUnion self): return super().__hash__() + @property + def type(ComplexUnion self not None): + if self.py_type is None: + self.py_type = ComplexUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(ComplexUnion self): - self.type = ComplexUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_intValue() - elif type == 201: + elif self.type_int == 201: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_opt_intValue() - elif type == 3: + elif self.type_int == 3: self.value = bytes(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_stringValue()).decode('UTF-8') - elif type == 203: + elif self.type_int == 203: self.value = bytes(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_opt_stringValue()).decode('UTF-8') - elif type == 4: + elif self.type_int == 4: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_intValue2() - elif type == 6: + elif self.type_int == 6: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_intValue3() - elif type == 7: + elif self.type_int == 7: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_doubelValue() - elif type == 8: + elif self.type_int == 8: self.value = (deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_boolValue()) - elif type == 9: + elif self.type_int == 9: self.value = List__i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_union_list()) - elif type == 10: + elif self.type_int == 10: self.value = Set__i64__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_union_set()) - elif type == 11: + elif self.type_int == 11: self.value = Map__string_i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_union_map()) - elif type == 211: + elif self.type_int == 211: self.value = Map__string_i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_opt_union_map()) - elif type == 12: + elif self.type_int == 12: self.value = translate_cpp_enum_to_python(MyEnumA, deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_enum_field()) - elif type == 13: + elif self.type_int == 13: self.value = List__MyEnumA__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_enum_container()) - elif type == 14: + elif self.type_int == 14: self.value = MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_module_cbindings.cMyStruct](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_a_struct())) - elif type == 15: + elif self.type_int == 15: self.value = Set__MyStruct__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_a_set_struct()) - elif type == 16: + elif self.type_int == 16: self.value = SimpleUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_module_cbindings.cSimpleUnion](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_a_union())) - elif type == 216: + elif self.type_int == 216: self.value = SimpleUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_module_cbindings.cSimpleUnion](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_opt_a_union())) - elif type == 17: + elif self.type_int == 17: self.value = List__SimpleUnion__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_a_union_list()) - elif type == 18: + elif self.type_int == 18: self.value = Set__SimpleUnion__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_a_union_typedef()) - elif type == 19: + elif self.type_int == 19: self.value = List__Set__SimpleUnion__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_a_union_typedef_list()) - elif type == 20: + elif self.type_int == 20: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_MyBinaryField() - elif type == 21: + elif self.type_int == 21: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_MyBinaryField2() - elif type == 23: + elif self.type_int == 23: self.value = List__binary__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_MyBinaryListField4()) - elif type == 24: + elif self.type_int == 24: if not deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_ref_field(): self.value = None else: self.value = MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_ref_field()), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) - elif type == 25: + elif self.type_int == 25: if not deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_ref_field2(): self.value = None else: self.value = MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_ref_field2()), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) - elif type == 26: + elif self.type_int == 26: self.value = AnException._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_module_cbindings.cAnException](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_excp_field())) - elif type == 27: + elif self.type_int == 27: self.value = _fbthrift_iobuf.from_unique_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_MyCustomField().clone()) def __copy__(ComplexUnion self): @@ -3436,14 +3448,14 @@ cdef class FloatUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def floatSide(self): - if self.type.value != 1: + def floatSide(FloatUnion self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not floatSide') return self.value @property - def doubleSide(self): - if self.type.value != 2: + def doubleSide(FloatUnion self not None): + if self.type_int != 2: raise AttributeError(f'Union contains a value of type {self.type.name}, not doubleSide') return self.value @@ -3451,14 +3463,20 @@ cdef class FloatUnion(thrift.py3.types.Union): def __hash__(FloatUnion self): return super().__hash__() + @property + def type(FloatUnion self not None): + if self.py_type is None: + self.py_type = FloatUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(FloatUnion self): - self.type = FloatUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_floatSide() - elif type == 2: + elif self.type_int == 2: self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_doubleSide() def __copy__(FloatUnion self): diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/mixin/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/mixin/out/py3/gen-py3/module/types.pxd index b4ef2530c7a865..aec05d8045d80b 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/mixin/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/mixin/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3/gen-py3/my/namespacing/test/module/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3/gen-py3/my/namespacing/test/module/module/types.pxd index be63a14d01d7e3..647f5372ef813d 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3/gen-py3/my/namespacing/test/module/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3/gen-py3/my/namespacing/test/module/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3_emptyns/gen-py3/emptyns/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3_emptyns/gen-py3/emptyns/types.pxd index e83284ef47fd9e..f4b0626c03f15d 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3_emptyns/gen-py3/emptyns/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3_emptyns/gen-py3/emptyns/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/extend/test/extend/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/extend/test/extend/types.pxd index 35cc7287ca432e..84eb1d43cde119 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/extend/test/extend/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/extend/test/extend/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/test/hsmodule/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/test/hsmodule/types.pxd index 5e08cb953c22e7..06cde73a0c1691 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/test/hsmodule/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/test/hsmodule/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package/out/py3/gen-py3/test/namespace_from_package/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package/out/py3/gen-py3/test/namespace_from_package/module/types.pxd index 7e1c6789256383..6b75922eb7fb01 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package/out/py3/gen-py3/test/namespace_from_package/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package/out/py3/gen-py3/test/namespace_from_package/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/py3/gen-py3/test/namespace_from_package_without_module_name/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/py3/gen-py3/test/namespace_from_package_without_module_name/module/types.pxd index 73d7b522d28c0d..d1fabef5a8d318 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/py3/gen-py3/test/namespace_from_package_without_module_name/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/py3/gen-py3/test/namespace_from_package_without_module_name/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/optionals/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/optionals/out/py3/gen-py3/module/types.pxd index b4253657b5688c..d7eb6eeeb719ea 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/optionals/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/optionals/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/params/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/params/out/py3/gen-py3/module/types.pxd index 9022e546db3668..adf627dc673873 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/params/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/params/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/py3/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/py3/out/py3/gen-py3/module/types.pxd index 8b3bb7274db3c9..4bb953e86c28c7 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/py3/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/py3/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, @@ -122,7 +123,8 @@ cdef class ComplexStruct(thrift.py3.types.Struct): cdef class BinaryUnion(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cBinaryUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(BinaryUnion self) diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/py3/out/py3/gen-py3/module/types.pyx b/third-party/thrift/src/thrift/compiler/test/fixtures/py3/out/py3/gen-py3/module/types.pyx index 195dc692f93bb7..305ce508241fc3 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/py3/out/py3/gen-py3/module/types.pyx +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/py3/out/py3/gen-py3/module/types.pyx @@ -862,8 +862,8 @@ cdef class BinaryUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def iobuf_val(self): - if self.type.value != 1: + def iobuf_val(BinaryUnion self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not iobuf_val') return self.value @@ -871,12 +871,18 @@ cdef class BinaryUnion(thrift.py3.types.Union): def __hash__(BinaryUnion self): return super().__hash__() + @property + def type(BinaryUnion self not None): + if self.py_type is None: + self.py_type = BinaryUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(BinaryUnion self): - self.type = BinaryUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: self.value = _fbthrift_iobuf.from_unique_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_iobuf_val().clone()) def __copy__(BinaryUnion self): diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/py3/out/py3_empty/gen-py3/empty/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/py3/out/py3_empty/gen-py3/empty/types.pxd index aa39b768fcd353..ee5d30ef3baeab 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/py3/out/py3_empty/gen-py3/empty/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/py3/out/py3_empty/gen-py3/empty/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module0/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module0/types.pxd index 63c0be07a66741..590a1038b46201 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module0/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module0/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module1/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module1/types.pxd index 6045ba75ba8088..9639f35d61844d 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module1/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module1/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module2/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module2/types.pxd index ee2a02efe1a5a1..14f5e33adab92c 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module2/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module2/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/refs/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/refs/out/py3/gen-py3/module/types.pxd index 82fe60f8f71d31..ef2c7d654683cb 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/refs/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/refs/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, @@ -53,7 +54,8 @@ cdef extern from "thrift/compiler/test/fixtures/refs/gen-py3/module/types.h": cdef class MyUnion(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cMyUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(MyUnion self) @@ -71,7 +73,8 @@ cdef class MyUnion(thrift.py3.types.Union): cdef class NonTriviallyDestructibleUnion(thrift.py3.types.Union): cdef shared_ptr[_module_cbindings.cNonTriviallyDestructibleUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE - cdef readonly object type + cdef int64_t type_int + cdef object py_type cdef readonly object value cdef _load_cache(NonTriviallyDestructibleUnion self) diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/refs/out/py3/gen-py3/module/types.pyx b/third-party/thrift/src/thrift/compiler/test/fixtures/refs/out/py3/gen-py3/module/types.pyx index 7c38258fca4ef0..039e142b930c25 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/refs/out/py3/gen-py3/module/types.pyx +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/refs/out/py3/gen-py3/module/types.pyx @@ -142,14 +142,14 @@ cdef class MyUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def anInteger(self): - if self.type.value != 1: + def anInteger(MyUnion self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not anInteger') return self.value @property - def aString(self): - if self.type.value != 2: + def aString(MyUnion self not None): + if self.type_int != 2: raise AttributeError(f'Union contains a value of type {self.type.name}, not aString') return self.value @@ -157,18 +157,24 @@ cdef class MyUnion(thrift.py3.types.Union): def __hash__(MyUnion self): return super().__hash__() + @property + def type(MyUnion self not None): + if self.py_type is None: + self.py_type = MyUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(MyUnion self): - self.type = MyUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: if not deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_anInteger(): self.value = None else: self.value = cint32_t._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_anInteger()), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) - elif type == 2: + elif self.type_int == 2: if not deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_aString(): self.value = None else: @@ -300,8 +306,8 @@ cdef class NonTriviallyDestructibleUnion(thrift.py3.types.Union): return __fbthrift_inst @property - def int_field(self): - if self.type.value != 1: + def int_field(NonTriviallyDestructibleUnion self not None): + if self.type_int != 1: raise AttributeError(f'Union contains a value of type {self.type.name}, not int_field') return self.value @@ -309,12 +315,18 @@ cdef class NonTriviallyDestructibleUnion(thrift.py3.types.Union): def __hash__(NonTriviallyDestructibleUnion self): return super().__hash__() + @property + def type(NonTriviallyDestructibleUnion self not None): + if self.py_type is None: + self.py_type = NonTriviallyDestructibleUnion.Type(self.type_int) + return self.py_type + cdef _load_cache(NonTriviallyDestructibleUnion self): - self.type = NonTriviallyDestructibleUnion.Type((deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType())) - cdef int type = self.type.value - if type == 0: # Empty + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + if self.type_int == 0: # Empty self.value = None - elif type == 1: + elif self.type_int == 1: if not deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_int_field(): self.value = None else: diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/req-opt/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/req-opt/out/py3/gen-py3/module/types.pxd index f7446baa2f3fa0..41ccef2fe3239b 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/req-opt/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/req-opt/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/py3/gen-py3/module/types.pxd index e5964b01ccc683..53226d527cd2d2 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/single_file_service/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/single_file_service/out/py3/gen-py3/module/types.pxd index a802e6b0f16eec..8b4433676a1a46 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/single_file_service/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/single_file_service/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/single_file_service/out/py3_module_structs/gen-py3/module_structs/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/single_file_service/out/py3_module_structs/gen-py3/module_structs/types.pxd index 0bab7312274a59..dff72bec9ace35 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/single_file_service/out/py3_module_structs/gen-py3/module_structs/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/single_file_service/out/py3_module_structs/gen-py3/module_structs/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/sink/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/sink/out/py3/gen-py3/module/types.pxd index 95d2432f6a2536..df169d7215333a 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/sink/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/sink/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/stream/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/stream/out/py3/gen-py3/module/types.pxd index 957b05a8690152..eea98c5821bf95 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/stream/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/stream/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/templated-deserialize/out/py3/gen-py3/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/templated-deserialize/out/py3/gen-py3/module/types.pxd index ab4eceea4c88df..c33522a7e90467 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/templated-deserialize/out/py3/gen-py3/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/templated-deserialize/out/py3/gen-py3/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/a/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/a/types.pxd index 8c45ed23d8c195..6bb72d558c6c60 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/a/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/a/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/b/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/b/types.pxd index b825855a856c8b..72fa12eaf138c7 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/b/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/b/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/c/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/c/types.pxd index 91b07d877eb4f2..11c087c3993e57 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/c/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/c/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/b/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/b/types.pxd index b825855a856c8b..72fa12eaf138c7 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/b/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/b/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/c/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/c/types.pxd index 91b07d877eb4f2..11c087c3993e57 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/c/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/c/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/s/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/s/types.pxd index 0b5da096e2f6d7..37a17953df8082 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/s/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/s/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/included/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/included/types.pxd index c4db327aba33dc..b80721f50e3698 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/included/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/included/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox, diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pxd b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pxd index f3155d09ea5381..630950ffb20bfc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pxd +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pxd @@ -35,6 +35,7 @@ from thrift.py3.types cimport ( from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata cimport thrift.py3.exceptions cimport thrift.py3.types +from libc.stdint cimport int64_t from thrift.python.common cimport ( RpcOptions as __RpcOptions, MetadataBox as __MetadataBox,