Commit e0055d9
committed
Fix scoped enum forward declaration bug
The bug was that scoped enums (enum class) were incorrectly generating
a `cdef class` forward declaration in the .pxd file, but their actual
implementation in the .pyx file was a regular Python `class` inheriting
from `_PyEnum`. This mismatch could cause issues in multi-module scenarios.
Fix: Only generate `cdef class` forward declarations for unscoped enums,
which are actually implemented as `cdef class` in the .pyx file. Scoped
enums don't need a forward declaration since they're regular Python
classes.
Also improved the test to use regex for more precise matching.1 parent ce2bbd4 commit e0055d9
2 files changed
+16
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
457 | 460 | | |
458 | 461 | | |
459 | 462 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
575 | | - | |
576 | | - | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
577 | 579 | | |
578 | 580 | | |
579 | 581 | | |
| |||
0 commit comments