Commit 1d18566
authored
Fix crash on partially typed namespace package (#20742)
Fixes #16214
Closes #20658
The root cause is similar to the issue fixed by
#19044, when there are multiple
packages in `google` namespace, some with `py.typed`, some without. As a
result, there can be a situation where we first find the untyped one,
and mark ancestor (i.e. `google`) as suppressed, but then we find the
typed one and actually add ancestor (i.e. `google`) to the graph. This
creates a situation where we write some references to `google` in cache,
while it may not be loaded on the warm run, thus causing a crash.
My solution is simple: un-suppress namespace ancestors if there is at
least one package that needs them, so that the build graph is
consistent.
Unfortunately, this uncovers another (pre-existing) bug where `# type:
ignore`s are not handled correctly on warm runs, similar to
#20105. In any case, I am going to
submit a separate PR for this bug (I think there may be a simple fix for
it).1 parent e2923a1 commit 1d18566
3 files changed
Lines changed: 31 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3144 | 3144 | | |
3145 | 3145 | | |
3146 | 3146 | | |
3147 | | - | |
| 3147 | + | |
3148 | 3148 | | |
3149 | | - | |
| 3149 | + | |
3150 | 3150 | | |
3151 | 3151 | | |
3152 | 3152 | | |
| |||
3155 | 3155 | | |
3156 | 3156 | | |
3157 | 3157 | | |
3158 | | - | |
| 3158 | + | |
3159 | 3159 | | |
3160 | 3160 | | |
3161 | 3161 | | |
| |||
3650 | 3650 | | |
3651 | 3651 | | |
3652 | 3652 | | |
3653 | | - | |
| 3653 | + | |
3654 | 3654 | | |
3655 | 3655 | | |
3656 | 3656 | | |
| |||
3710 | 3710 | | |
3711 | 3711 | | |
3712 | 3712 | | |
3713 | | - | |
3714 | | - | |
| 3713 | + | |
| 3714 | + | |
| 3715 | + | |
| 3716 | + | |
| 3717 | + | |
| 3718 | + | |
3715 | 3719 | | |
3716 | | - | |
3717 | | - | |
| 3720 | + | |
| 3721 | + | |
3718 | 3722 | | |
3719 | 3723 | | |
3720 | 3724 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | | - | |
| 474 | + | |
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
0 commit comments