Skip to content

Commit f43db94

Browse files
ahilgerfacebook-github-bot
authored andcommitted
add more deref_const to fix cython build issues
Summary: Python3.13t builds pull in a different version of Cython that's more picky / obstinate about refusing to cast rvalue returns to const lvalue ref. This fixes it for vector items in trunk builds. Reviewed By: prakashgayasen Differential Revision: D79842226 fbshipit-source-id: 8a44cf755a39ab51f1fbd54ce2d5f1ddcf0bde0c
1 parent 1af4a98 commit f43db94

File tree

24 files changed

+97
-28
lines changed

24 files changed

+97
-28
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ from libcpp.memory cimport make_shared, unique_ptr
2222
from cython.operator cimport dereference as deref, address
2323
from libcpp.utility cimport move as cmove
2424
{{^program:gen_py3_cython?}}
25-
from thrift.py3.types cimport const_pointer_cast
25+
from thrift.py3.types cimport (
26+
const_pointer_cast,
27+
deref_const as __deref_const,
28+
)
2629
cimport {{#program:py3Namespaces}}{{value}}.{{/program:py3Namespaces}}{{program:name}}.thrift_converter as {{!
2730
}}_{{#program:py3Namespaces}}{{value}}_{{/program:py3Namespaces}}{{program:name}}_thrift_converter
2831
{{#program:gen_legacy_container_converters?}}

third-party/thrift/src/thrift/compiler/generate/templates/py3/types/cython_python_to_cpp_item.mustache

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ key, include the parallel CythonPythonToCppKey file instead.
4848
}}{{^program:auto_migrate?}}{{^program:inplace_migrate?}}{{!
4949
}}deref((<{{> types/cython_python_type}}>item).{{> types/cpp_obj}}){{!
5050
}}{{/program:inplace_migrate?}}{{#program:inplace_migrate?}}{{!
51-
}}__deref_const[{{> types/cython_cpp_type}}]({{!
51+
}}__deref_const[{{> types/cython_cpp_type}}]({{!
5252
}}{{type:capi_converter_path}}.{{struct:name}}_convert_to_cpp(item._to_python())){{!
5353
}}{{/program:inplace_migrate?}}{{/program:auto_migrate?}}{{!
5454
}}{{#program:auto_migrate?}}{{!
55+
}}__deref_const[{{> types/cython_cpp_type}}]({{!
5556
}}{{#type:need_module_path?}}{{type:capi_converter_path}}.{{/type:need_module_path?}}{{!
56-
}}{{struct:name}}_convert_to_cpp(item){{!
57+
}}{{struct:name}}_convert_to_cpp(item)){{!
5758
}}{{/program:auto_migrate?}}{{!
5859
}}{{/type:structured}}{{!
5960
}}{{#type:container?}}{{!

third-party/thrift/src/thrift/compiler/generate/templates/py3/types/cython_python_to_cpp_key.mustache

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ keys (conventionally used for sets, lists, and map values).
3838
}}{{^program:auto_migrate?}}{{^program:inplace_migrate?}}{{!
3939
}}deref((<{{> types/cython_python_type}}>key).{{> types/cpp_obj}}){{!
4040
}}{{/program:inplace_migrate?}}{{#program:inplace_migrate?}}{{!
41-
}}{{type:capi_converter_path}}.{{struct:name}}_convert_to_cpp(key._to_python()){{!
41+
}}__deref_const[{{> types/cython_cpp_type}}]({{!
42+
}}{{type:capi_converter_path}}.{{struct:name}}_convert_to_cpp(key._to_python())){{!
4243
}}{{/program:inplace_migrate?}}{{/program:auto_migrate?}}{{!
4344
}}{{#program:auto_migrate?}}{{!
45+
}}__deref_const[{{> types/cython_cpp_type}}]({{!
4446
}}{{#type:need_module_path?}}{{type:capi_converter_path}}.{{/type:need_module_path?}}{{!
45-
}}{{struct:name}}_convert_to_cpp(key){{!
47+
}}{{struct:name}}_convert_to_cpp(key)){{!
4648
}}{{/program:auto_migrate?}}{{!
4749
}}{{/type:structured}}{{!
4850
}}{{#type:container?}}{{!

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from libcpp.memory cimport make_shared, unique_ptr
1010
from cython.operator cimport dereference as deref, address
1111
from libcpp.utility cimport move as cmove
12-
from thrift.py3.types cimport const_pointer_cast
12+
from thrift.py3.types cimport (
13+
const_pointer_cast,
14+
deref_const as __deref_const,
15+
)
1316
cimport test.fixtures.basic.module.thrift_converter as _test_fixtures_basic_module_thrift_converter
1417
import test.fixtures.basic.module.types as _test_fixtures_basic_module_types
1518

third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/py3_inplace/gen-py3/module/converter.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from libcpp.memory cimport make_shared, unique_ptr
1010
from cython.operator cimport dereference as deref, address
1111
from libcpp.utility cimport move as cmove
12-
from thrift.py3.types cimport const_pointer_cast
12+
from thrift.py3.types cimport (
13+
const_pointer_cast,
14+
deref_const as __deref_const,
15+
)
1316
cimport module.thrift_converter as _module_thrift_converter
1417
import module.types as _module_types
1518

third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/includes/converter.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from libcpp.memory cimport make_shared, unique_ptr
1010
from cython.operator cimport dereference as deref, address
1111
from libcpp.utility cimport move as cmove
12-
from thrift.py3.types cimport const_pointer_cast
12+
from thrift.py3.types cimport (
13+
const_pointer_cast,
14+
deref_const as __deref_const,
15+
)
1316
cimport includes.thrift_converter as _includes_thrift_converter
1417

1518

third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/module/converter.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from libcpp.memory cimport make_shared, unique_ptr
1010
from cython.operator cimport dereference as deref, address
1111
from libcpp.utility cimport move as cmove
12-
from thrift.py3.types cimport const_pointer_cast
12+
from thrift.py3.types cimport (
13+
const_pointer_cast,
14+
deref_const as __deref_const,
15+
)
1316
cimport module.thrift_converter as _module_thrift_converter
1417

1518

third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/transitive/converter.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from libcpp.memory cimport make_shared, unique_ptr
1010
from cython.operator cimport dereference as deref, address
1111
from libcpp.utility cimport move as cmove
12-
from thrift.py3.types cimport const_pointer_cast
12+
from thrift.py3.types cimport (
13+
const_pointer_cast,
14+
deref_const as __deref_const,
15+
)
1316
cimport transitive.thrift_converter as _transitive_thrift_converter
1417

1518

third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_includes/gen-py3/includes/converter.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from libcpp.memory cimport make_shared, unique_ptr
1010
from cython.operator cimport dereference as deref, address
1111
from libcpp.utility cimport move as cmove
12-
from thrift.py3.types cimport const_pointer_cast
12+
from thrift.py3.types cimport (
13+
const_pointer_cast,
14+
deref_const as __deref_const,
15+
)
1316
cimport includes.thrift_converter as _includes_thrift_converter
1417

1518

third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_includes/gen-py3/transitive/converter.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from libcpp.memory cimport make_shared, unique_ptr
1010
from cython.operator cimport dereference as deref, address
1111
from libcpp.utility cimport move as cmove
12-
from thrift.py3.types cimport const_pointer_cast
12+
from thrift.py3.types cimport (
13+
const_pointer_cast,
14+
deref_const as __deref_const,
15+
)
1316
cimport transitive.thrift_converter as _transitive_thrift_converter
1417

1518

0 commit comments

Comments
 (0)