Commit bfbac5e
authored
stubgen: Fix generated dataclass
Fixes python#16811
stubgen was swallowing default values for `__init__` methods generated
by the dataclass plugin making their signature incorrect. This is
because the plugin does not include the argument's initializer in the
generated signature. I changed it to include a dummy ellipsis so that
stubgen can generate correct code.
I also fixed arguments added by the dataclass plugin with the invalid
names `*` and `**` to have the valid and unique names `*generated_args`
and `**generated_kwargs` (with extra underscores to make them unique if
necessary). This removes the need for the hack to special case them in
stubgen and is less confusing for someone looking at them in a stub
file.__init__ signature (python#16906)1 parent 2e5174c commit bfbac5e
File tree
4 files changed
+50
-31
lines changed- mypy
- plugins
- test-data/unit
4 files changed
+50
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
152 | | - | |
| 153 | + | |
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
158 | | - | |
| 159 | + | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
| |||
269 | 270 | | |
270 | 271 | | |
271 | 272 | | |
272 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
273 | 280 | | |
274 | | - | |
| 281 | + | |
275 | 282 | | |
276 | | - | |
| 283 | + | |
277 | 284 | | |
278 | 285 | | |
279 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | 540 | | |
552 | 541 | | |
553 | 542 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1610 | 1610 | | |
1611 | 1611 | | |
1612 | 1612 | | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
1613 | 1617 | | |
1614 | 1618 | | |
1615 | 1619 | | |
1616 | 1620 | | |
| 1621 | + | |
| 1622 | + | |
1617 | 1623 | | |
1618 | 1624 | | |
1619 | 1625 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4083 | 4083 | | |
4084 | 4084 | | |
4085 | 4085 | | |
4086 | | - | |
| 4086 | + | |
4087 | 4087 | | |
4088 | 4088 | | |
4089 | 4089 | | |
4090 | 4090 | | |
4091 | 4091 | | |
4092 | | - | |
4093 | | - | |
4094 | | - | |
| 4092 | + | |
| 4093 | + | |
| 4094 | + | |
| 4095 | + | |
4095 | 4096 | | |
4096 | 4097 | | |
4097 | 4098 | | |
4098 | | - | |
4099 | | - | |
| 4099 | + | |
| 4100 | + | |
4100 | 4101 | | |
4101 | 4102 | | |
4102 | 4103 | | |
| |||
4109 | 4110 | | |
4110 | 4111 | | |
4111 | 4112 | | |
4112 | | - | |
4113 | | - | |
4114 | | - | |
| 4113 | + | |
| 4114 | + | |
| 4115 | + | |
| 4116 | + | |
4115 | 4117 | | |
4116 | 4118 | | |
4117 | 4119 | | |
4118 | | - | |
4119 | | - | |
| 4120 | + | |
| 4121 | + | |
4120 | 4122 | | |
4121 | | - | |
| 4123 | + | |
4122 | 4124 | | |
4123 | 4125 | | |
4124 | 4126 | | |
4125 | 4127 | | |
4126 | 4128 | | |
4127 | 4129 | | |
4128 | | - | |
| 4130 | + | |
4129 | 4131 | | |
4130 | 4132 | | |
4131 | 4133 | | |
| |||
4162 | 4164 | | |
4163 | 4165 | | |
4164 | 4166 | | |
4165 | | - | |
| 4167 | + | |
4166 | 4168 | | |
4167 | 4169 | | |
4168 | 4170 | | |
| |||
4193 | 4195 | | |
4194 | 4196 | | |
4195 | 4197 | | |
| 4198 | + | |
| 4199 | + | |
| 4200 | + | |
| 4201 | + | |
| 4202 | + | |
| 4203 | + | |
| 4204 | + | |
4196 | 4205 | | |
4197 | 4206 | | |
4198 | 4207 | | |
4199 | 4208 | | |
4200 | 4209 | | |
4201 | 4210 | | |
4202 | 4211 | | |
4203 | | - | |
| 4212 | + | |
| 4213 | + | |
| 4214 | + | |
| 4215 | + | |
| 4216 | + | |
| 4217 | + | |
| 4218 | + | |
| 4219 | + | |
| 4220 | + | |
4204 | 4221 | | |
4205 | 4222 | | |
4206 | 4223 | | |
| |||
0 commit comments