Commit bc26a06
Unraw complex struct enum field python names (#5050)
* Unraw complex struct enum field python names
Stray case related to #2395 (probably unnoticed because the functionality is
newer and a bit of an edge case).
The `python_name` of struct-type enum variant fields (and the `__match_args__`
of the variant) do not unraw the names of these fields, which effectively
makes them unusable as the resulting identifiers contain '#' which the Python
lexer interprets as comments. The only reason you'd probably want to do this
anyway is to use reserved identifiers (`type` in my case).
* Add newsfragment for fix
* Fix clippy lints in impl_complex_enum_variant_match_args and callers
No need to pass mutable vec ref anymore
* don't overeagerly collect field_names iterator
* add test case for complex enums containing raw identifiers
* only test raw ident pattern matching on Python 3.10+1 parent 345735b commit bc26a06
File tree
3 files changed
+42
-5
lines changed- newsfragments
- pyo3-macros-backend/src
- tests
3 files changed
+42
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1188 | 1188 | | |
1189 | 1189 | | |
1190 | 1190 | | |
1191 | | - | |
| 1191 | + | |
1192 | 1192 | | |
1193 | 1193 | | |
| 1194 | + | |
1194 | 1195 | | |
1195 | 1196 | | |
1196 | 1197 | | |
1197 | 1198 | | |
1198 | 1199 | | |
1199 | | - | |
| 1200 | + | |
1200 | 1201 | | |
1201 | 1202 | | |
1202 | 1203 | | |
| |||
1257 | 1258 | | |
1258 | 1259 | | |
1259 | 1260 | | |
1260 | | - | |
| 1261 | + | |
1261 | 1262 | | |
1262 | 1263 | | |
1263 | 1264 | | |
| |||
1432 | 1433 | | |
1433 | 1434 | | |
1434 | 1435 | | |
1435 | | - | |
| 1436 | + | |
1436 | 1437 | | |
1437 | 1438 | | |
1438 | 1439 | | |
| |||
1743 | 1744 | | |
1744 | 1745 | | |
1745 | 1746 | | |
1746 | | - | |
| 1747 | + | |
1747 | 1748 | | |
1748 | 1749 | | |
1749 | 1750 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
0 commit comments