Skip to content

[pyasn1] Fix componentType to accept Asn1Type in SequenceOf#15442

Merged
srittau merged 1 commit intopython:mainfrom
emmanuel-ferdman:pyasn1-componenttype
Mar 18, 2026
Merged

[pyasn1] Fix componentType to accept Asn1Type in SequenceOf#15442
srittau merged 1 commit intopython:mainfrom
emmanuel-ferdman:pyasn1-componenttype

Conversation

@emmanuel-ferdman
Copy link
Copy Markdown
Contributor

@emmanuel-ferdman emmanuel-ferdman commented Feb 21, 2026

PR Summary

The componentType attribute in SequenceOfAndSetOfBase was typed as NamedTypes | None, but ASN.1 SEQUENCE OF / SET OF constructs take a single Asn1Type (like Integer()), not NamedTypes. This caused false positives when subclassing SequenceOf with a component type, which is the standard usage shown in pyasn1's own documentation. The fix also removes the # type: ignore[assignment] that were added to ldap3 stubs.

Fixes #15369

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Copy Markdown
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@srittau srittau merged commit 50ec910 into python:main Mar 18, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pyasn1: mypy error with doc example of SequenceOf

2 participants