fix(container): union-safe bean-name derivation (v26.06.95)#124
Merged
Conversation
PEP 604 union impl types (X | Y) are types.UnionType and lack __name__, so default
bean-name derivation ('rep.name or rep.impl_type.__name__') raised AttributeError
during ApplicationContext.start() (surfaced as BeanCreationException), breaking
startup for any app with a union-typed bean.
Add a union-safe Registration.display_name (falls back to union member names then
str()) and use it for bean-name derivation + scope-resolution error messages. Adds
regression tests; bumps 26.6.94 -> 26.6.95; updates CHANGELOG + README badge.
This was referenced Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Registering a bean whose implementation type is a PEP 604 union (
X | Y, atypes.UnionType) crashed application startup:surfaced as a
BeanCreationExceptionfromApplicationContext.start()— any app with a union-typed bean failed to boot.Fix
Registration.display_nameproperty: explicitname→ elseimpl_type.__name__→ else the union member names →str(). Never raises.application_context.py) and scope-resolution error messages (container.py).tests/container/test_registration_display_name.py.Release
26.6.94→26.6.95;CHANGELOG.md+ README version badge updated.v26.06.95pushed.Verification
tests/container+tests/context→ 340 passed; new regression tests 4 passed.v26.06.95(was crashing onv26.06.94).