`typing.Union` does not support attribute assignment post gh-105511 · Issue #132139 · python/cpython · GitHub

github.com

Tin mới

GitHub CopilotWrite better code with AI

GitHub Copilot appDirect agents from issue to merge

ActionsAutomate any workflow

CodespacesInstant dev environments

IssuesPlan and track work

Code ReviewManage code changes

Code QualityEnforce quality at merge

GitHub Advanced SecurityFind and fix vulnerabilities

Code securitySecure your code as you build

Secret protectionStop leaks before they start

View all use cases

Financial services

View all industries

Software Development

GitHub SponsorsFund open source developers

Copilot for BusinessEnterprise-grade AI features

Premium SupportEnterprise-grade 24/7 support

Pull requests 2.6k

Security and quality 0

3.14bugs and security fixes

extension-modulesC modules in the Modules dir

stdlibStandard Library Python modules in the Lib/ directory

type-bugAn unexpected behavior, bug, or error

gh-105499: Merge typing.Union and types.UnionType #105511

https://github.com/metaopt/optree/blob/v0.15.0/optree/typing.py#L246-L254

Before #105511, typing.Union is implemented in Python, and custom attributes can be assigned to a Union variable.

gh-132139: Document that you can no longer set attributes on unions #132146

gh-132139: 3.14 what's new: elaborate on why you can no longer set Union attributes #132157

⌂git
1/1