Skip to content

Commit 3d11017

Browse files
ahilgerfacebook-github-bot
authored andcommitted
stop allowing mutation through convert_to_cpp backdoor II
Summary: This diff closes the cpp mutation backdoor by copying the underlying cpp object in the `X_convert_to_cpp` API. In the edge case where the struct is `cpp.noncopyable`, we serialize-deserialize a new version. Reviewed By: prakashgayasen Differential Revision: D72988992 fbshipit-source-id: fdcafd3c80d1d4eeadbe7c59d986e2a189ee45da
1 parent 80a9f82 commit 3d11017

File tree

83 files changed

+1201
-237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1201
-237
lines changed

Diff for: third-party/thrift/src/thrift/compiler/generate/templates/py3/converter.pyx.mustache

+24-4
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818

1919
{{> common/auto_generated_py}}
2020

21+
from libcpp.memory cimport make_shared, unique_ptr
22+
from cython.operator cimport dereference as deref, address
23+
from libcpp.utility cimport move as cmove
2124
{{^program:gen_py3_cython?}}
22-
from libcpp.memory cimport make_shared
23-
from cython.operator cimport dereference as deref
2425
from thrift.py3.types cimport const_pointer_cast
2526
cimport {{#program:py3Namespaces}}{{value}}.{{/program:py3Namespaces}}{{program:name}}.thrift_converter as {{!
2627
}}_{{#program:py3Namespaces}}{{value}}_{{/program:py3Namespaces}}{{program:name}}_thrift_converter
2728
{{#program:gen_legacy_container_converters?}}
28-
from libcpp.utility cimport move as cmove
2929

3030
{{#program:inplace_migrate?}}
3131
cimport {{#program:py3Namespaces}}{{value}}.{{/program:py3Namespaces}}{{program:name}}.types as {{> types/current_module_types}}
@@ -42,6 +42,12 @@ cimport {{#includeNamespace}}{{value}}.{{/includeNamespace}}thrift_converter as
4242
{{/program:gen_py3_cython?}}
4343
{{#program:gen_py3_cython?}}
4444
cimport {{#program:py3Namespaces}}{{value}}.{{/program:py3Namespaces}}{{program:name}}.types as _fbthrift_ctypes
45+
from thrift.py3.serializer cimport (
46+
cserialize as __cserialize,
47+
cdeserialize as __cdeserialize,
48+
)
49+
from thrift.python.protocol cimport Protocol
50+
cimport folly.iobuf as _folly__iobuf
4551
{{/program:gen_py3_cython?}}
4652
{{#program:inplace_migrate?}}
4753
{{^program:gen_legacy_container_converters?}}
@@ -67,7 +73,21 @@ cdef shared_ptr[_fbthrift_cbindings.{{> types/c_struct }}] {{struct:name}}_conve
6773
)
6874
{{/program:gen_py3_cython?}}
6975
{{#program:gen_py3_cython?}}
70-
return (<_fbthrift_ctypes.{{struct:name}}?>inst).{{> types/cpp_obj}}
76+
{{^struct:cpp_noncopyable?}}
77+
return make_shared[_fbthrift_cbindings.{{> types/c_struct}}](deref(
78+
(<_fbthrift_ctypes.{{struct:name}}?>inst).{{> types/cpp_obj}}
79+
))
80+
{{/struct:cpp_noncopyable?}}{{#struct:cpp_noncopyable?}}
81+
cdef unique_ptr[_folly__iobuf.cIOBuf] _fbthrift__iobuf = cmove(
82+
__cserialize(
83+
(<_fbthrift_ctypes.{{struct:name}}?>inst).{{> types/cpp_obj }}.get(),
84+
Protocol.BINARY,
85+
)
86+
)
87+
cdef shared_ptr[_fbthrift_cbindings.{{> types/c_struct }}] _fbthrift__out = make_shared[_fbthrift_cbindings.{{> types/c_struct }}]()
88+
__cdeserialize(_fbthrift__iobuf.get(), _fbthrift__out.get(), Protocol.BINARY)
89+
return cmove(_fbthrift__out)
90+
{{/struct:cpp_noncopyable?}}
7191

7292
{{/program:gen_py3_cython?}}
7393
{{! direct replacement for ._fbthrift_create }}

Diff for: third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/py3/gen-py3/module/converter.pyx

+15-2
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,30 @@
66
# @generated
77
#
88

9+
from libcpp.memory cimport make_shared, unique_ptr
10+
from cython.operator cimport dereference as deref, address
11+
from libcpp.utility cimport move as cmove
912
cimport module.types as _fbthrift_ctypes
13+
from thrift.py3.serializer cimport (
14+
cserialize as __cserialize,
15+
cdeserialize as __cdeserialize,
16+
)
17+
from thrift.python.protocol cimport Protocol
18+
cimport folly.iobuf as _folly__iobuf
1019

1120

1221
cdef shared_ptr[_fbthrift_cbindings.cMyStructNestedAnnotation] MyStructNestedAnnotation_convert_to_cpp(object inst) except*:
13-
return (<_fbthrift_ctypes.MyStructNestedAnnotation?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
22+
return make_shared[_fbthrift_cbindings.cMyStructNestedAnnotation](deref(
23+
(<_fbthrift_ctypes.MyStructNestedAnnotation?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
24+
))
1425

1526
cdef object MyStructNestedAnnotation_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyStructNestedAnnotation]& c_struct):
1627
return _fbthrift_ctypes.MyStructNestedAnnotation._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
1728

1829
cdef shared_ptr[_fbthrift_cbindings.cSecretStruct] SecretStruct_convert_to_cpp(object inst) except*:
19-
return (<_fbthrift_ctypes.SecretStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
30+
return make_shared[_fbthrift_cbindings.cSecretStruct](deref(
31+
(<_fbthrift_ctypes.SecretStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
32+
))
2033

2134
cdef object SecretStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cSecretStruct]& c_struct):
2235
return _fbthrift_ctypes.SecretStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)

Diff for: third-party/thrift/src/thrift/compiler/test/fixtures/basic-enum/out/py3/gen-py3/test/fixtures/enumstrict/module/converter.pyx

+12-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@
66
# @generated
77
#
88

9+
from libcpp.memory cimport make_shared, unique_ptr
10+
from cython.operator cimport dereference as deref, address
11+
from libcpp.utility cimport move as cmove
912
cimport test.fixtures.enumstrict.module.types as _fbthrift_ctypes
13+
from thrift.py3.serializer cimport (
14+
cserialize as __cserialize,
15+
cdeserialize as __cdeserialize,
16+
)
17+
from thrift.python.protocol cimport Protocol
18+
cimport folly.iobuf as _folly__iobuf
1019

1120

1221
cdef shared_ptr[_fbthrift_cbindings.cMyStruct] MyStruct_convert_to_cpp(object inst) except*:
13-
return (<_fbthrift_ctypes.MyStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
22+
return make_shared[_fbthrift_cbindings.cMyStruct](deref(
23+
(<_fbthrift_ctypes.MyStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
24+
))
1425

1526
cdef object MyStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyStruct]& c_struct):
1627
return _fbthrift_ctypes.MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)

Diff for: third-party/thrift/src/thrift/compiler/test/fixtures/basic-stack-arguments/out/py3/gen-py3/module/converter.pyx

+12-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@
66
# @generated
77
#
88

9+
from libcpp.memory cimport make_shared, unique_ptr
10+
from cython.operator cimport dereference as deref, address
11+
from libcpp.utility cimport move as cmove
912
cimport module.types as _fbthrift_ctypes
13+
from thrift.py3.serializer cimport (
14+
cserialize as __cserialize,
15+
cdeserialize as __cdeserialize,
16+
)
17+
from thrift.python.protocol cimport Protocol
18+
cimport folly.iobuf as _folly__iobuf
1019

1120

1221
cdef shared_ptr[_fbthrift_cbindings.cMyStruct] MyStruct_convert_to_cpp(object inst) except*:
13-
return (<_fbthrift_ctypes.MyStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
22+
return make_shared[_fbthrift_cbindings.cMyStruct](deref(
23+
(<_fbthrift_ctypes.MyStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
24+
))
1425

1526
cdef object MyStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyStruct]& c_struct):
1627
return _fbthrift_ctypes.MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)

Diff for: third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/converter.pyx

+33-8
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,78 @@
66
# @generated
77
#
88

9+
from libcpp.memory cimport make_shared, unique_ptr
10+
from cython.operator cimport dereference as deref, address
11+
from libcpp.utility cimport move as cmove
912
cimport test.fixtures.basic.module.types as _fbthrift_ctypes
13+
from thrift.py3.serializer cimport (
14+
cserialize as __cserialize,
15+
cdeserialize as __cdeserialize,
16+
)
17+
from thrift.python.protocol cimport Protocol
18+
cimport folly.iobuf as _folly__iobuf
1019

1120

1221
cdef shared_ptr[_fbthrift_cbindings.cMyStruct] MyStruct_convert_to_cpp(object inst) except*:
13-
return (<_fbthrift_ctypes.MyStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
22+
return make_shared[_fbthrift_cbindings.cMyStruct](deref(
23+
(<_fbthrift_ctypes.MyStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
24+
))
1425

1526
cdef object MyStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyStruct]& c_struct):
1627
return _fbthrift_ctypes.MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
1728

1829
cdef shared_ptr[_fbthrift_cbindings.cContainers] Containers_convert_to_cpp(object inst) except*:
19-
return (<_fbthrift_ctypes.Containers?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
30+
return make_shared[_fbthrift_cbindings.cContainers](deref(
31+
(<_fbthrift_ctypes.Containers?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
32+
))
2033

2134
cdef object Containers_from_cpp(const shared_ptr[_fbthrift_cbindings.cContainers]& c_struct):
2235
return _fbthrift_ctypes.Containers._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
2336

2437
cdef shared_ptr[_fbthrift_cbindings.cMyDataItem] MyDataItem_convert_to_cpp(object inst) except*:
25-
return (<_fbthrift_ctypes.MyDataItem?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
38+
return make_shared[_fbthrift_cbindings.cMyDataItem](deref(
39+
(<_fbthrift_ctypes.MyDataItem?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
40+
))
2641

2742
cdef object MyDataItem_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyDataItem]& c_struct):
2843
return _fbthrift_ctypes.MyDataItem._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
2944

3045
cdef shared_ptr[_fbthrift_cbindings.cMyUnion] MyUnion_convert_to_cpp(object inst) except*:
31-
return (<_fbthrift_ctypes.MyUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
46+
return make_shared[_fbthrift_cbindings.cMyUnion](deref(
47+
(<_fbthrift_ctypes.MyUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
48+
))
3249

3350
cdef object MyUnion_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyUnion]& c_struct):
3451
return _fbthrift_ctypes.MyUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
3552

3653
cdef shared_ptr[_fbthrift_cbindings.cMyException] MyException_convert_to_cpp(object inst) except*:
37-
return (<_fbthrift_ctypes.MyException?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
54+
return make_shared[_fbthrift_cbindings.cMyException](deref(
55+
(<_fbthrift_ctypes.MyException?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
56+
))
3857

3958
cdef object MyException_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyException]& c_struct):
4059
return _fbthrift_ctypes.MyException._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
4160

4261
cdef shared_ptr[_fbthrift_cbindings.cMyExceptionWithMessage] MyExceptionWithMessage_convert_to_cpp(object inst) except*:
43-
return (<_fbthrift_ctypes.MyExceptionWithMessage?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
62+
return make_shared[_fbthrift_cbindings.cMyExceptionWithMessage](deref(
63+
(<_fbthrift_ctypes.MyExceptionWithMessage?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
64+
))
4465

4566
cdef object MyExceptionWithMessage_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyExceptionWithMessage]& c_struct):
4667
return _fbthrift_ctypes.MyExceptionWithMessage._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
4768

4869
cdef shared_ptr[_fbthrift_cbindings.cReservedKeyword] ReservedKeyword_convert_to_cpp(object inst) except*:
49-
return (<_fbthrift_ctypes.ReservedKeyword?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
70+
return make_shared[_fbthrift_cbindings.cReservedKeyword](deref(
71+
(<_fbthrift_ctypes.ReservedKeyword?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
72+
))
5073

5174
cdef object ReservedKeyword_from_cpp(const shared_ptr[_fbthrift_cbindings.cReservedKeyword]& c_struct):
5275
return _fbthrift_ctypes.ReservedKeyword._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
5376

5477
cdef shared_ptr[_fbthrift_cbindings.cUnionToBeRenamed] UnionToBeRenamed_convert_to_cpp(object inst) except*:
55-
return (<_fbthrift_ctypes.UnionToBeRenamed?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
78+
return make_shared[_fbthrift_cbindings.cUnionToBeRenamed](deref(
79+
(<_fbthrift_ctypes.UnionToBeRenamed?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
80+
))
5681

5782
cdef object UnionToBeRenamed_from_cpp(const shared_ptr[_fbthrift_cbindings.cUnionToBeRenamed]& c_struct):
5883
return _fbthrift_ctypes.UnionToBeRenamed._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)

Diff for: third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/py3_inplace/gen-py3/test/fixtures/basic/module/converter.pyx

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
# @generated
77
#
88

9-
from libcpp.memory cimport make_shared
10-
from cython.operator cimport dereference as deref
9+
from libcpp.memory cimport make_shared, unique_ptr
10+
from cython.operator cimport dereference as deref, address
11+
from libcpp.utility cimport move as cmove
1112
from thrift.py3.types cimport const_pointer_cast
1213
cimport test.fixtures.basic.module.thrift_converter as _test_fixtures_basic_module_thrift_converter
1314
import test.fixtures.basic.module.types as _test_fixtures_basic_module_types

Diff for: third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/converter.pyx

+45-8
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,90 @@
66
# @generated
77
#
88

9+
from libcpp.memory cimport make_shared, unique_ptr
10+
from cython.operator cimport dereference as deref, address
11+
from libcpp.utility cimport move as cmove
912
cimport module.types as _fbthrift_ctypes
13+
from thrift.py3.serializer cimport (
14+
cserialize as __cserialize,
15+
cdeserialize as __cdeserialize,
16+
)
17+
from thrift.python.protocol cimport Protocol
18+
cimport folly.iobuf as _folly__iobuf
1019

1120

1221
cdef shared_ptr[_fbthrift_cbindings.cComplexUnion] ComplexUnion_convert_to_cpp(object inst) except*:
13-
return (<_fbthrift_ctypes.ComplexUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
22+
return make_shared[_fbthrift_cbindings.cComplexUnion](deref(
23+
(<_fbthrift_ctypes.ComplexUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
24+
))
1425

1526
cdef object ComplexUnion_from_cpp(const shared_ptr[_fbthrift_cbindings.cComplexUnion]& c_struct):
1627
return _fbthrift_ctypes.ComplexUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
1728

1829
cdef shared_ptr[_fbthrift_cbindings.cListUnion] ListUnion_convert_to_cpp(object inst) except*:
19-
return (<_fbthrift_ctypes.ListUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
30+
return make_shared[_fbthrift_cbindings.cListUnion](deref(
31+
(<_fbthrift_ctypes.ListUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
32+
))
2033

2134
cdef object ListUnion_from_cpp(const shared_ptr[_fbthrift_cbindings.cListUnion]& c_struct):
2235
return _fbthrift_ctypes.ListUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
2336

2437
cdef shared_ptr[_fbthrift_cbindings.cDataUnion] DataUnion_convert_to_cpp(object inst) except*:
25-
return (<_fbthrift_ctypes.DataUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
38+
return make_shared[_fbthrift_cbindings.cDataUnion](deref(
39+
(<_fbthrift_ctypes.DataUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
40+
))
2641

2742
cdef object DataUnion_from_cpp(const shared_ptr[_fbthrift_cbindings.cDataUnion]& c_struct):
2843
return _fbthrift_ctypes.DataUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
2944

3045
cdef shared_ptr[_fbthrift_cbindings.cVal] Val_convert_to_cpp(object inst) except*:
31-
return (<_fbthrift_ctypes.Val?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
46+
return make_shared[_fbthrift_cbindings.cVal](deref(
47+
(<_fbthrift_ctypes.Val?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
48+
))
3249

3350
cdef object Val_from_cpp(const shared_ptr[_fbthrift_cbindings.cVal]& c_struct):
3451
return _fbthrift_ctypes.Val._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
3552

3653
cdef shared_ptr[_fbthrift_cbindings.cValUnion] ValUnion_convert_to_cpp(object inst) except*:
37-
return (<_fbthrift_ctypes.ValUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
54+
return make_shared[_fbthrift_cbindings.cValUnion](deref(
55+
(<_fbthrift_ctypes.ValUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
56+
))
3857

3958
cdef object ValUnion_from_cpp(const shared_ptr[_fbthrift_cbindings.cValUnion]& c_struct):
4059
return _fbthrift_ctypes.ValUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
4160

4261
cdef shared_ptr[_fbthrift_cbindings.cVirtualComplexUnion] VirtualComplexUnion_convert_to_cpp(object inst) except*:
43-
return (<_fbthrift_ctypes.VirtualComplexUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
62+
return make_shared[_fbthrift_cbindings.cVirtualComplexUnion](deref(
63+
(<_fbthrift_ctypes.VirtualComplexUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
64+
))
4465

4566
cdef object VirtualComplexUnion_from_cpp(const shared_ptr[_fbthrift_cbindings.cVirtualComplexUnion]& c_struct):
4667
return _fbthrift_ctypes.VirtualComplexUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
4768

4869
cdef shared_ptr[_fbthrift_cbindings.cNonCopyableStruct] NonCopyableStruct_convert_to_cpp(object inst) except*:
49-
return (<_fbthrift_ctypes.NonCopyableStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
70+
cdef unique_ptr[_folly__iobuf.cIOBuf] _fbthrift__iobuf = cmove(
71+
__cserialize(
72+
(<_fbthrift_ctypes.NonCopyableStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(),
73+
Protocol.BINARY,
74+
)
75+
)
76+
cdef shared_ptr[_fbthrift_cbindings.cNonCopyableStruct] _fbthrift__out = make_shared[_fbthrift_cbindings.cNonCopyableStruct]()
77+
__cdeserialize(_fbthrift__iobuf.get(), _fbthrift__out.get(), Protocol.BINARY)
78+
return cmove(_fbthrift__out)
5079

5180
cdef object NonCopyableStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cNonCopyableStruct]& c_struct):
5281
return _fbthrift_ctypes.NonCopyableStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)
5382

5483
cdef shared_ptr[_fbthrift_cbindings.cNonCopyableUnion] NonCopyableUnion_convert_to_cpp(object inst) except*:
55-
return (<_fbthrift_ctypes.NonCopyableUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
84+
cdef unique_ptr[_folly__iobuf.cIOBuf] _fbthrift__iobuf = cmove(
85+
__cserialize(
86+
(<_fbthrift_ctypes.NonCopyableUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(),
87+
Protocol.BINARY,
88+
)
89+
)
90+
cdef shared_ptr[_fbthrift_cbindings.cNonCopyableUnion] _fbthrift__out = make_shared[_fbthrift_cbindings.cNonCopyableUnion]()
91+
__cdeserialize(_fbthrift__iobuf.get(), _fbthrift__out.get(), Protocol.BINARY)
92+
return cmove(_fbthrift__out)
5693

5794
cdef object NonCopyableUnion_from_cpp(const shared_ptr[_fbthrift_cbindings.cNonCopyableUnion]& c_struct):
5895
return _fbthrift_ctypes.NonCopyableUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct)

0 commit comments

Comments
 (0)