Skip to content

fix: resolve TypeAliasType before issubclass in pack_union (fixes #330)#336

Open
gaoflow wants to merge 2 commits into
Fatal1ty:masterfrom
gaoflow:fix/pep695-alias-union-issubclass
Open

fix: resolve TypeAliasType before issubclass in pack_union (fixes #330)#336
gaoflow wants to merge 2 commits into
Fatal1ty:masterfrom
gaoflow:fix/pep695-alias-union-issubclass

Conversation

@gaoflow

@gaoflow gaoflow commented Jun 18, 2026

Copy link
Copy Markdown

PEP 695 type aliases nested inside unions crash serializer generation
because pack_union passes TypeAliasType objects directly to
issubclass(get_type_origin(...), Collection).

On Python 3.13+, get_type_origin returns None for TypeAliasType,
and issubclass() fails. On 3.12, it returns the alias itself, which
also fails the check.

This adds a helper that recursively unwraps TypeAliasType via
\_\_value\_\_ before the issubclass calls, fixing both the eager
and lazy compilation paths.

@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.61%. Comparing base (22cf576) to head (64923fe).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #336      +/-   ##
==========================================
- Coverage   99.92%   99.61%   -0.31%     
==========================================
  Files         101      101              
  Lines       12038    12050      +12     
==========================================
- Hits        12029    12004      -25     
- Misses          9       46      +37     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant