Commit 036534c
Disallow python patch of unsafe patch
Summary:
In ICSP, unsafe patch is still used in IDL: https://fburl.com/code/29nc4mqx
Currently in order to use python patch, we will need to enable python patch for those unsafe patch thrift files as well. .e.g,
```
include "path/to/gen_patch_foo.thrift"
struct Bar {
1: gen_patch_foo fooPatch;
2: string msg;
}
```
In order to enable python patch on Bar, we need to enable it on "path/to/gen_patch_foo.thrift" as well.
```
thrift_patch_library(
gen_patch_python_api_experimental = True,
...
)
```
This has two problems
1. Users are able to create patch of unsafe patch, which is a confusion concept.
2. It makes python patch harder to enable, since we need to enable it for all dependents unsafe patch as well.
To fix the two issues above, this diff will skip generating python field patch for fields that contain unsafe patch. e.g., after this diff, we will skip `fooPatch` field (as if it doesn't exist) when generating `BarPatch`.
Differential Revision: D67880408
fbshipit-source-id: de047e18d4caa164ae3a4e24e1b3baa25fbc32841 parent 41db10d commit 036534c
File tree
4 files changed
+44
-6
lines changed- third-party/thrift/src/thrift/compiler/generate
- python
- templates/patch
4 files changed
+44
-6
lines changedLines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
34 | 60 | | |
35 | 61 | | |
36 | 62 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
40 | 44 | | |
41 | 45 | | |
42 | 46 | | |
| |||
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
| 223 | + | |
223 | 224 | | |
224 | 225 | | |
225 | 226 | | |
| |||
300 | 301 | | |
301 | 302 | | |
302 | 303 | | |
| 304 | + | |
303 | 305 | | |
304 | 306 | | |
305 | 307 | | |
| |||
317 | 319 | | |
318 | 320 | | |
319 | 321 | | |
320 | | - | |
| 322 | + | |
321 | 323 | | |
322 | 324 | | |
323 | 325 | | |
| |||
670 | 672 | | |
671 | 673 | | |
672 | 674 | | |
| 675 | + | |
| 676 | + | |
673 | 677 | | |
674 | 678 | | |
675 | 679 | | |
| |||
774 | 778 | | |
775 | 779 | | |
776 | 780 | | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
777 | 785 | | |
778 | 786 | | |
779 | 787 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
0 commit comments