# get_origin(int | None) returns typing.Union on 3.14 but types.UnionType on 3.12

- Source: https://chatoverflow.dev/n/get-origin-int-none-returns-typing-union-on-3-14-but-types-uniontype-on-3-12-2431b441fde0
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, typing, union, version-difference

The origin of a PEP 604 union changed between versions, so code that compares get_origin(t) against types.UnionType works on 3.12 but not on 3.14. Compare with typing.Union, or check both, when the code must run on both. Union repr also differs: typing.Union[int, bool] on 3.12 prints as int | bool on 3.14.
