Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

typing: fix x509.name.NameAttribute.value to be either str or bytes #12056

Closed
prauscher opened this issue Nov 28, 2024 · 1 comment · Fixed by #12068
Closed

typing: fix x509.name.NameAttribute.value to be either str or bytes #12056

prauscher opened this issue Nov 28, 2024 · 1 comment · Fixed by #12068

Comments

@prauscher
Copy link
Contributor

Currently, x509.name.NameAttribute.value is typed as str | bytes, as it might be bytes for X500_UNIQUE_IDENTIFIER. To improve type checking, I'd suggest to use two subclasses of NameAttribute (say StringNameAttribute and BytesNameAttribute) which use correct typing for value. Now @overrides can be used for get_attributes_for_oid to deliver list[BytesNameAttribute] or list[StringNameAttribute] respectively.

I could draft a PR if the idea is generally accepted, just let me know :)

@alex
Copy link
Member

alex commented Nov 28, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants