Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

#[pyclass] over enum is missing python's name and value attributes #3791

Closed
softstream-link opened this issue Feb 3, 2024 · 1 comment
Closed

Comments

@softstream-link
Copy link

#[pyclass]
#[derive(Debug, Clone)]
pub enum ConType {
    Initiator,
    Acceptor,
}

equivalent

class ConType(enum.Enum):
    Initiator = enum.auto()
    Acceptor = enum.auto()

however when defined in python can be used as:

con_type = ConType.Initiator
print(f'{con_type.name}, {con_type.value}')

but if only defined using pyo3 rust calling name and value attributes fail

@davidhewitt
Copy link
Member

I think this is a duplicate of #2887

That issue has a summary of what we think needs to happen to improve this, PR welcome to help!

@davidhewitt davidhewitt closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants